[Mlir-commits] [mlir] 91e73b9 - [MLIR][XeGPU] Allow uniform vectors in layout conflict resolution (#183756)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Mar 3 02:14:04 PST 2026


Author: Artem Kroviakov
Date: 2026-03-03T10:13:59Z
New Revision: 91e73b93e881c585b353afc43b8353dc6fda1fe6

URL: https://github.com/llvm/llvm-project/commit/91e73b93e881c585b353afc43b8353dc6fda1fe6
DIFF: https://github.com/llvm/llvm-project/commit/91e73b93e881c585b353afc43b8353dc6fda1fe6.diff

LOG: [MLIR][XeGPU] Allow uniform vectors in layout conflict resolution (#183756)

Added: 
    

Modified: 
    mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
    mlir/test/Dialect/XeGPU/resolve-layout-conflicts.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
index 10cd65b080405..87835fb191604 100644
--- a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
+++ b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
@@ -1310,9 +1310,12 @@ ResolveLayoutConflicts::resolveVectorConsumer(OpOperand &operand) {
   Operation *consumerOp = operand.getOwner();
   // Get the current layout of the vector value.
   auto producerLayout = xegpu::getDistributeLayoutAttr(vectorValue);
-  if (!producerLayout)
-    return consumerOp->emitError("Vector operand has no layout assigned.");
-
+  if (!producerLayout) {
+    if (auto vectorTy = dyn_cast<VectorType>(vectorValue.getType());
+        vectorTy && vectorTy.getRank() > 1)
+      consumerOp->emitWarning("Expected layout for non-1D vectors.");
+    return success(); // uniform non-tensor-data vector does not require layout
+  }
   // Get the consumer expected layout at this operand.
   auto consumerLayout = xegpu::getConsumerLayoutAt(operand);
   if (!consumerLayout)

diff  --git a/mlir/test/Dialect/XeGPU/resolve-layout-conflicts.mlir b/mlir/test/Dialect/XeGPU/resolve-layout-conflicts.mlir
index 7f9796ae2aecf..c73a9990542de 100644
--- a/mlir/test/Dialect/XeGPU/resolve-layout-conflicts.mlir
+++ b/mlir/test/Dialect/XeGPU/resolve-layout-conflicts.mlir
@@ -100,6 +100,18 @@ func.func @elementwise_conflict() -> vector<32x32xf16> {
   return %2 : vector<32x32xf16>
 }
 
+// CHECK-LABEL: func.func @elementwise_conflict_uniform
+// CHECK-DAG:     %[[V0:.*]] = "some_op"() : () -> vector<2xf16>
+// CHECK-DAG:     %[[V1:.*]] = "some_op"() : () -> vector<2xf16>
+// CHECK:         %[[ADD:.*]] = arith.addf %[[V0]], %[[V1]] : vector<2xf16>
+// CHECK:         return %[[ADD]] : vector<2xf16>
+func.func @elementwise_conflict_uniform() -> vector<2xf16> {
+  %0 = "some_op"() : () -> vector<2xf16>
+  %1 = "some_op"() : () -> vector<2xf16>
+  %non_tensor_data_vec = arith.addf %0, %1 : vector<2xf16>
+  return %non_tensor_data_vec : vector<2xf16>
+}
+
 // CHECK-LABEL: func.func @broadcast_source_conflict
 // CHECK:         %[[V0:.*]] = "some_op"() {layout_result_0 = #xegpu.layout<inst_data = [16]>} : () -> vector<16xf16>
 // CHECK:         %[[CVT:.*]] = xegpu.convert_layout %[[V0]]


        


More information about the Mlir-commits mailing list