Skip to content

Commit

Permalink
update tuning.md and test file
Browse files Browse the repository at this point in the history
Signed-off-by: Bangtian Liu <[email protected]>
  • Loading branch information
bangtianliu committed Dec 19, 2024
1 parent e5350b7 commit b2d4cd2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ module @foo_module attributes { transform.with_named_sequence } {

// -----

// expected-error @+1{{The default tuning specification must include an operation with the symbol name '__kernel_config'}}
// expected-error @+1{{The tuning specification must include a named sequence with the symbol name '__kernel_config'}}
module @iree_default_tuning_spec attributes { iree_codegen.tuning_spec_with_default_entrypoint } {
}

// -----

// expected-error @+1{{The tuning specification must include a named sequence with the symbol name '__kernel_config'}}
module @iree_default_tuning_spec attributes { iree_codegen.tuning_spec_with_default_entrypoint } {
func.func @__kernel_config(%arg0: i32) -> () {
return
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace mlir::iree_compiler {
// Constant names.
//===----------------------------------------------------------------------===//
constexpr StringLiteral kConfigAttrName = "lowering_config";
constexpr StringLiteral kTuningDefaultSpecAttrName =
constexpr StringLiteral kTuningSpecDefaultEntrypointAttrName =
"iree_codegen.tuning_spec_with_default_entrypoint";
constexpr StringLiteral kTuningSpecEntrypointAttrName =
"iree_codegen.tuning_spec_entrypoint";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ IREECodegenDialect::verifyOperationAttribute(Operation *op,
// b. It must have exactly one argument type, and the argument must be
// of type `transform::AnyOpType`.

if (symbol == kTuningDefaultSpecAttrName) {
if (symbol == kTuningSpecDefaultEntrypointAttrName) {
if (auto moduleOp = dyn_cast<ModuleOp>(op)) {
if (!llvm::any_of(moduleOp.getOps(), [](auto &op) {
if (auto namedSeqOp = dyn_cast<transform::NamedSequenceOp>(&op)) {
Expand All @@ -75,8 +75,8 @@ IREECodegenDialect::verifyOperationAttribute(Operation *op,
return false;
})) {
return moduleOp.emitError()
<< "The default tuning specification must include an "
"operation with the symbol name '"
<< "The tuning specification must include a named "
"sequence with the symbol name '"
<< kKernelConfigSpecName << "'.";
}
}
Expand Down
4 changes: 3 additions & 1 deletion docs/website/docs/reference/tuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ attempting the default one.
### Example

```mlir
module @my_spec attributes { transform.with_named_sequence } {
module @my_spec attributes { transform.with_named_sequence, iree_codegen.tuning_spec_with_default_entrypoint } {
transform.named_sequence @apply_op_config(%op: !transform.any_op {transform.readonly},
%config: !transform.any_param {transform.readonly}) {
transform.annotate %op "compilation_info" = %config : !transform.any_op, !transform.any_param
Expand Down Expand Up @@ -123,6 +123,8 @@ that conform to the following format:
`!transform.any_op`.
* All entry points in the final tuning specs must either read
(`transform.readonly`) or consume (`transform.consumed`) the argument.
* The `iree_codegen.tuning_spec_with_default_entrypoint` attribute ensures that
the tuning spec includes a named sequence op marked with `__kernel_config`.

The tuning spec above attempts to match `linalg.generic` ops that correspond to the
matmul operation with the RHS operand transposed (a.k.a. mmt) of shape
Expand Down

0 comments on commit b2d4cd2

Please sign in to comment.