Skip to content

Commit 1bdb166

Browse files
authored
[TOSA] Update TOSA Custom Operator attribute names to align with the spec (#71116)
- 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 Signed-off-by: Jerry Ge <[email protected]>
1 parent 406b887 commit 1bdb166

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,11 +1931,11 @@ def Tosa_CustomOp : Tosa_Op<"custom"> {
19311931
not expected to be portable across TOSA implementations. The input and
19321932
output signatures must be expressed in the corresponding TOSA node.
19331933

1934-
`identifier` is a string that tells the backend which custom operator is being
1935-
called.
1934+
`operator_name` is a string that tells the backend which custom operator is
1935+
being called.
19361936

1937-
`config` is a string identifier which can help avoid name collisions on the
1938-
identifier field.
1937+
`domain_name` is a string identifier which can help avoid name collisions on
1938+
the identifier field.
19391939

19401940
`implementation_attrs` is a string which is a backend and identifier specific
19411941
set of attributes to the custom operator.
@@ -1948,14 +1948,15 @@ def Tosa_CustomOp : Tosa_Op<"custom"> {
19481948
Example:
19491949

19501950
```mlir
1951-
%out = tosa.custom %in {config = "tosa_mlir_test", identifier = "custom_test",
1952-
implementation_attrs = ""} : (tensor<10xi32>) -> (tensor<10xi32>)
1951+
%out = tosa.custom %in {domain_name = "tosa_mlir_test", operator_name =
1952+
"custom_test", implementation_attrs = ""}: (tensor<10xi32>) ->
1953+
(tensor<10xi32>)
19531954
```
19541955
}];
19551956

19561957
let arguments = (ins
1957-
StrAttr:$identifier,
1958-
StrAttr:$config,
1958+
StrAttr:$operator_name,
1959+
StrAttr:$domain_name,
19591960
StrAttr:$implementation_attrs,
19601961
Variadic<Tosa_Tensor>:$inputs
19611962
);

mlir/test/Dialect/Tosa/level_check.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ func.func @test_while_loop(%arg0: tensor<1x1x1x1x1x1x1xf32>, %arg1: tensor<i32>)
690690

691691
// CHECK-LABEL: @test_custom
692692
func.func @test_custom(%arg0: tensor<1x1x1x1x1x1x10xi32>) -> tensor<1x1x1x1x1x1x10xi32> {
693-
%0 = "tosa.custom"(%arg0) {identifier="custom_test", config="tosa_mlir_test", implementation_attrs=""} :
693+
%0 = "tosa.custom"(%arg0) {operator_name="custom_test", domain_name="tosa_mlir_test", implementation_attrs=""} :
694694
(tensor<1x1x1x1x1x1x10xi32>) -> (tensor<1x1x1x1x1x1x10xi32>)
695695
return %0 : tensor<1x1x1x1x1x1x10xi32>
696696
}

mlir/test/Dialect/Tosa/ops.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,6 @@ func.func @test_while_loop(%arg0: tensor<10xi32>, %arg1: tensor<i32>) {
616616
// -----
617617
// CHECK-LABEL: custom
618618
func.func @test_custom(%arg0: tensor<10xi32>) -> tensor<10xi32> {
619-
%0 = tosa.custom %arg0 {identifier="custom_test", config="tosa.mlir_test", implementation_attrs="" } : (tensor<10xi32>) -> (tensor<10xi32>)
619+
%0 = tosa.custom %arg0 {operator_name="custom_test", domain_name="tosa.mlir_test", implementation_attrs="" } : (tensor<10xi32>) -> (tensor<10xi32>)
620620
return %0 : tensor<10xi32>
621621
}

0 commit comments

Comments
 (0)