This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Fold outer dims permutation to pack when propagating
ClosedPublic

Authored by chelini on Jan 11 2023, 5:21 AM.

Details

Summary

Instead of folding the transpose into the linalg.generic keep the
transposition in the packing operation, effectively making the
linalg.generic transparent to the propagation. Additionally, if the init
operand of the generic has users pack the init and pass it as the
operand to the generic.

Diff Detail

Event Timeline

chelini created this revision.Jan 11 2023, 5:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2023, 5:21 AM
chelini requested review of this revision.Jan 11 2023, 5:21 AM
chelini added a reviewer: pifon2a.
chelini edited the summary of this revision. (Show Details)
chelini retitled this revision from [MLIR] Propagate outer dims perm to pack when propagating to [MLIR] Fold outer dims permutation to pack when propagating.Jan 11 2023, 6:40 AM

LG, thanks!

mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
108–111

We can rewrite it with

for (unsigned [pos, expr] : llvm::enumerate(exprs) {
  unsigned posInDomain = expr.cast<....>()....
}

This fits more about LLVM style, and explicitly tell us that the pos is iterating on exprs.

280

Can this be genericOp.getRegionOutputArgs()[0].use_empty()?

please also move it to the line right before the usage. (btw, I think we don't need to declare a variable for it)

chelini updated this revision to Diff 488500.Jan 12 2023, 12:02 AM
  • code changes to fit LLVM style
  • use use_empty instead of getting users
chelini marked 2 inline comments as done.Jan 12 2023, 12:02 AM
hanchung accepted this revision.Jan 12 2023, 10:45 AM
This revision is now accepted and ready to land.Jan 12 2023, 10:45 AM