[Mlir-commits] [mlir] [MLIR][XeGPU] Fold lane_data repack convert_layout (PR #204016)

Sang Ik Lee llvmlistbot at llvm.org
Wed Jun 17 09:06:17 PDT 2026


================
@@ -1638,6 +1638,45 @@ struct SgToLaneConvertLayout
       }
     }
 
+    // Special case: fold a convert_layout that merely repacks `lane_data`
+    // along the non-distributed outer dimension - from `[N, 1]` to `[1, 1]`
+    // with `order = [1, 0]`, keeping `lane_layout` unchanged - when its result
+    // is consumed by exactly `N` `vector.extract_strided_slice` ops. After lane
+    // distribution both layouts yield the same per-lane vector
+    // (`getDistributedVectorType` ignores `lane_data`), and the `N` slices
+    // recover the original blocking, so the convert is redundant and folds to
+    // its source.
+    if (inputLayout.getRank() == 2 && targetLayout.getRank() == 2) {
----------------
silee2 wrote:

Current usage cases do not require rank > 2. Keeping the check for simplicity. 

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


More information about the Mlir-commits mailing list