[Mlir-commits] [mlir] [MLIR][XeGPU] Sg to Lane distribute convert_layout redistributing broadcasted data (PR #215645)

Jianhui Li llvmlistbot at llvm.org
Sun Aug 30 22:02:44 PDT 2026


================
@@ -1862,6 +2097,28 @@ struct SgToLaneConvertLayout
       }
     }
 
+    // Handle the case where the input layout broadcasts the value over groups
+    // of lanes and the target layout distributes it, which requires moving
+    // data across lanes.
+    const auto *uArch =
+        xegpu::uArch::getUArch(xegpu::getChipStr(op).value_or(""));
+    FailureOr<VectorType> resDistTy = xegpu::getDistVecTypeBasedOnLaneLayout(
+        targetLayout, cast<VectorType>(valType));
+    if (uArch && succeeded(resDistTy)) {
+      int64_t numLanes = uArch->getSubgroupSize();
+      // The input has to be distributed over the whole subgroup, while the
+      // target may leave the remaining lanes with a replicated value.
+      if (getLaneLayoutSize(inputLayout) == numLanes) {
----------------
Jianhui-Li wrote:

I think we should generalize the condition a bit. I think here it is handling the case where the input and target has same effective lane_data, but different lane_layout. Both must have same number of participant lanes.
 

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


More information about the Mlir-commits mailing list