[Mlir-commits] [mlir] [MLIR][XeGPU] Account for lane_data when narrowing the FCD for array_length (PR #217726)

Artem Kroviakov llvmlistbot at llvm.org
Mon Aug 31 03:19:43 PDT 2026


================
@@ -109,7 +109,19 @@ class OptimizeCreateNdDescOp : public OpRewritePattern<xegpu::CreateNdDescOp> {
       return failure();
     int64_t subgroupSize = getSubgroupSize(op);
     auto tdescType = op.getType();
-    if (!needsOptimization(tdescType, subgroupSize))
+    // Narrowing the FCD has to leave a whole distribution unit there: each lane
+    // of the subgroup takes lane_data elements along the FCD, so the smallest
+    // legal FCD is lane_layout * lane_data rather than the subgroup size alone.
+    // Ignoring lane_data would produce a descriptor its own layout can no
+    // longer distribute.
+    int64_t fcdUnit = subgroupSize;
+    if (auto layout = tdescType.getLayoutAttr()) {
+      SmallVector<int64_t> laneLayout = layout.getEffectiveLaneLayoutAsInt();
+      SmallVector<int64_t> laneData = layout.getEffectiveLaneDataAsInt();
+      if (laneLayout.size() == 2 && laneData.size() == 2)
----------------
akroviakov wrote:

Why this condition instead of taking last elements?

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


More information about the Mlir-commits mailing list