mirror of https://github.com/llvm/torch-mlir
[LINALG][MLIR] Fix the broadcast dim check for elementwise ops lowering
Signed-Off-by: Gaurav Shukla <gauravshukla789@gmail.com>pull/2882/head
parent
cc06391630
commit
b3dfea223d
|
@ -297,7 +297,11 @@ Value torch_to_linalg::createElementwiseLinalgGeneric(
|
||||||
auto equalToRunning =
|
auto equalToRunning =
|
||||||
b.create<arith::CmpIOp>(loc, arith::CmpIPredicate::eq,
|
b.create<arith::CmpIOp>(loc, arith::CmpIPredicate::eq,
|
||||||
resultShape[resultDim], currentDimSize);
|
resultShape[resultDim], currentDimSize);
|
||||||
b.create<cf::AssertOp>(loc, equalToRunning,
|
auto equalToOne = b.create<arith::CmpIOp>(loc, arith::CmpIPredicate::eq,
|
||||||
|
c1, currentDimSize);
|
||||||
|
auto isValidBroadcast =
|
||||||
|
b.create<arith::OrIOp>(loc, equalToRunning, equalToOne);
|
||||||
|
b.create<cf::AssertOp>(loc, isValidBroadcast,
|
||||||
"mismatched size for broadcast");
|
"mismatched size for broadcast");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue