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

Add rsqrt as a native triton language function #3511

Merged
merged 2 commits into from
Mar 29, 2024
Merged

Conversation

pawelszczerbuk
Copy link
Contributor

Adding support for rsqrt in Triton. Also adding tests for unary math ops.

@pawelszczerbuk pawelszczerbuk requested a review from ptillet as a code owner March 29, 2024 17:01
@pawelszczerbuk pawelszczerbuk enabled auto-merge (squash) March 29, 2024 17:03
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

@jlebar jlebar left a comment

Choose a reason for hiding this comment

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

OOC what does this lower to in PTX?

https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#floating-point-instructions-rsqrt is probably what people want, but it's "approx".

@pawelszczerbuk pawelszczerbuk merged commit 5682379 into main Mar 29, 2024
5 checks passed
@pawelszczerbuk pawelszczerbuk deleted the pawel/rsqrt branch March 29, 2024 17:12
@pawelszczerbuk
Copy link
Contributor Author

OOC what does this lower to in PTX?

https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#floating-point-instructions-rsqrt is probably what people want, but it's "approx".

Yup, rsqrt.approx. We can add _rn, _rz versions of the function as we have done for other, if necessary.

@jlebar
Copy link
Collaborator

jlebar commented Mar 29, 2024

Should we add a warning to the documentation that this is approximate and 1/sqrt(x) may be more accurate? (Maybe the Triton function should even be called rsqrt_approx?)

@jlebar
Copy link
Collaborator

jlebar commented Mar 29, 2024

We can add _rn, _rz versions of the function as we have done for other, if necessary.

I'm not sure these exist for rsqrt.approx?

ptillet pushed a commit that referenced this pull request Apr 1, 2024
Adding support for rsqrt in Triton. Also adding tests for unary math
ops.
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