[Mlir-commits] [mlir] [mlir][spirv] Add last 6 Element Binary operators to TOSA Ext Inst Set (PR #184121)
Davide Grohmann
llvmlistbot at llvm.org
Tue Mar 3 01:20:57 PST 2026
================
@@ -1204,4 +1210,261 @@ def SPIRV_TosaLogicalXorOp : SPIRV_TosaElementwiseBinaryOp<"LogicalXor", 24, [Pu
}];
}
+
+def SPIRV_TosaMaximumOp : SPIRV_TosaElementwiseBinaryOp<"Maximum", 25, [Pure,
+ TypeConstraintImplicationOn<"input1", AnyInteger, "input1", [I32]>,
+ TypeConstraintImplicationOn<"input2", AnyInteger, "input2", [I32]>,
+ TypeConstraintImplicationOn<"output", AnyInteger, "output", [I32]>]> {
+ let summary = "Maximum.";
+
+ let description = [{
+ Elementwise maximum of input1 and input2. Axis of size 1 will be broadcast,
+ as necessary. Rank of input tensors must match.
+
+ References:
+ * https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_maximum
+ * https://www.mlplatform.org/tosa/tosa_spec_1_0_1.html#_maximum
+
+ #### Example:
+ ```mlir
+ %1 = spirv.Tosa.Maximum nan_mode = <Propagate>, %arg0, %arg1 : !spirv.arm.tensor<1x2x65533x1xi32>, !spirv.arm.tensor<1x2x65533x2xi32> -> !spirv.arm.tensor<1x2x65533x2xi32>
+ %1 = spirv.Tosa.Maximum nan_mode = <Ignore>, %arg0, %arg1 : !spirv.arm.tensor<1x12x14x7xf16>, !spirv.arm.tensor<11x12x14x7xf16> -> !spirv.arm.tensor<11x12x14x7xf16>
+ ```
+ }];
+
+ let arguments = (ins
+ SPIRV_TosaExtNaNPropagationModeAttr: $nan_mode,
----------------
davidegrohmann wrote:
It is ignored for integers values. I add a note in the description.
https://github.com/llvm/llvm-project/pull/184121
More information about the Mlir-commits
mailing list