mirror of https://github.com/llvm/torch-mlir
RefineTypes aten.sum: check dtype exists before accessing methods (#1944)
This commit adds a check that `defaultDtype` exists in the RefineTypes handling of `AtenSumOp` before accessing the method `isInteger`, which crashes the program is `defaultDtype` is null. The handling of `defaultDtype` is the same as the one used for the `AtenSumDimIntListOp`.pull/1947/head snapshot-20230317.780
parent
91cd37256c
commit
18035021f0
|
@ -893,6 +893,13 @@ void TypeAnalysis::visitOperation(Operation *op,
|
||||||
|
|
||||||
if (auto sum = dyn_cast<AtenSumOp>(op)) {
|
if (auto sum = dyn_cast<AtenSumOp>(op)) {
|
||||||
Type defaultDtype = operands[0]->getValue().dtype;
|
Type defaultDtype = operands[0]->getValue().dtype;
|
||||||
|
if (!defaultDtype) {
|
||||||
|
incorporateKnowledge(
|
||||||
|
sum.getResult(),
|
||||||
|
ValueKnowledge::getTensorPessimisticValueState(op->getContext()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If the input dtype is bool, the result type should be i64.
|
// If the input dtype is bool, the result type should be i64.
|
||||||
if (defaultDtype.isInteger(1))
|
if (defaultDtype.isInteger(1))
|
||||||
defaultDtype =
|
defaultDtype =
|
||||||
|
|
Loading…
Reference in New Issue