[Mlir-commits] [mlir] [mlir][spirv] Add Gather/Scatter/Resize ops in TOSA Ext Inst Set (PR #188497)

Davide Grohmann llvmlistbot at llvm.org
Fri Mar 27 02:06:02 PDT 2026


================
@@ -2462,4 +2462,187 @@ def SPIRV_TosaTransposeOp : SPIRV_TosaOpWithResult<"Transpose", 60, [Pure,
 }
 
 
+def SPIRV_TosaGatherOp : SPIRV_TosaOpWithResult<"Gather", 61, [NoMemoryEffect,
+  AllElementTypesMatch<["values", "output"]>]> {
+  let summary = "Gather operation.";
+
+  let description = [{
+    Generate a tensor for which each element in the output is a subtensor of the
+    values tensor based on the indices. Undefined behaviour may occur if the
+    specified indices are out of range.
+
+    References:
+      * https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_gather
+      * https://www.mlplatform.org/tosa/tosa_spec_1_0_1.html#_gather
+
+    #### Example:
+    ```mlir
+    %0 = spirv.Tosa.Gather %values, %indices : !spirv.arm.tensor<31x11x45xi32>, !spirv.arm.tensor<31x15xi32> -> !spirv.arm.tensor<31x15x45xi32>
----------------
davidegrohmann wrote:

Yes you are right those are connected and we can add constraints to check that. Patch updated.

https://github.com/llvm/llvm-project/pull/188497


More information about the Mlir-commits mailing list