[Mlir-commits] [mlir] [mlir][spirv] Add Pooling, Fourier Transform, and MatMul operations t… (PR #177585)
Davide Grohmann
llvmlistbot at llvm.org
Fri Jan 23 06:01:11 PST 2026
================
@@ -299,6 +360,234 @@ def SPIRV_TosaDepthwiseConv2DOp : SPIRV_TosaOp<"DepthwiseConv2D", 4, [Pure,
}
+def SPIRV_TosaFFT2DOp : SPIRV_TosaOp<"FFT2D", 5, [Pure]> {
+ let summary = "Performs FFT2D operation on the input.";
+
+ let description = [{
+ Performs a batched complex 2D Fast Fourier Transform over the input. The
+ complex input values are constructed from the corresponding values in the
+ input_real and input_imag tensors. The resulting values in the output are
+ split into the output_real and output_imag tensors. No normalization is
+ applied on either the forward or inverse versions of the operation.
+
+ References:
+ * https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_fft2d
+ * https://www.mlplatform.org/tosa/tosa_spec_1_0_1.html#_fft2d
+
+ #### Example:
+ ```mlir
+ %0 = spirv.Tosa.FFT2D inverse = true, local_bound = false, %arg0, %arg1 : !spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32> -> !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)>
+ %1 = spirv.CompositeExtract %0[0 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)>
+ %2 = spirv.CompositeExtract %0[1 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)>
+ ```
+ }];
+
+ let arguments = (ins
+ SPIRV_BoolConstAttr: $inverse,
+ SPIRV_BoolConstAttr: $local_bound,
+ SPIRV_Float32_TensorArm3D: $input_real,
+ SPIRV_Float32_TensorArm3D: $input_imag
+ );
+
+ let results = (outs
+ SPIRV_Struct_2_Float32_TensorArm3D: $output
----------------
davidegrohmann wrote:
Yes it is a trade-off between making the mlir slightly more verbse or making the serializer/deserializer process much more complicated. It seemed easier to me to define those this way. Also those are not very commonly used operations anyway.
https://github.com/llvm/llvm-project/pull/177585
More information about the Mlir-commits
mailing list