Repository navigation
Conversation
A mesh axis whose extent a DimVar decides makes the strides around it symbolic, and selected_run sorted and joined its modes as if they were numbers; an elementwise instruction's scalar or lower-rank operand was given an identity of its own rank, which no Op iterating a wider result can answer about. Both now say what they reach: the stated modes in the first case, the existing right-aligned broadcast relation in the second. Fixes tile-ai#201 Fixes tile-ai#200
zhen8838
force-pushed
the
foundry/kda-fwd-r1
branch
from
October 1, 2026 17:22
abcfd37 to
7022aa9
Compare
Collaborator
Author
|
Closing to redo under docs/plans/schedule-broadcast-symbolic-mesh: elementwise relations will share one broadcast-aware identity_relations derived from operand types only, and symbolic mesh scopes will be compared without selected_run. A new PR with a schedule fixture covering #200 and #201 will follow. |
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.
Why
Two places assume a value they are handed is a number, and raise rather than
answer when it is not. Both block the documented workflow of
tilefoundry tutorial optimizeon an ordinary program.selected_runsorts a mesh level's modes by(stride, extent)and joinsadjacent ones. A
Meshlayout naming an extent aDimVardecides — how achunk-parallel placement over an open sequence length is written — makes the
strides around it symbolic, and the sort raises
'<' not supported between instances of 'int' and 'Call'with no sourcelocation. Its neighbours in the same file already guard on
isinstance(..., int). Issue fix(ir): handle a symbolic extent in selected_run #201.identity_relationsgives every read operand of an elementwise instruction anidentity of that operand's own rank. A scalar operand therefore yields
{ [] -> [] }, whichiteratingrejects against the Op's domain, andschedule candidatesaborts for the whole program:a boundary is asked by 0 coordinates and its Op iterates 2. Adding an epsilon to a reduction is thecommon case, so every normalisation hits it. A lower-rank broadcast operand
fails the same way. Issue fix(schedule): give an elementwise read the result's rank #200.
What
ir/types/mesh.py: when any mode of a level carries a symbolic extent orstride,
selected_runreports the modes the mesh states instead of orderingand joining them. A symbolic mode orders against nothing and is adjacent to
nothing, and two equal runs still compare equal, so
covered_by_scopekeepsrecognising a scope as itself.
visitor_registry/access_relation.py:identity_relationsstates each readoperand's broadcast relation with the
broadcast_accessthat HIRBinaryalready uses, so a scalar operand is read once per point the Op walks and a
shorter one right-aligns. The docstring said a structural operand borrows the
iteration rank; this is what makes that true for a rank-zero tensor too.
tests/ir/types/test_mesh.py: a regression test for a run whose modes aDimVardecides.Contract
Neither change alters what a program means or what any already-working program
lowers to.
selected_run's result for an all-integer level is unchanged; thenew branch is reachable only where the old code raised.
identity_relationsreturns the same identity relation whenever every read operand already carries
the result's shape, which is every case that type-checked before. The
instruction's own pattern matching is untouched: an operand it cannot accept is
still refused by shape, dtype or storage, and is now refused with a report
rather than an abort.
Risk
tests/ir,tests/schedule,tests/visitor_registry,tests/analysis,tests/parserandtests/dslpass. The full suite's 41 failures are thepre-existing ones that compile CUDA in this image; the set is identical before
and after the change, verified by running it on both revisions.
The residual risk is in the second change: an instruction whose operands were
previously rejected for an unrelated reason may now be probed further and
reported as refused on a different ground. That is the intended effect — a
candidate report that names the real reason — but it does change the text of
some
schedule candidatesoutput.