fix(ir): correct model analysis and parser surfaces - #123
Merged
zhen8838 merged 10 commits intoAug 26, 2026
Conversation
…meline A producer hosted below a scope was represented by the node one level down that holds it, without checking that the scope actually schedules that node. For a block of layers in an inner loop followed by one more at the block level -- the shape every layered model has -- the representative named a node from a deeper chain and the scope-local lookup raised KeyError. Such a producer needs no representative: it ended before the scope's origin, which is what the scope is laid out from. Return None for it, and guard the readiness fold so a predecessor the scope does not hold cannot fail the lookup.
The flop count read `batch * m * k * n` off the local types, where sharding an axis has replaced it with `(units, per-unit)`. Split the result's last axis and the new axis lands at -2, so `prod(shape[:-2])` counts the rows a second time and the unit divisor never appears: per-unit work came out `global / 2` whatever the grid was, and `performance` -- issued against that column -- read 14x apart for two spellings of one gemm. Count the result's elements times the contraction instead. Same arithmetic, and it does not care where the axis went, so the two spellings now agree on the work and on the predicted time.
A body-local name for a constant expression -- `width = A + B` -- is an IR Binary and stays one, so 4096 + 4096 was not 8192 to a shard layout's divisibility check and the program was refused for a dimension nothing had left open. The same arithmetic at module level is folded by Python before it reaches the IR, and inline in a layout it is folded here, so one spelling of one extent behaved differently from the other two. Fold it in `static_dim_value`, which is what everything asks. And name a dim the way it was written when the refusal does stand: `repr` of an expression is a node dump, and a reader cannot find their own program in it.
Two spellings the grammar refused for no reason of its own, each with a message that named the matcher and not the cause. A docstring is a no-op statement carrying no work, so it had no statement pattern and `expression.attribute: pattern did not match (role 'statement_value')` pointed at a string literal. Drop a leading one where a body is wrapped. `tf.concat([a, b], axis=1)` is how torch, numpy, jax and tvm spell the call, so it is the first thing an author writes, and only the varargs form parsed. A variadic op now also takes its inputs as one sequence; no tensor is ever a list literal, so unwrapping one is unambiguous.
This was referenced Aug 25, 2026
Closed
Open
zhen8838
commented
Aug 26, 2026
zhen8838
commented
Aug 26, 2026
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
What
Contract
Risk