[Mlir-commits] [mlir] [MLIR][XeGPU] Clone trivial operations with multiple consumers in layout propagation to avoid layout conflict (PR #197514)
Jianhui Li
llvmlistbot at llvm.org
Fri May 22 08:58:44 PDT 2026
================
@@ -124,13 +126,90 @@ 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).
+static bool isTriviallyRematerializable(Operation *op) {
+ if (!op || op->getNumRegions() != 0)
+ return false;
+ if (!isMemoryEffectFree(op))
+ return false;
+ for (Value v : op->getOperands()) {
+ Operation *defOp = v.getDefiningOp();
----------------
Jianhui-Li wrote:
+1.
Could enhance the step test below by multiple with a constant stride first, and then use it to broadcast row-wise and column-wise to create the layout conflict.
https://github.com/llvm/llvm-project/pull/197514
More information about the Mlir-commits
mailing list