Skip to content
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

[TESTS] Rewrite test_conversions to only use portable code #3368

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

pawelszczerbuk
Copy link
Contributor

Removing ptx inline assembly from test_conversions.py. Using method proposed by Adam Goucher to perform the RTNE rounding instead:
Add the 0x800000 (8388608) to bring the value to the range [2 ** 23, 2 ** 24], where floats correspond with integers. Also, this utilizes the default RTNE rounding of addition. Then subtract 0x800000 to bring the value to the original range, already rounded to integer. Finally, do a simple fp to int cast.

Copy link
Collaborator

@ThomasRaoux ThomasRaoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Collaborator

@apgoucher apgoucher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved

@apgoucher apgoucher merged commit 7a8babd into main Mar 13, 2024
4 checks passed
@apgoucher apgoucher deleted the pawel/portable_conversions branch March 13, 2024 17:45
htyu pushed a commit to htyu/triton that referenced this pull request Mar 20, 2024
…ng#3368)

Removing ptx inline assembly from test_conversions.py. Using method
proposed by Adam Goucher to perform the RTNE rounding instead:
Add the 0x800000 (8388608) to bring the value to the range [2 ** 23, 2
** 24], where floats correspond with integers. Also, this utilizes the
default RTNE rounding of addition. Then subtract 0x800000 to bring the
value to the original range, already rounded to integer. Finally, do a
simple fp to int cast.
karupayun pushed a commit to openxla/triton that referenced this pull request Apr 3, 2024
…ng#3368)

Removing ptx inline assembly from test_conversions.py. Using method
proposed by Adam Goucher to perform the RTNE rounding instead:
Add the 0x800000 (8388608) to bring the value to the range [2 ** 23, 2
** 24], where floats correspond with integers. Also, this utilizes the
default RTNE rounding of addition. Then subtract 0x800000 to bring the
value to the original range, already rounded to integer. Finally, do a
simple fp to int cast.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants