-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[triton-raise-block-ptr]: Avoid creating unnecessary index casts and divisions #3129
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Tiotto, Ettore <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please check if createOrFold
can be used to simplify the code?
Signed-off-by: Tiotto, Ettore <[email protected]>
…intel-xpu-backend-for-triton into etiotto.raise_block_ptr.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I have changed the code to use
Unfortunately I do see the presence of adds by zero in the resulting IR, for example:
|
Thanks for checking. |
The triton-raise-block-pointer pass injects arithmetic index cast operations unnecessarily (when there is a prior index cast operation that is equivalent). These unnecessary operation "obfuscate" the IR and make it harder to understand the transformation while debugging it (although canonicalization can clean the up after the pass is done).
This PR improves readability of the generate IR by reusing constant (in the same basic block) when possible, and avoiding creating index_cast operations where they can be folded.