diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td --- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td +++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td @@ -1793,10 +1793,26 @@ that are not expressed in the existing TOSA operations. These operators are 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. + + `config` 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. + + `inputs` is the set of tensor inputs to the custom operator. + + `outputs is the list of tensors returned by the operator. The number of operators + is backend specific. }]; let arguments = (ins StrAttr:$identifier, + StrAttr:$config, + StrAttr:$implementation_attrs, Variadic:$inputs ); diff --git a/mlir/test/Dialect/Tosa/ops.mlir b/mlir/test/Dialect/Tosa/ops.mlir --- a/mlir/test/Dialect/Tosa/ops.mlir +++ b/mlir/test/Dialect/Tosa/ops.mlir @@ -529,3 +529,10 @@ }) : (tensor, tensor, tensor<10xi32>) -> (tensor, tensor, tensor<10xi32>) return } + +// ----- +// 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>) + return %0 : tensor<10xi32> +}