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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Feb 27 07:43:14 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Artem Kroviakov (akroviakov)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/183756.diff


2 Files Affected:

- (modified) mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp (+1-2) 
- (modified) mlir/test/Dialect/XeGPU/resolve-layout-conflicts.mlir (+12) 


``````````diff
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]]

``````````

</details>


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


More information about the Mlir-commits mailing list