[Mlir-commits] [mlir] [MLIR][XeGPU] Rematerialize layout conversion sources after conflict resolution (PR #230669)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 9 14:02:36 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-gpu

@llvm/pr-subscribers-mlir

Author: Nishant Patel (nbpatel)

<details>
<summary>Changes</summary>

Layout conflict resolution inserts xegpu.convert_layout whenever there is a conflict. A separate step then replaces conversions of cheap producer chains (e.g. vector.step → arith.index_castui) by cloning the whole chain in the target layout, which fixes operand/result layout mismatches when an elementwise producer was cloned.

---

Patch is 34.02 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/230669.diff


6 Files Affected:

- (modified) mlir/include/mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h (+13-7) 
- (modified) mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp (+78-13) 
- (modified) mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp (+40-34) 
- (added) mlir/test/Dialect/XeGPU/rematerialize-conversion-sources.mlir (+205) 
- (modified) mlir/test/Dialect/XeGPU/resolve-layout-conflicts.mlir (+15-41) 
- (modified) mlir/test/lib/Dialect/XeGPU/TestXeGPUTransforms.cpp (+32) 


``````````diff
diff --git a/mlir/include/mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h b/mlir/include/mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h
index 8921380093e108..03cf2f17eda8de 100644
--- a/mlir/include/mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h
+++ b/mlir/include/mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h
@@ -18,7 +18,6 @@
 #include "llvm/ADT/STLFunctionalExtras.h"
 
 namespace mlir {
-
 class VectorType;
 class OpOperand;
 class OpResult;
@@ -34,13 +33,15 @@ class TensorDescType;
 } // namespace xegpu
 
 namespace xegpu {
-
 LogicalResult propagateLayouts(OpBuilder &builder, Operation *target,
                                LayoutKind layoutKind, unsigned indexBitWidth,
                                bool printOnly = false);
 
 LogicalResult resolveLayoutConflicts(Operation *target);
 
+/// Replace layout conversions by recomputing eligible producer chains.
+void rematerializeConversionSources(OpBuilder &builder, Operation *target);
+
 /// Sink `xegpu.convert_layout` ops past the elementwise operations they feed,
 /// so that an elementwise op runs in the coarser layout.
 void sinkElementwiseConversions(OpBuilder &builder, Operation *target);
@@ -465,14 +466,19 @@ completeDpasMxLaneLayoutFromInstData(DistributeLayoutAttr aLayout,
 /// users and determine the expected layout accordingly.
 DistributeLayoutAttr getConsumerLayoutAt(OpOperand &operand);
 
-/// Returns true if `op` is safe and cheap to clone: it has no side effects,
-/// no regions, and all of its operands are themselves trivially
-/// rematerializable (e.g. `vector.step`, splat `arith.constant`, or
-/// `vector.create_mask` whose operands are constants).
+/// Returns true if the vector produced by `op` can be recomputed in any layout
+/// by cloning a bounded chain of pure vector generators (`vector.step`, splat
+/// `arith.constant`, `vector.create_mask`, scalar `vector.broadcast`) and
+/// layout-preserving elementwise ops.
 bool isTriviallyRematerializable(Operation *op);
 
+/// Clone a bounded chain of pure vector generators and layout-preserving
+/// elementwise ops in `layout`. Each producer is cloned once, immediately after
+/// its original; scalar operands remain shared. Return null if the chain is
+/// ineligible, without modifying the IR.
+Value rematerializeWithLayout(OpBuilder &builder, Value value,
+                              DistributeLayoutAttr layout);
 } // namespace xegpu
-
 } // namespace mlir
 
 #endif // MLIR_DIALECT_XEGPU_UTILS_XEGPUUTILS_H_
diff --git a/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp b/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp
index 031d971cebe6cf..0a749efbba1f53 100644
--- a/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp
+++ b/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h"
+#include "mlir/Dialect/Arith/IR/Arith.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 #include "mlir/Dialect/LLVMIR/XeVMDialect.h"
@@ -21,12 +22,14 @@
 #include "mlir/Dialect/Vector/IR/VectorOps.h"
 #include "mlir/Dialect/XeGPU/IR/XeGPU.h"
 #include "mlir/IR/Builders.h"
+#include "mlir/IR/IRMapping.h"
 #include "mlir/IR/Operation.h"
 #include "mlir/IR/ValueRange.h"
 #include "mlir/Interfaces/ControlFlowInterfaces.h"
 #include "mlir/Interfaces/LoopLikeInterface.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
 #include "mlir/Transforms/DialectConversion.h"
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/PostOrderIterator.h"
 #include "llvm/Support/FormatVariadic.h"
 #include <cstdint>
@@ -132,25 +135,87 @@ static xegpu::DistributeLayoutAttr getLayoutFromUsePoints(Value result) {
   return layout;
 }
 
-// Returns true if `op` is safe and cheap to clone (no side effects, no
-// regions, and all operands are themselves trivially rematerializable, e.g.
-// block-arg-free pure value generators such as `vector.step`, splat
-// `arith.constant`, or `vector.create_mask` whose operands are constants).
-bool xegpu::isTriviallyRematerializable(Operation *op) {
-  if (!op || op->getNumRegions() != 0)
-    return false;
-  if (!isMemoryEffectFree(op))
+static constexpr unsigned kMaxRematerializableChainOps = 16;
+
+/// Accept pure vector generators and elementwise ops that preserve vector
+/// shape. Generators have no vector operands; elementwise ops share their
+/// result layout with their vector operands, so the chain needs no layout
+/// inference.
+static bool isLayoutPreservingVectorProducer(Operation *op) {
+  if (op->getNumResults() != 1 || op->getNumRegions() != 0 ||
+      !isa<VectorType>(op->getResult(0).getType()) || !isMemoryEffectFree(op))
     return false;
-  for (Value v : op->getOperands()) {
-    Operation *defOp = v.getDefiningOp();
-    if (!defOp)
-      return false;
-    if (!isTriviallyRematerializable(defOp))
+  if (auto constant = dyn_cast<arith::ConstantOp>(op)) {
+    auto value = dyn_cast<DenseElementsAttr>(constant.getValue());
+    return value && value.isSplat();
+  }
+  if (isa<vector::StepOp, vector::CreateMaskOp>(op))
+    return true;
+  if (auto broadcast = dyn_cast<vector::BroadcastOp>(op))
+    return !isa<VectorType>(broadcast.getSource().getType());
+  return OpTrait::hasElementwiseMappableTraits(op);
+}
+
+/// Collect each eligible producer once, producers first, for cloning with an
+/// IRMapping. Reject chains exceeding the duplication limit or reaching an
+/// unsupported producer or vector block argument.
+static bool collectRematerializableChain(Operation *root,
+                                         SmallVectorImpl<Operation *> &chain) {
+  // Re-push each op below its producers to obtain an iterative post-order walk.
+  SmallVector<std::pair<Operation *, bool>> worklist{{root, false}};
+  DenseSet<Operation *> visited;
+  while (!worklist.empty()) {
+    auto [op, expanded] = worklist.pop_back_val();
+    if (expanded) {
+      chain.push_back(op);
+      continue;
+    }
+    if (!visited.insert(op).second)
+      continue;
+    if (visited.size() > kMaxRematerializableChainOps ||
+        !isLayoutPreservingVectorProducer(op))
       return false;
+    worklist.emplace_back(op, true);
+    for (Value operand : op->getOperands()) {
+      if (!isa<VectorType>(operand.getType()))
+        continue;
+      Operation *producer = operand.getDefiningOp();
+      if (!producer)
+        return false;
+      if (!visited.contains(producer))
+        worklist.emplace_back(producer, false);
+    }
   }
   return true;
 }
 
+bool xegpu::isTriviallyRematerializable(Operation *op) {
+  if (!op)
+    return false;
+  SmallVector<Operation *> chain;
+  return collectRematerializableChain(op, chain);
+}
+
+Value xegpu::rematerializeWithLayout(OpBuilder &builder, Value value,
+                                     DistributeLayoutAttr layout) {
+  Operation *producer = value.getDefiningOp();
+  SmallVector<Operation *> chain;
+  if (!producer || !collectRematerializableChain(producer, chain))
+    return nullptr;
+  // Clone producers first so vector operands map to clones; scalars stay
+  // shared.
+  OpBuilder::InsertionGuard guard(builder);
+  IRMapping mapping;
+  for (Operation *op : chain) {
+    builder.setInsertionPointAfter(op);
+    Operation *clone = builder.clone(*op, mapping);
+    OpResult cloneResult = clone->getResult(0);
+    removeLayoutAttr(cloneResult);
+    setDistributeLayoutAttr(cloneResult, layout);
+  }
+  return mapping.lookup(value);
+}
+
 // For regular operations: First the result layouts are propagated from uses.
 // Then the result layouts are propagated to uses (operands).
 static void propagateResultsToRegularOperands(Operation *op) {
diff --git a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
index 3629e122b1bf92..83adc7febef3b9 100644
--- a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
+++ b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
@@ -59,7 +59,6 @@ using namespace mlir;
 using namespace mlir::dataflow;
 
 namespace {
-
 //===----------------------------------------------------------------------===//
 // LayoutInfo
 //===----------------------------------------------------------------------===//
@@ -1544,7 +1543,6 @@ void RunLayoutInfoPropagation::printAnalysisResult(llvm::raw_ostream &os) {
 }
 
 namespace {
-
 //===----------------------------------------------------------------------===//
 // ResolveLayoutConflicts
 //===----------------------------------------------------------------------===//
@@ -1583,7 +1581,6 @@ struct ResolveLayoutConflicts {
   LogicalResult resolveVectorConsumer(OpOperand &operand);
   LogicalResult assignResultLayout(OpResult &result);
 };
-
 } // namespace
 
 LogicalResult ResolveLayoutConflicts::run() {
@@ -1713,26 +1710,6 @@ ResolveLayoutConflicts::resolveVectorConsumer(OpOperand &operand) {
     return success();
   }
 
-  // If the producer is trivially rematerializable (e.g. `vector.step`, splat
-  // `arith.constant`), clone it and stamp the consumer's expected layout on
-  // the clone instead of inserting a `xegpu.convert_layout`. The convert
-  // would otherwise lower to a cross-subgroup data movement through SLM at
-  // WG-to-SG distribution time, which is more expensive than
-  // recomputing a pure value generator.
-  if (auto *producerOp = vectorValue.getDefiningOp();
-      producerOp && producerOp->getNumResults() == 1 &&
-      isa<OpResult>(vectorValue) &&
-      xegpu::isTriviallyRematerializable(producerOp)) {
-    builder.setInsertionPointAfter(producerOp);
-    Operation *clone = builder.clone(*producerOp);
-    OpResult cloneResult = clone->getResult(0);
-    // Drop the inherited producer layout so the new layout takes effect
-    xegpu::removeLayoutAttr(cloneResult);
-    xegpu::setDistributeLayoutAttr(cloneResult, consumerLayout);
-    operand.set(cloneResult);
-    return success();
-  }
-
   // Insert a convert_layout op to resolve the conflict.
   builder.setInsertionPointAfterValue(vectorValue);
   auto convertOp = xegpu::ConvertLayoutOp::create(
@@ -1835,6 +1812,41 @@ static LogicalResult updateOpWithForwardFill(mlir::OpBuilder &builder,
   return success();
 }
 
+/// Recompute eligible producer chains in the conversion's target layout.
+///
+///   %step = vector.step                       {L1}
+///   %cast = arith.index_castui %step           {L1}
+///   %cvt  = xegpu.convert_layout %cast : L1 -> L2
+///   use(%cast)                                {L1}
+///   use(%cvt)                                 {L2}
+///
+/// becomes
+///
+///   %step  = vector.step                      {L1}
+///   %step' = vector.step                      {L2}
+///   %cast  = arith.index_castui %step          {L1}
+///   %cast' = arith.index_castui %step'         {L2}
+///   use(%cast)                                {L1}
+///   use(%cast')                               {L2}
+///
+/// Clone the whole vector producer chain so the original and rematerialized
+/// values can carry independent layouts. For small, layout-preserving chains,
+/// recomputation can avoid cross-subgroup data movement through SLM.
+void xegpu::rematerializeConversionSources(OpBuilder &builder,
+                                           Operation *parentOp) {
+  SmallVector<xegpu::ConvertLayoutOp> conversions;
+  parentOp->walk(
+      [&](xegpu::ConvertLayoutOp convert) { conversions.push_back(convert); });
+  for (xegpu::ConvertLayoutOp convert : conversions) {
+    Value clone = xegpu::rematerializeWithLayout(builder, convert.getSource(),
+                                                 convert.getTargetLayout());
+    if (!clone)
+      continue;
+    convert.getResult().replaceAllUsesWith(clone);
+    convert.erase();
+  }
+}
+
 /// Optimize elementwise operations by sinking costly layout conversion.
 ///
 ///   %m  = vector.create_mask ...                        {L1}
@@ -1919,17 +1931,11 @@ void xegpu::sinkElementwiseConversions(OpBuilder &builder,
         continue;
       if (rewiredOpIdxs.contains(operand.getOperandNumber()))
         continue;
-      Operation *definingOp = operandValue.getDefiningOp();
-      assert(definingOp && xegpu::isTriviallyRematerializable(definingOp) &&
-             "operand should have been rejected above");
       // Rematerialize with uniform source layout.
-      builder.setInsertionPointAfter(definingOp);
-      Operation *clone = builder.clone(*definingOp);
-      OpResult cloneResult =
-          clone->getResult(cast<OpResult>(operandValue).getResultNumber());
-      xegpu::removeLayoutAttr(cloneResult);
-      xegpu::setDistributeLayoutAttr(cloneResult, uniformConvSrcLayout);
-      operand.set(cloneResult);
+      Value clone = xegpu::rematerializeWithLayout(builder, operandValue,
+                                                   uniformConvSrcLayout);
+      assert(clone && "operand should have been rejected above");
+      operand.set(clone);
     }
 
     // Run the op in the source layout and bridge its result back, so that
@@ -1999,7 +2005,6 @@ struct XeGPUPropagateLayoutPass final
       : XeGPUPropagateLayoutBase(std::move(options)) {}
   void runOnOperation() override;
 };
-
 } // namespace
 
 LogicalResult xegpu::propagateLayouts(OpBuilder &builder, Operation *target,
@@ -2108,6 +2113,7 @@ void XeGPUPropagateLayoutPass::runOnOperation() {
     signalPassFailure();
     return;
   }
+  xegpu::rematerializeConversionSources(builder, getOperation());
   if (layoutKind == xegpu::LayoutKind::InstData)
     xegpu::sinkElementwiseConversions(builder, getOperation());
 }
diff --git a/mlir/test/Dialect/XeGPU/rematerialize-conversion-sources.mlir b/mlir/test/Dialect/XeGPU/rematerialize-conversion-sources.mlir
new file mode 100644
index 00000000000000..f90137b7fbb045
--- /dev/null
+++ b/mlir/test/Dialect/XeGPU/rematerialize-conversion-sources.mlir
@@ -0,0 +1,205 @@
+// RUN: mlir-opt --test-xegpu-rematerialize-conversion-sources -allow-unregistered-dialect -split-input-file %s | FileCheck %s
+
+// Row and column slices require different subgroup distributions.
+#row = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32]>, dims = [0]>
+#col = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>
+
+// Rematerialization preserves the original value for its other consumer.
+// CHECK-LABEL: gpu.func @step_conversion
+// CHECK:         %[[STEP0:.*]] = vector.step {layout_result_0 = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32]>, dims = [0]>} : vector<32xindex>
+// CHECK-NEXT:    %[[STEP1:.*]] = vector.step {layout_result_0 = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>} : vector<32xindex>
+// CHECK:         arith.muli %[[STEP1]], %{{.*}} {layout_result_0 = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>} : vector<32xindex>
+// CHECK:         vector.broadcast %[[STEP0]]
+// CHECK-NOT:     xegpu.convert_layout
+gpu.module @test {
+gpu.func @step_conversion() kernel {
+  %cst32 = arith.constant {layout_result_0 = #col} dense<32> : vector<32xindex>
+  %step = vector.step {layout_result_0 = #row} : vector<32xindex>
+  %cvt = xegpu.convert_layout %step <{input_layout = #row, target_layout = #col}> : vector<32xindex>
+  %col = arith.muli %cvt, %cst32 {layout_result_0 = #col} : vector<32xindex>
+  %rowb = vector.broadcast %step {layout_result_0 = #xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32]>} : vector<32xindex> to vector<32x32xindex>
+  "some_use"(%col, %rowb) : (vector<32xindex>, vector<32x32xindex>) -> ()
+  gpu.return
+}
+}
+
+// -----
+
+#row = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32]>, dims = [0]>
+#col = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>
+
+// The cloned elementwise chain shares no vector operands with the original.
+// CHECK-LABEL: gpu.func @elementwise_chain_conversion
+// CHECK-DAG:     %[[CST1:.*]] = arith.constant {layout_result_0 = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>} dense<32> : vector<32xindex>
+// CHECK-DAG:     %[[STEP1:.*]] = vector.step {layout_result_0 = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>} : vector<32xindex>
+// CHECK:         %[[MUL1:.*]] = arith.muli %[[STEP1]], %[[CST1]] {layout_result_0 = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>} : vector<32xindex>
+// CHECK:         vector.shape_cast %[[MUL1]]
+// CHECK-NOT:     xegpu.convert_layout
+gpu.module @test {
+gpu.func @elementwise_chain_conversion() kernel {
+  %cst32 = arith.constant {layout_result_0 = #row} dense<32> : vector<32xindex>
+  %step = vector.step {layout_result_0 = #row} : vector<32xindex>
+  %scaled = arith.muli %step, %cst32 {layout_result_0 = #row} : vector<32xindex>
+  %cvt = xegpu.convert_layout %scaled <{input_layout = #row, target_layout = #col}> : vector<32xindex>
+  %col2d = vector.shape_cast %cvt {layout_result_0 = #xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>} : vector<32xindex> to vector<32x1xindex>
+  %rowb = vector.broadcast %scaled {layout_result_0 = #xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32]>} : vector<32xindex> to vector<32x32xindex>
+  "some_use"(%col2d, %rowb) : (vector<32x1xindex>, vector<32x32xindex>) -> ()
+  gpu.return
+}
+}
+
+// -----
+
+#row = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32]>, dims = [0]>
+#col = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>
+
+// The cloned cast and its step operand must have matching layouts.
+// CHECK-LABEL: gpu.func @cast_chain_conversion
+// CHECK:         %[[STEP0:.*]] = vector.step {layout_result_0 = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32]>, dims = [0]>} : vector<32xindex>
+// CHECK-NEXT:    %[[STEP1:.*]] = vector.step {layout_result_0 = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>} : vector<32xindex>
+// CHECK-NEXT:    arith.index_castui %[[STEP0]] {layout_result_0 = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32]>, dims = [0]>} : vector<32xindex> to vector<32xi32>
+// CHECK-NEXT:    arith.index_castui %[[STEP1]] {layout_result_0 = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>} : vector<32xindex> to vector<32xi32>
+// CHECK-NOT:     xegpu.convert_layout
+gpu.module @test {
+gpu.func @cast_chain_conversion() kernel {
+  %step = vector.step {layout_result_0 = #row} : vector<32xindex>
+  %cast = arith.index_castui %step {layout_result_0 = #row} : vector<32xindex> to vector<32xi32>
+  %cvt = xegpu.convert_layout %cast <{input_layout = #row, target_layout = #col}> : vector<32xi32>
+  %col2d = vector.shape_cast %cvt {layout_result_0 = #xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>} : vector<32xi32> to vector<32x1xi32>
+  %row2d = vector.shape_cast %cast {layout_result_0 = #xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32]>} : vector<32xi32> to vector<1x32xi32>
+  "some_use"(%col2d, %row2d) : (vector<32x1xi32>, vector<1x32xi32>) -> ()
+  gpu.return
+}
+}
+
+// -----
+
+#row = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32]>, dims = [0]>
+#col = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>
+
+// Shared producers are cloned only once.
+// CHECK-LABEL: gpu.func @shared_operand_cloned_once
+// CHECK-COUNT-2: vector.step
+// CHECK-NOT:     vector.step
+// CHECK-NOT:     xegpu.convert_layout
+// CHECK:         gpu.return
+gpu.module @test {
+gpu.func @shared_operand_cloned_once() kernel {
+  %step = vector.step {layout_result_0 = #row} : vector<32xindex>
+  %sq = arith.muli %step, %step {layout_result_0 = #row} : vector<32xindex>
+  %cvt = xegpu.convert_layout %sq <{input_layout = #row, target_layout = #col}> : vector<32xindex>
+  "some_use"(%cvt) : (vector<32xindex>) -> ()
+  gpu.return
+}
+}
+
+// -----
+
+#row = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32]>, dims = [0]>
+#col = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 1]>, dims = [1]>
+
+// Scalar block arguments remain shared because they carry no layout.
+// CHECK-LABEL: gpu.func @scalar_operand_shared
+// CHECK-SAME:    (%[[N:.*]]: index)
+// CHECK:         vector.create_mask %[[N]] {layout_result_0 = #xegpu.slice<#xegpu.layout<sg_layout = [32, 1], sg_data = [1, 32...
[truncated]

``````````

</details>


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


More information about the Mlir-commits mailing list