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

[SYCL] Fix min/max known_identity<> wrong when -ffast-math is used. #17028

Merged

Conversation

cperkinsintel
Copy link
Contributor

@cperkinsintel cperkinsintel commented Feb 14, 2025

Technically a workaround, this fixes the problem with known_identity<minOp/maxOp> being incorrect when using -ffast-math. It works because we have a __FAST_MATH__ macro that is defined when that flag is used. Better, would be to detect -fno-honor-infinities. Opening a JIRA/discussion for that, but this is a big improvement in the interim.

See discussion #13813

…T> being incorrect when using -ffast-math. It works because we have a __FAST_MATH__ macro that is defined when that flag is used. Better, ould be to detect -fno-honor-infinities,. Opening a JIRA/discussion for that, but this is a big improvement in the interim.
Copy link
Contributor

@uditagarwal97 uditagarwal97 left a comment

Choose a reason for hiding this comment

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

LGTM. One minor NIT

See https://github.com/intel/llvm/issues/13813

-ffast-math implies -fno-honor-infinities. In this case, the known_identity
for sycl::minimum<T> cannot be inifinity (which will be 0), but must instead
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for sycl::minimum<T> cannot be inifinity (which will be 0), but must instead
for sycl::minimum<T> cannot be infinity (which will be 0), but must instead

sycl/include/sycl/known_identity.hpp Show resolved Hide resolved
@againull againull merged commit 054bc27 into intel:sycl Feb 18, 2025
31 checks passed
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