[Mlir-commits] [mlir] [MLIR][Affine] Fix fusion across ops with unknown memory effects (PR #203231)
Aditya Pradhan
llvmlistbot at llvm.org
Fri Jun 12 05:02:29 PDT 2026
================
@@ -83,7 +122,7 @@ unsigned Node::getLoadOpCount(Value memref) const {
if (auto affineLoad = dyn_cast<AffineReadOpInterface>(loadOp)) {
if (memref == affineLoad.getMemRef())
++loadOpCount;
- } else if (hasEffect<MemoryEffects::Read>(loadOp, memref)) {
+ } else if (mayHaveEffect<MemoryEffects::Read>(loadOp, memref)) {
++loadOpCount;
}
}
----------------
pradhanaditya wrote:
Note that the `Node` here is just `MemRefDependenceGraph::Node` (see the using declaration). I think Node already has what it needs here -- it owns its loads/stores (and memrefLoads/…) lists, so it can answer these without reaching outside itself. Passing the MemRefDependenceGraph (which owns the Nodes) back into a Node method couples them in the wrong direction, and if we did memoize, a Node-local field would be the natural place, not the MDG. But either way it would need invalidation/update as fusion mutates the graph, which isn't worth it for a negligible recompute. So, I would rather not add more complexity to the code.
Thanks for thinking it through.
https://github.com/llvm/llvm-project/pull/203231
More information about the Mlir-commits
mailing list