[Codegen] Remove ROCDL index==i32; add indexIsI64 to OptimizeIntArithmetic#23948
Open
krzysz00 wants to merge 1 commit intoiree-org:mainfrom
Open
[Codegen] Remove ROCDL index==i32; add indexIsI64 to OptimizeIntArithmetic#23948krzysz00 wants to merge 1 commit intoiree-org:mainfrom
krzysz00 wants to merge 1 commit intoiree-org:mainfrom
Conversation
…metic Integer range analysis now handles narrowing to i32 where safe, making the --iree-rocm-index-bits option (which lowered all ROCDL indices to 32-bit) obsolete. Remove it so the ROCDL path matches NVVM (which always has 64-bit indices at the LLVM conversion level). Add an indexIsI64 option to OptimizeIntArithmeticPass that relaxes the SAFE_INDEX_UNSIGNED_MAX_VALUE guard on signed-to-unsigned conversions for index values. On LLVMGPU targets where index is always 64-bit, this guard is unnecessarily conservative and blocks valid optimizations. For-loop IV narrowing (NarrowSCFForIvToI32 retains its own range checks unconditionally.) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
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.
Integer range analysis now handles narrowing to i32 where safe, making the --iree-rocm-index-bits option (which lowered all ROCDL indices to 32-bit) obsolete. Remove it so the ROCDL path matches NVVM (which always has 64-bit indices at the LLVM conversion level).
Add an indexIsI64 option to OptimizeIntArithmeticPass that relaxes the SAFE_INDEX_UNSIGNED_MAX_VALUE guard on signed-to-unsigned conversions for index values. On LLVMGPU targets where index is always 64-bit, this guard is unnecessarily conservative and blocks valid optimizations. For-loop IV narrowing (NarrowSCFForIvToI32 retains its own range checks unconditionally.)
Performance impact: on whole models, within the noise floor (as expected, this killed off a few instructions) but there is a consistent minor trend on the torch_models CI that gives a 1.01x geometric mean speedup, so there's not much reason not to do this. Table below.