[SYCL][NVPTX][AMDGPU] Use __builtin_nearbyint in cmath wrapper#21971
Open
Maetveis wants to merge 2 commits intointel:syclfrom
Open
[SYCL][NVPTX][AMDGPU] Use __builtin_nearbyint in cmath wrapper#21971Maetveis wants to merge 2 commits intointel:syclfrom
Maetveis wants to merge 2 commits intointel:syclfrom
Conversation
Instead of using `__nv_nearbyint` and `__ocml_nearbyint` from device libraries,
use `__builtin_nearbyint` in the cmath wrapper. Both targets have native
support for nearbyint so we don't need to call out to the device library.
Both CUDA and HIP compilation already does this in `__clang_{cuda,hip}_math.h`.
We can then also remove `SYCL_EXTERNAL` use from this header, to fix intel#21652.
Fixes intel#21652.
bader
reviewed
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of using
__nv_nearbyintand__ocml_nearbyintfrom device libraries, use__builtin_nearbyintin the cmath wrapper. Both targets have native support for nearbyint so we don't need to call out to the device library. Both CUDA and HIP compilation already does this in__clang_{cuda,hip}_math.h. We can then also removeSYCL_EXTERNALuse from this header, to fix #21652.Fixes #21652.