Skip to content

[pallas:triton] Fix atomic min/max lowering for uint and float types #26604

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

draganmladjenovic
Copy link

@draganmladjenovic draganmladjenovic commented Feb 19, 2025

Floating point implementation is lifted from triton frontend itself. It has somewhat inconsistent semantics with regards to nan values. Should we leave it as is? Or implement it via cas loop matching np.max or np.maxnum semantics? Or should we allow min and max on fp types at all?

@hawkinsp hawkinsp requested a review from superbobry February 19, 2025 17:56
@superbobry
Copy link
Collaborator

I think we should follow Triton when making these choices. It looks like it does allow min/max for floating types, so Pallas Triton should too. Not sure what it does for nans, though?

@google-ml-butler google-ml-butler bot added kokoro:force-run pull ready Ready for copybara import and testing labels Feb 20, 2025
@draganmladjenovic
Copy link
Author

I think we should follow Triton when making these choices. It looks like it does allow min/max for floating types, so Pallas Triton should too. Not sure what it does for nans, though?

max will effectively propagate nans w/o sign bit set while min will will do so with nans with sign bit set. So behavior is not really that consistent. I'm guessing one could say that when using nans for min and max the result is undefined? XLA has a clear IEEE 754 semantics here (sans SNANs). It as a tradeoff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull ready Ready for copybara import and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants