-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mlir][transform] Fix new interpreter and library preloading passes. (#…
…69190) This PR fixes the two recently added passes from #68661, which were non-functional and untested. In particular: * The passes did not declare their dependent dialects, so they could not run at all in the most simple cases. * The mechanism of loading the library module in the initialization of the intepreter pass is broken by design (but, fortunately, also not necessary). This is because the initialization of all passes happens before the execution of any other pass, so the "preload library" pass has not run yet at the time the interpreter pass gets initialized. Instead, the library is now loaded every time the interpreter pass is run. This should not be exceedingly expensive, since it only consists of looking up the library in the dialect. Also, this removes the library module from the pass state, making it possible in the future to preload libraries in several passes. * The PR adds tests for the two passes, which were completely untested previously.
- Loading branch information
1 parent
bea3684
commit 22e3bf4
Showing
5 changed files
with
59 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// RUN: mlir-opt %s -transform-interpreter=entry-point=entry_point \ | ||
// RUN: -split-input-file -verify-diagnostics | ||
|
||
module attributes { transform.with_named_sequence } { | ||
transform.named_sequence @entry_point(!transform.any_op {transform.readonly}) { | ||
^bb0(%arg0: !transform.any_op): | ||
// expected-remark @below {{applying transformation}} | ||
transform.test_transform_op | ||
transform.yield | ||
} | ||
|
||
transform.named_sequence @__transform_main(!transform.any_op {transform.readonly}) { | ||
^bb0(%arg0: !transform.any_op): | ||
transform.test_transform_op // Note: does not yield remark. | ||
transform.yield | ||
} | ||
} |
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,17 @@ | ||
// RUN: mlir-opt %s -transform-interpreter \ | ||
// RUN: -split-input-file -verify-diagnostics | ||
|
||
module attributes { transform.with_named_sequence } { | ||
transform.named_sequence @__transform_main(!transform.any_op {transform.readonly}) { | ||
^bb0(%arg0: !transform.any_op): | ||
// expected-remark @below {{applying transformation}} | ||
transform.test_transform_op | ||
transform.yield | ||
} | ||
|
||
transform.named_sequence @entry_point(!transform.any_op {transform.readonly}) { | ||
^bb0(%arg0: !transform.any_op): | ||
transform.test_transform_op // Note: does not yield remark. | ||
transform.yield | ||
} | ||
} |
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,19 @@ | ||
// RUN: mlir-opt %s \ | ||
// RUN: -transform-preload-library=transform-library-paths=%p%{fs-sep}test-interpreter-library \ | ||
// RUN: -transform-interpreter=entry-point=private_helper \ | ||
// RUN: -split-input-file -verify-diagnostics | ||
|
||
// expected-remark @below {{message}} | ||
module {} | ||
|
||
// ----- | ||
|
||
// Note: no remark here since local entry point takes precedence. | ||
module attributes { transform.with_named_sequence } { | ||
transform.named_sequence @private_helper(!transform.any_op {transform.readonly}) { | ||
^bb0(%arg0: !transform.any_op): | ||
// expected-remark @below {{applying transformation}} | ||
transform.test_transform_op | ||
transform.yield | ||
} | ||
} |