-
Notifications
You must be signed in to change notification settings - Fork 639
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Codegen][Tuner] attr verifier for tuning specs (#19486)
This PR is relevant to task in #19214: add [a discardable attr verifier](https://mlir.llvm.org/docs/DefiningDialects/#discardable-attribute-verification) for entry points iree_codegen.tuning_spec_entrypoint --------- Signed-off-by: Bangtian Liu <liubangtian@gmail.com>
- Loading branch information
1 parent
3614f69
commit e553425
Showing
7 changed files
with
120 additions
and
31 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
53 changes: 53 additions & 0 deletions
53
compiler/src/iree/compiler/Codegen/Common/test/verify_tuning_specs.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,53 @@ | ||
// RUN: iree-opt --verify-diagnostics --split-input-file %s | ||
|
||
module @foo_module attributes { transform.with_named_sequence } { | ||
func.func @baz(%arg0: i32) -> () { | ||
return | ||
} | ||
transform.named_sequence @bar(%arg0: !transform.any_op {transform.readonly}) -> !transform.any_op | ||
attributes { iree_codegen.something } { | ||
transform.yield %arg0 : !transform.any_op | ||
} | ||
// expected-error @+1{{'iree_codegen.tuning_spec_entrypoint' attribute must be a UnitAttr}} | ||
transform.named_sequence @foo(%arg0: !transform.any_op {transform.readonly}) -> !transform.any_op | ||
attributes { iree_codegen.tuning_spec_entrypoint = "foo" } { | ||
transform.yield %arg0 : !transform.any_op | ||
} | ||
} | ||
|
||
// ----- | ||
|
||
module @foo_module attributes { transform.with_named_sequence } { | ||
// expected-error @+1{{Tuning spec entry point expected to have a single any_op argument}} | ||
transform.named_sequence @foo(%arg0: !transform.any_op {transform.readonly}, %arg1: !transform.any_op {transform.readonly}) -> !transform.any_op | ||
attributes { iree_codegen.tuning_spec_entrypoint } { | ||
transform.yield %arg0 : !transform.any_op | ||
} | ||
} | ||
|
||
// ----- | ||
|
||
module @foo_module attributes { transform.with_named_sequence } { | ||
// expected-error @+1{{Tuning spec entry point expected to have a single any_op argument}} | ||
transform.named_sequence @foo(%arg0: i32) -> !transform.any_op | ||
attributes { iree_codegen.tuning_spec_entrypoint } {} | ||
} | ||
|
||
// ----- | ||
|
||
module @foo_module attributes { transform.with_named_sequence } { | ||
// expected-error @+1{{Tuning spec entry point expected to return any_op}} | ||
transform.named_sequence @foo(%arg0: !transform.any_op {transform.readonly}) -> i32 | ||
attributes { iree_codegen.tuning_spec_entrypoint } { | ||
%0 = arith.constant 0 : i32 | ||
transform.yield %0 : i32 | ||
} | ||
} | ||
|
||
// ----- | ||
|
||
module @foo_module attributes { transform.with_named_sequence } { | ||
// expected-error @+1{{Tuning spec entry point expected to return any_op}} | ||
transform.named_sequence @foo(%arg0: !transform.any_op {transform.readonly}) | ||
attributes { iree_codegen.tuning_spec_entrypoint } {} | ||
} |
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