forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mlir] Add apply_patterns.linalg.generalize_pack_unpack TD Op (llvm#1…
…16373) This PR introduces populateGeneralizePatterns, which collects the following patterns: * `GeneralizeOuterUnitDimsPackOpPattern`, * `GeneralizeOuterUnitDimsUnPackOpPattern` (currently a TODO). These patterns are wrapped in a new Transform Dialect Op: `apply_patterns.linalg.generalize_pack_unpack`. This Op facilitates creating more involved end-to-end compilation pipelines for `tensor.pack` and `tensor.unpack` operations. It will be required in an upcoming PR building on top of llvm#115698. No new tests are added in this PR. Instead, existing tests from: * "generalize-tensor-pack.mlir" are reused. To achieve this: * I've updated the test to use `transform.apply_patterns.linalg.generalize_pack_unpack` instead of the flag `--test-linalg-transform-patterns="test-generalize-tensor-pack"`, avoiding artificial tests solely for the TD Op. * The TD sequence is saved to a new file, "generalize_pack.mlir", and pre-loaded using the option: `--transform-preload-library='transform-library-paths=%p/td/generalize_pack.mlir'` This avoids duplicating the sequence for every "split" in the input file. * Added "lit.local.cfg" to exclude the "test/Dialect/Linalg/td" directory from test discovery, ensuring "generalize_pack.mlir" is not treated as a test file.
- Loading branch information
1 parent
1dcb3db
commit 63b926a
Showing
7 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Skip the directory with input TD sequences | ||
config.excludes = ["td"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module @transforms attributes { transform.with_named_sequence } { | ||
transform.named_sequence @__transform_main(%module: !transform.any_op {transform.readonly}) { | ||
%pack = transform.structured.match ops{["tensor.pack"]} in %module : (!transform.any_op) -> !transform.any_op | ||
|
||
%1 = transform.get_parent_op %pack {isolated_from_above} : (!transform.any_op) -> !transform.any_op | ||
transform.apply_patterns to %1 { | ||
transform.apply_patterns.linalg.generalize_pack_unpack | ||
} : !transform.any_op | ||
|
||
transform.yield | ||
} | ||
} |