[Mlir-commits] [mlir] [TOSA] Update TOSA Custom Operator attribute names to align with the spec (PR #71116)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Nov 2 14:31:15 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Jerry-Ge (Jerry-Ge)
<details>
<summary>Changes</summary>
- The latest TOSA spec for CustomOp is having attributes
- operator_name, domain_name, and implementation_attrs
- Updated the dialect to align with the spec change
---
Full diff: https://github.com/llvm/llvm-project/pull/71116.diff
3 Files Affected:
- (modified) mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td (+9-8)
- (modified) mlir/test/Dialect/Tosa/level_check.mlir (+1-1)
- (modified) mlir/test/Dialect/Tosa/ops.mlir (+1-1)
``````````diff
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
index 5cc97469d14c314..e23aa1df53a1faf 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
@@ -1921,11 +1921,11 @@ def Tosa_CustomOp : Tosa_Op<"custom"> {
not expected to be portable across TOSA implementations. The input and
output signatures must be expressed in the corresponding TOSA node.
- `identifier` is a string that tells the backend which custom operator is being
- called.
+ `operator_name` is a string that tells the backend which custom operator is
+ being called.
- `config` is a string identifier which can help avoid name collisions on the
- identifier field.
+ `domain_name` is a string identifier which can help avoid name collisions on
+ the identifier field.
`implementation_attrs` is a string which is a backend and identifier specific
set of attributes to the custom operator.
@@ -1938,14 +1938,15 @@ def Tosa_CustomOp : Tosa_Op<"custom"> {
Example:
```mlir
- %out = tosa.custom %in {config = "tosa_mlir_test", identifier = "custom_test",
- implementation_attrs = ""} : (tensor<10xi32>) -> (tensor<10xi32>)
+ %out = tosa.custom %in {domain_name = "tosa_mlir_test", operator_name =
+ "custom_test", implementation_attrs = ""}: (tensor<10xi32>) ->
+ (tensor<10xi32>)
```
}];
let arguments = (ins
- StrAttr:$identifier,
- StrAttr:$config,
+ StrAttr:$operator_name,
+ StrAttr:$domain_name,
StrAttr:$implementation_attrs,
Variadic<Tosa_Tensor>:$inputs
);
diff --git a/mlir/test/Dialect/Tosa/level_check.mlir b/mlir/test/Dialect/Tosa/level_check.mlir
index 68238087f5c2523..fa015ad30b03855 100644
--- a/mlir/test/Dialect/Tosa/level_check.mlir
+++ b/mlir/test/Dialect/Tosa/level_check.mlir
@@ -690,7 +690,7 @@ func.func @test_while_loop(%arg0: tensor<1x1x1x1x1x1x1xf32>, %arg1: tensor<i32>)
// CHECK-LABEL: @test_custom
func.func @test_custom(%arg0: tensor<1x1x1x1x1x1x10xi32>) -> tensor<1x1x1x1x1x1x10xi32> {
- %0 = "tosa.custom"(%arg0) {identifier="custom_test", config="tosa_mlir_test", implementation_attrs=""} :
+ %0 = "tosa.custom"(%arg0) {operator_name="custom_test", domain_name="tosa_mlir_test", implementation_attrs=""} :
(tensor<1x1x1x1x1x1x10xi32>) -> (tensor<1x1x1x1x1x1x10xi32>)
return %0 : tensor<1x1x1x1x1x1x10xi32>
}
diff --git a/mlir/test/Dialect/Tosa/ops.mlir b/mlir/test/Dialect/Tosa/ops.mlir
index a3e2b66e0305281..0828d5a367483cd 100644
--- a/mlir/test/Dialect/Tosa/ops.mlir
+++ b/mlir/test/Dialect/Tosa/ops.mlir
@@ -616,6 +616,6 @@ func.func @test_while_loop(%arg0: tensor<10xi32>, %arg1: tensor<i32>) {
// -----
// CHECK-LABEL: custom
func.func @test_custom(%arg0: tensor<10xi32>) -> tensor<10xi32> {
- %0 = tosa.custom %arg0 {identifier="custom_test", config="tosa.mlir_test", implementation_attrs="" } : (tensor<10xi32>) -> (tensor<10xi32>)
+ %0 = tosa.custom %arg0 {operator_name="custom_test", domain_name="tosa.mlir_test", implementation_attrs="" } : (tensor<10xi32>) -> (tensor<10xi32>)
return %0 : tensor<10xi32>
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/71116
More information about the Mlir-commits
mailing list