[Mlir-commits] [mlir] [mlir][xegpu] Add xegpu.lane_shuffle op (PR #210777)

Artem Kroviakov llvmlistbot at llvm.org
Fri Jul 31 03:13:43 PDT 2026


================
@@ -1500,6 +1500,78 @@ def XeGPU_TruncfOp
   let hasVerifier = 1;
 }
 
+def XeGPU_LaneShuffleOp
+    : XeGPU_Op<"lane_shuffle", [Pure, AllTypesMatch<["source", "result"]>]> {
+  let summary = "Re-distributes a subgroup's fragments across its lanes.";
+
+  let description = [{
+    `xegpu.lane_shuffle` is a lane-level operation. The `source` operand is the
+    fragment (a 1D vector) held by one lane, and the `result` is the fragment
+    that lane holds afterwards. It re-distributes the elements across the lanes
+    of the subgroup without changing their type, so `source` and `result` have
+    the same type.
+
+    Let `S` be the subgroup size and `N` the number of elements per lane, so the
+    subgroup collectively holds `S * N` elements. Number these elements by their
+    logical position `0 .. S*N-1`. The `mode` selects which of the two
+    orientations of the `S x N` (lane, element) index grid the operation maps
+    between:
+
+    * `pack`: element `j` of lane `i` holds logical position `j * S + i` before
----------------
akroviakov wrote:

```suggestion
    * `pack`: element `i` of lane `j` holds logical position `j * S + i` before
```

> element `j` of lane `i`

The order appears switched. If `S` in `S x N` is the subgroup size (i.e., number of lanes), then the element index within the lane should be the ` + i` part. 


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


More information about the Mlir-commits mailing list