Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -2057,11 +2057,11 @@ def Tosa_CustomOp : Tosa_Op<"custom"> {
StrAttr:$operator_name,
StrAttr:$domain_name,
StrAttr:$implementation_attrs,
Variadic<Tosa_Tensor>:$input_list
Variadic<Tosa_TensorOrNone>:$input_list
);

let results = (outs
Variadic<Tosa_Tensor>:$output_list
Variadic<Tosa_TensorOrNone>:$output_list
);

let assemblyFormat = "operands attr-dict `:` functional-type(operands, results)";
Expand Down
2 changes: 2 additions & 0 deletions mlir/include/mlir/Dialect/Tosa/IR/TosaTypesBase.td
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ def Tosa_ElementType : Type<Or<[Tosa_Int.predicate, Tosa_QuantizedInt.predicate,
class Tosa_TensorOfOrNone<list<Type> allowedTypes, string description = ""> :
AnyTypeOf<[TosaTensorOf<allowedTypes>, NoneType], description>;

def Tosa_TensorOrNone : Tosa_TensorOfOrNone<[Tosa_AnyNumber]>;

//===----------------------------------------------------------------------===//
// Tensor types with constrained ranks.
//===----------------------------------------------------------------------===//
Expand Down
7 changes: 7 additions & 0 deletions mlir/test/Dialect/Tosa/ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,13 @@ func.func @test_custom(%arg0: tensor<10xi32>) -> tensor<10xi32> {
return %0 : tensor<10xi32>
}

// -----
// CHECK-LABEL: test_custom_none
func.func @test_custom_none(%arg0: tensor<10xi32>, %arg1: none) -> tensor<10xi32> {
%0 = tosa.custom %arg0, %arg1 {operator_name="custom_test", domain_name="tosa.mlir_test", implementation_attrs="" } : (tensor<10xi32>, none) -> (tensor<10xi32>)
return %0 : tensor<10xi32>
}
Comment on lines +698 to +702

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: I think it could be nice to have the other test where the output of tosa.custom is None


// -----
// CHECK-LABEL: const_shape
func.func @test_const_shape() -> !tosa.shape<4> {
Expand Down