Generalized affine expression decomposition for SGPR promotion#945
Draft
panditsa wants to merge 1 commit intoiree-org:mainfrom
Draft
Generalized affine expression decomposition for SGPR promotion#945panditsa wants to merge 1 commit intoiree-org:mainfrom
panditsa wants to merge 1 commit intoiree-org:mainfrom
Conversation
Add an N-way uniformity decomposition pass that splits any affine expression into additive components by symbol class (workgroup, induction variable, thread). This allows the LLVM backend to keep uniform contributions in SGPRs and fold them into hardware instruction fields (e.g. buffer_load soffset), reducing VGPR pressure. Key changes: - symbol_utils.py: add decompose_affine_by_uniformity(), a general N-way decomposition with cascade validation for cross-class terms - emitter.py: add get_uniformity_classes() and gen_sympy_index_decomposed() so any handler can decompose arbitrary affine maps at the emitter level - read_write.py: replace _split_index_three_way with the general utility, add _compute_linear_offset/_apply_uniform_offsets helpers, and apply the decomposition to handle_read, handle_write, and handle_gather_to_lds Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Add an N-way uniformity decomposition pass that splits any affine expression into additive components by symbol class (workgroup, induction variable, thread). This allows the LLVM backend to keep uniform contributions in SGPRs and fold them into hardware instruction fields (e.g. buffer_load soffset), reducing VGPR pressure.
Key changes: