[Mlir-commits] [mlir] [mlir][spirv] Add Gather/Scatter/Resize ops in TOSA Ext Inst Set (PR #188497)
Igor Wodiany
llvmlistbot at llvm.org
Thu Mar 26 07:23:26 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>
----------------
IgWod wrote:
Just looking at the example it looks to me that the first two dims of `output` match ones of `indices` and final dim matches one of `values`. Is that something that is always the case and should be verified?
https://github.com/llvm/llvm-project/pull/188497
More information about the Mlir-commits
mailing list