[Mlir-commits] [mlir] [MLIR][MemRef] Fix DimOfReifyRankedShapedTypeOpInterface IR-change on failure (PR #188973)
Mehdi Amini
llvmlistbot at llvm.org
Wed Apr 1 06:34:48 PDT 2026
joker-eph wrote:
> That is exactly what I am proposing. One approach that I havent had time to look at is to have a listener listen on any operation creation and keep track of all dim operations created.
I am failing to see how a listener actually solves the problem we're discussing here. The case at hand, look again at the comment:
```
// An empty (or failed) OpFoldResult signals that this specific dimension
// cannot be reified. Some implementations materialize all dimensions at
// once (e.g. via reifyResultShapes) and may create ops for other dimensions
// before discovering that this dimension is not reifiable. Erase those
// stray ops before returning failure.
```
The `reifyDimOfResult` implementation is creating IR before realizing that it'll fail. I don't see how you can avoid creating this IR with a listener.
What you describe looks to me like a different problem: how to perform some sort of "CSE" along the way. But that's solving a different problem as far as I can tell: it's not about failed materializations, but instead of how to be more efficient for successful materialization.
Feel free to correct me if I misunderstood what you're describing, right now I don't see how that would be better than what's done here.
https://github.com/llvm/llvm-project/pull/188973
More information about the Mlir-commits
mailing list