[RELAND] Infer src/dst of allowReorder reshape#9997
Merged
Conversation
This was referenced Apr 10, 2026
8db086f to
a060672
Compare
8420ab9 to
199e660
Compare
ThomasRaoux
approved these changes
Apr 14, 2026
isExpensiveCat does not reflect the constraint we have in lowering, which is that the number of unique result elements per thread must be equal to the total number of unique operand elements per thread. This means that we can sometimes fold `CatOp` into layout conversions that have destination layouts that violate this requirement. Rename it to `isLegalCatEncoding` to reflect that it is actually a correctness requirement, and update it to reflect the actual constraint.
Check that the shapes and encodings of CatOp are valid and can be lowered.
Reland of #9926. Always infer the src/dst of reshapes, even if allowReorder is set. The result is valid for allowReorder reshapes, even if there isn't a single canonical encoding. When the existing encoding is one of the possible results, we prefer that to minimize changes. This allows inference to always succeed on reshapes, and any heuristics on whether to use the inferred value can be maintained by the caller. One example I identified while looking at this was that allowReorder reshapes will currently fail backward remat in RemoveLayoutConversions if the reshape cannot be rematerialised with the same source encoding. This PR instead changes RemoveLayoutConversions to check specifically for whether the reshape has been marked as efficient, and otherwise just do the remat. (this is a potentially perf sensitive change)
199e660 to
d6951d3
Compare
a060672 to
3308fac
Compare
raymondtay
pushed a commit
to raymondtay/triton
that referenced
this pull request
Apr 18, 2026
Reland of triton-lang#9926. Always infer the src/dst of reshapes, even if allowReorder is set. The result is valid for allowReorder reshapes, even if there isn't a single canonical encoding. When the existing encoding is one of the possible results, we prefer that to minimize changes. This allows inference to always succeed on reshapes, and any heuristics on whether to use the inferred value can be maintained by the caller. One example I identified while looking at this was that allowReorder reshapes will currently fail backward remat in RemoveLayoutConversions if the reshape cannot be rematerialised with the same source encoding. This PR instead changes RemoveLayoutConversions to check specifically for whether the reshape has been marked as efficient, and otherwise just do the remat. (this is a potentially perf sensitive change)
nurmukhametov
added a commit
to ROCm/xla
that referenced
this pull request
Apr 20, 2026
…iton/commits/6ea516a6e4cb1878fb6969d222e23294712b3955) [List of integrated commits](triton-lang/triton@6a0b546...6ea516a) Adapt to upstream API changes: * `DialectInferLayoutInterface::inferReshapeOpEncoding` gained an `allowReorder` parameter in triton-lang/triton#9997. * Rebase `mma_limit_pred.patch` and `no_accelerate_through_broadcast.patch` against the upstream rename of `DescriptorLoadOp` to `DescriptorLoadLikeOpInterface` in `AccelerateMatmul.cpp`. Patch semantics are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reland of #9926.
Always infer the src/dst of reshapes, even if allowReorder is set. The
result is valid for allowReorder reshapes, even if there isn't a single
canonical encoding. When the existing encoding is one of the possible
results, we prefer that to minimize changes.
This allows inference to always succeed on reshapes, and any heuristics
on whether to use the inferred value can be maintained by the caller.
One example I identified while looking at this was that allowReorder
reshapes will currently fail backward remat in RemoveLayoutConversions
if the reshape cannot be rematerialised with the same source encoding.
This PR instead changes RemoveLayoutConversions to check specifically
for whether the reshape has been marked as efficient, and otherwise
just do the remat. (this is a potentially perf sensitive change)