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

Artem Kroviakov llvmlistbot at llvm.org
Fri Feb 27 07:42:42 PST 2026


https://github.com/akroviakov created https://github.com/llvm/llvm-project/pull/183756

A vector that has no layouts is a valid uniform vector, no need to fail. 

>From b805dc4eac08f48c9686cc8a0372003fdbbfb0e1 Mon Sep 17 00:00:00 2001
From: Artem Kroviakov <artem.kroviakov at intel.com>
Date: Fri, 27 Feb 2026 15:40:58 +0000
Subject: [PATCH] [MLIR][XeGPU] Allow uniform vectors in layout conflict
 resolution

---
 .../XeGPU/Transforms/XeGPUPropagateLayout.cpp        |  3 +--
 .../test/Dialect/XeGPU/resolve-layout-conflicts.mlir | 12 ++++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
index 10cd65b080405..99abb3d22f9cd 100644
--- a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
+++ b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
@@ -1311,8 +1311,7 @@ ResolveLayoutConflicts::resolveVectorConsumer(OpOperand &operand) {
   // Get the current layout of the vector value.
   auto producerLayout = xegpu::getDistributeLayoutAttr(vectorValue);
   if (!producerLayout)
-    return consumerOp->emitError("Vector operand has no layout assigned.");
-
+    return success(); // vector with no layout is uniform
   // 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..8a7d85347f920 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<32x32xf16>
+// CHECK-DAG:     %[[V1:.*]] = "some_op"() : () -> vector<32x32xf16>
+// CHECK:         %[[ADD:.*]] = arith.addf %[[V0]], %[[V1]] : vector<32x32xf16>
+// CHECK:         return %[[ADD]] : vector<32x32xf16>
+func.func @elementwise_conflict_uniform() -> vector<32x32xf16> {
+  %0 = "some_op"() : () -> vector<32x32xf16>
+  %1 = "some_op"() : () -> vector<32x32xf16>
+  %2 = arith.addf %0, %1 : vector<32x32xf16>
+  return %2 : vector<32x32xf16>
+}
+
 // 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