Extends the pack/unpack generalization patterns to work for any packing
op with only full tiles. This produces a combination of rank-reduced
insert/extract slice ops paired with a transpose on the reduced shape,
similar to what the pattern currently produces for fully tiled
pack/unpacks. Note that only the outer dims are rank-reduced in this
pattern, leaving the shape of the inner tile intact.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Sorry for that late review. Overall looks good to me, just few nits!
mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp | ||
---|---|---|
1031–1039 | style nit: we can add continue to the end of the first if statement. It can save us one level of nesting. And maybe to others, that could save us more level of nestings. | |
1177–1181 | style nit: wrap with braces because it spans to multiple lines. | |
1199–1200 | delete the comment |
@hanchung I noticed the pack/unpack lowering patterns exposed in D148867 and am wondering what the purpose of these generalization patterns are given that those patterns exist. It seems to me like duplicated functionality so before landing this I wanted to see if it made more sense to replace the generalization patterns rather than expanding them with this patch.
They cover different subset of generalization. I've been working on pack op codegen and the other one supports some of my use cases. So I start using some of them. I think eventually they should be unified. This one does not generate expand_shape/collapse_shape op while the other does. I think we should extend the other one to handle dynamic cases as well. After that, we can migrate some logics to there, and we will have unified patterns/utils.
style nit: we can add continue to the end of the first if statement. It can save us one level of nesting. And maybe to others, that could save us more level of nestings.