[REFACTOR][IR] Unify expression subscription realization - #20246
Merged
Conversation
spectrometerHBH
approved these changes
Aug 31, 2026
tqchen
force-pushed
the
tvm-unified-subscriptproxy
branch
2 times, most recently
from
August 31, 2026 20:32
9c8b881 to
1ad479f
Compare
tqchen
force-pushed
the
tvm-unified-subscriptproxy
branch
from
August 31, 2026 21:19
1ad479f to
46ef80d
Compare
tqchen
pushed a commit
that referenced
this pull request
Sep 1, 2026
## Motivation Since #20246, expression subscription returns a lazy `SubscriptProxy` until a consumer realizes the expression. Most parser expression boundaries already honor that contract, but PTX predicate operand coercion bypasses the generic realization path. As a result, code such as `setp(..., buffer[0], ...)` dispatches the proxy itself and rejects it as an invalid operand. The delayed realization also means source metadata must travel with the proxy. Without that, realizing `A[0]` creates a `TensorLoad` without the exact subscription span, so downstream diagnostics such as TIRx racecheck and GDN cannot attribute the access to its source location. ## Summary - realize lazy subscript operands used directly by PTX predicate inputs and destinations - preserve parser source spans through `SubscriptProxy` realization - propagate the span through tuple, Relax, and TIRx subscription callbacks This completes the lazy-subscript contract introduced by #20246 and fixes downstream regressions exposed by the TIRx migration in #20247. ## Testing - `cmake --build build -j 16` - `python -m pytest -q tests/python/tvmscript/test_tvmscript_parser_source.py::test_parser_attaches_span_to_nested_tensor_load tests/python/tvmscript/test_tvmscript_parser_source.py::test_parser_attaches_span_to_direct_call tests/python/tirx/codegen/test_ptx_dialect.py::test_ptx_comparison_selection_dispatch` - downstream wiki-kernel integration: 5 passed - downstream full `tirx_tools` gate: 2933 passed
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.
Summary
tvm.ir.SubscriptProxywith type-registered realizationExprOperand