[TIRx][CUDA] Add PTX address expressions with immediate byte offsets - #20153
Open
spectrometerHBH wants to merge 2 commits into
Open
[TIRx][CUDA] Add PTX address expressions with immediate byte offsets#20153spectrometerHBH wants to merge 2 commits into
spectrometerHBH wants to merge 2 commits into
Conversation
tlopex
approved these changes
Aug 18, 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.
This PR adds
T.ptx.addr(base, byte_offset)to the TIRx PTX dialect: a pure expression that folds a compile-time signed byte displacement into the PTX address operand, rendering as[%N+imm]instead of requiring a separate address computation before the instruction.tirx.ptx.addris an expression only in the outer PTX call's IR: the helper still receives the coerced base register, while the displacement becomes renderer metadata baked into the instruction text and the helper name (_addr<slot>_p<imm>/_m<imm>).allow_imm_offsetclassification of address slots, with validation that rejects immediate offsets on operand classes that cannot take them (e.g.tmemaddresses).IntImmat CUDA codegen, with an actionable error pointing at explicitly-unrolled loops.Also includes a small test fix:
test_tirx_kernels_registry_correctness.pyaccepts both the old and new MegaMoE kernel registry names (deepgemm_fp8_fp4_mega_moe/sm100_fp8_fp4_mega_moe), so the test works against tirx-kernels checkouts from either side of the rename.Tested with
tests/python/tirx/codegen/test_ptx_addr.py(new, 12 cases), plus the fulltests/python/tirx/suite on sm100.