Repository navigation
feat(codegen): forward assert-bounded result-bundle indexing - #1143
Merged
nihalpasham merged 1 commit intoAug 28, 2026
Merged
Conversation
Signed-off-by: Raul Estrada <[email protected]>
Collaborator
|
Verified sound, meets every #1142 criterion:
The win: Follow-ups we'll take post-merge: an entry-block guard for the hand-built-IR corner (same exposure exists in #650; unreachable from rustc MIR), and consolidating the duplicated assert-proof helper. At landing we rerun tests, the per-example lint gates for generated_ldmatrix, and the 5090 run with and without |
nihalpasham
approved these changes
Aug 28, 2026
nihalpasham
left a comment
Collaborator
There was a problem hiding this comment.
Re-validated on the merged tree: 4,269 workspace tests green, generated_ldmatrix passes on the 5090 with and without CUDA_OXIDE_NO_OPT=1, zero .local in the PTX in both variants; CI green. Merging.
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.
Closes #1142
Summary
Extend compiler result-bundle forwarding to support terminal dynamic array indexing whose candidate set is proven by an exact bounds assertion:
This complements the existing unsigned
index % Cpath added in #1005.Implementation
forward_compiler_result_bundlesnow accepts an assertion-derived dynamic index only when all of the following are proven:mir.assert;mir.lt(index, C);Chas the same type as the index;Cis a constant;0 < C <= array length;C <= MAX_SCALARIZED_CANDIDATES.For this case the pass materializes:
This reuses the existing bounded
mir.extract_array_elementlowering rather than adding a second scalarization mechanism.The proof intentionally mirrors the narrow assertion shape already used by borrowed aggregate read scalarization from #650.
Fail-closed behavior
The pass still rejects unsupported forms, including:
MAX_SCALARIZED_CANDIDATES;No general range analysis is introduced.
End-to-end coverage
The
generated_ldmatrixexample now exercises both bounded dynamic forms:Both paths select one register from the compiler-owned
ldmatrix.m8n8.x4.b16result bundle and verify the result on the host.Validation
Results:
mir-transforms: all tests passed, including the new assertion-bound positive and fail-closed cases.mir-lower: all tests passed.cuda-oxide-codegen: all tests passed.-D warnings.generated_ldmatrixpassed onsm_120with normal optimization.generated_ldmatrixpassed onsm_120withCUDA_OXIDE_NO_OPT=1.Runtime output included:
PTX inspection also reports no local-memory round trip for the generated
result-bundle selection:
Related
% C