[Mlir-commits] [mlir] [MLIR][Tensor] Fix out-of-bounds FoldEmptyTensorWithDimOp crash #111270 (PR #112196)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Oct 16 12:51:29 PDT 2024
================
@@ -979,7 +979,9 @@ struct FoldEmptyTensorWithDimOp : public OpRewritePattern<DimOp> {
auto emptyTensorOp = dimOp.getSource().getDefiningOp<EmptyOp>();
if (!emptyTensorOp || !maybeConstantIndex)
return failure();
- if (!emptyTensorOp.getType().isDynamicDim(*maybeConstantIndex))
+ auto emptyTensorType = emptyTensorOp.getType();
----------------
MaheshRavishankar wrote:
Yes that is true, but when it is constant and you can flag it as UB in the compiler we are essentially chosing not to. So something is accessing dimensions of tensor that is out of bound. This unless caught in a compiler most definitely will lead to run time error on the generated code (either correctness cause you indexing might be off, or out of bounds error).
https://github.com/llvm/llvm-project/pull/112196
More information about the Mlir-commits
mailing list