[Mlir-commits] [mlir] [mlir][xegpu] Explain why a region op's operand layout is not derived locally (PR #219620)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Aug 28 21:00:07 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-gpu
Author: Jianhui Li (Jianhui-Li)
<details>
<summary>Changes</summary>
getConsumerLayoutAt reads a region op's forwarded-operand layout from the layout_operand_N attribute that propagateRegionArgsToInits writes. A TODO suggested deriving it from the region argument instead, so that this function would be the only source of an operand's required layout. Replace the TODO comment since it is not practical: the pass mutates the very uses such a derivation would read, so the answer would depend on walk progress.
---
Full diff: https://github.com/llvm/llvm-project/pull/219620.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp (+4-3)
``````````diff
diff --git a/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp b/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp
index ac4aea9d60d54..c1b71f65d4054 100644
--- a/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp
+++ b/mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp
@@ -2912,9 +2912,10 @@ xegpu::DistributeLayoutAttr xegpu::getConsumerLayoutAt(OpOperand &operand) {
return xegpu::getDistributeLayoutAttr(operand);
// Region ops with forwarded operands (scf.for's and scf.while's inits) carry
// the required operand layout as the layout_operand_N that
- // propagateRegionArgsToInits back-propagated from the region argument.
- // TODO: derive that layout from the region argument here instead, so this
- // function is the only place an operand's required layout comes from.
+ // propagateRegionArgsToInits back-propagated from the region argument. Do not
+ // re-derive it from that argument here: conflict resolution inserts
+ // convert_layout ops as it walks, rewriting the argument's uses, so what
+ // those uses require depends on how far the walk has progressed.
if (isa<RegionBranchOpInterface>(op))
return xegpu::getDistributeLayoutAttr(operand);
// A region terminator requires the layout of the successor input its operand
``````````
</details>
https://github.com/llvm/llvm-project/pull/219620
More information about the Mlir-commits
mailing list