This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][Affine] Fix/improve affine sibling fusion
ClosedPublic

Authored by bondhugula on Mar 23 2023, 3:15 PM.

Details

Summary

The sibling fusion profitability checks shouldn't rely on the presence
of a store op in the sibling. The reuse is between the loads.

Fixes issues raised at https://discourse.llvm.org/t/understanding-the-affine-loop-fusion-pass/69452

Diff Detail

Event Timeline

bondhugula created this revision.Mar 23 2023, 3:15 PM
bondhugula requested review of this revision.Mar 23 2023, 3:15 PM
bondhugula added inline comments.Mar 23 2023, 3:21 PM
mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
1878–1884

@dcaballe @andydavis1 This check can be completely removed. The single store was being used in the profitability check and it wasn't needed/correct to do that.

dcaballe accepted this revision.Mar 24 2023, 9:29 AM

it makes sense. I think sibling fusion fell behind when I generalized producer-consumer fusion as I didn't look too much into it at that time.

This revision is now accepted and ready to land.Mar 24 2023, 9:29 AM
ayzhuang added inline comments.Mar 24 2023, 1:04 PM
mlir/test/Transforms/loop-fusion.mlir
1205–1206

Please update the comment.

bondhugula marked an inline comment as done.

Address review comment.

mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
1878–1884

Removing this will be addressed in the next PR since it exposes bugs due to missing checks for sibling fusion.

mlir/test/Transforms/loop-fusion.mlir
1205–1206

Thanks, done.

This revision was landed with ongoing or failed builds.Mar 25 2023, 3:26 PM
This revision was automatically updated to reflect the committed changes.