forked from iree-org/iree
-
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.
[Transform] Add a new transform op that applies patterns (iree-org#9676)
This revision introduces a `transform.iree.apply_patterns` operation that operates on an isolated from above op and applies a set of patterns while listening and updating transform dialect handles. The list of patterns is specified via attributes that are additive and roughly play the role of populate functions. iree-opt is extended so that it can run transform dialect directly without files, which results in general simplifications.
- Loading branch information
1 parent
e789f95
commit 2e03b3c
Showing
9 changed files
with
175 additions
and
73 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
26 changes: 26 additions & 0 deletions
26
compiler/src/iree/compiler/Codegen/Common/test/transform_dialect_apply_pattern_op.mlir
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,26 @@ | ||
// RUN: iree-opt %s -transform-dialect-interpreter -transform-dialect-drop-schedule | FileCheck %s | ||
|
||
// CHECK-LABEL: @select_cmp_eq_select | ||
// CHECK: return %arg1 | ||
func.func @select_cmp_eq_select(%arg0: i64, %arg1: i64) -> i64 { | ||
%0 = arith.cmpi eq, %arg0, %arg1 : i64 | ||
%1 = arith.select %0, %arg0, %arg1 : i64 | ||
return %1 : i64 | ||
} | ||
|
||
transform.with_pdl_patterns { | ||
^bb0(%arg0: !pdl.operation): | ||
pdl.pattern @pdl_fun_target : benefit(1) { | ||
%args = operands | ||
%results = types | ||
%0 = operation "func.func"(%args : !pdl.range<value>) -> (%results : !pdl.range<type>) | ||
// TODO: we don't want this, but it is the required terminator for pdl.pattern | ||
rewrite %0 with "transform.dialect" | ||
} | ||
|
||
transform.sequence %arg0 { | ||
^bb1(%arg1: !pdl.operation): | ||
%0 = pdl_match @pdl_fun_target in %arg1 | ||
transform.iree.apply_patterns %0 { canonicalization } | ||
} | ||
} |
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