[Mlir-commits] [mlir] [MLIR][XeGPU] Prefer the nearer consumer's layout in LayoutInfo::meet (PR #208365)
Artem Kroviakov
llvmlistbot at llvm.org
Thu Jul 9 03:01:52 PDT 2026
================
@@ -58,6 +60,14 @@ namespace {
// LayoutInfo
//===----------------------------------------------------------------------===//
+/// Program-order index of the op currently being visited by the backward
+/// analysis. `visitOperation` sets this before dispatching, and the
+/// single-argument LayoutInfo constructor stamps it onto every demand pushed to
+/// an operand, so the ~30 `operand->meet(LayoutInfo(...))` call sites need no
+/// change. A larger index means farther from the producer; the sentinel max
+/// marks demands with no associated op (e.g. exit state).
+static int64_t currentProgramOrder = std::numeric_limits<int64_t>::max();
----------------
akroviakov wrote:
A 30-line change is less of a concern compared to introducing an implicit dependency of the LayoutInfo constructor on this global mutable state (with an explicit comment about saving a change of 30 lines).
The `currentProgramOrder` is set, tracked, and used by `LayoutInfoPropagation`, so it being a member is expected.
If the goal is to prevent explicit order passing in each visitor's layout creation, a private `LayoutInfoPropagation` helper would allow avoiding a call signature change and just rename call sites:
```
LayoutInfo makeLayoutInfo(DistributeLayoutAttr layout) {
return LayoutInfo(layout, this->currentProgramOrder);
}
```
https://github.com/llvm/llvm-project/pull/208365
More information about the Mlir-commits
mailing list