[Mlir-commits] [mlir] [MLIR][XeGPU] Clean up stale convert_layout on single-element vector in peephole (PR #194043)

Jianhui Li llvmlistbot at llvm.org
Fri Apr 24 15:00:08 PDT 2026


================
@@ -449,11 +449,14 @@ class MultiRed2dOpPattern
     auto loc = reductionOp.getLoc();
     auto acc = reductionOp.getAcc();
 
-    // If the result is scalar after reduction, look for consumer
-    // convert_layout op and remove it. The layout propagation pass will
-    // re-install it properly after the decomposition.
+    // If the result is scalar or a single-element vector after reduction,
+    // look for consumer convert_layout op and remove it. The layout
----------------
Jianhui-Li wrote:

Instead of removing convert_layout consumers, I think the code here could insert a new convert_layout, converting the new layout (1d reduce-dim, due to the reduction decomposition) to the original layout (2d reduce-dim).  

The convert_layout is essentially no-op, but set up the layout correct for future layout propagation. 

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


More information about the Mlir-commits mailing list