-
Notifications
You must be signed in to change notification settings - Fork 754
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][libclc] Add generic addrspace overloads of math builtins #13015
Merged
Conversation
This file contains 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
6f32ac4
to
739cc92
Compare
The generic implementations of the math builtins which take pointer arguments were using unqualified address spaces. This could either resolve to the generic address space or the private address space, depending on whether the target supports the generic address space or not. The newer unified OpenCL C specification is clearer in mandating that all targets must provide overloads on the explicitly qualified 'private' address space, as well as optionally defining ones on the (unqualified) generic address space. This meant that most of these math builtins were lacking one overload: either the private or generic one, depending on which target was compiling the builtins. One notable exception here is NVIDIA, which maps the private and generic address spaces to the same target address space. Thus declaring builtins overloaded on these two address spaces results in a mangling clash, which we can't have. Therefore we now say that NVIDIA targets don't support the generic address space for the purposes of these builtins. In reality, the builtins with the private address space are functionally equivalent to the generic ones, so users won't notice. For the sake of code clarity, although the 'generic' keyword is technically reserved, we know that clang defines it to be the corresponding unqualified generic address space, so we use that to be explicit. We always compile with clang so it shouldn't be a problem with portability. With this we can also enable a LIT test for HIP, which was previously failing as it couldn't find the generic address space overloads of fract and lgamma_r. There are other builtins that this treatment (may) need applied to, such as the vload and vstore variants. Those will be handled in a subsequent patch.
739cc92
to
b6068f0
Compare
npmiller
approved these changes
Mar 19, 2024
Friendly ping @intel/llvm-reviewers-runtime @bso-intel |
bso-intel
approved these changes
Mar 20, 2024
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.
The generic implementations of the math builtins which take pointer arguments were using unqualified address spaces. This could either resolve to the generic address space or the private address space, depending on whether the target supports the generic address space or not.
The newer unified OpenCL C specification is clearer in mandating that all targets must provide overloads on the explicitly qualified 'private' address space, as well as optionally defining ones on the (unqualified) generic address space. This meant that most of these math builtins were lacking one overload: either the private or generic one, depending on which target was compiling the builtins.
One notable exception here is NVIDIA, which maps the private and generic
address spaces to the same target address space. Thus declaring builtins
overloaded on these two address spaces results in a mangling clash,
which we can't have. Therefore we now say that NVIDIA targets don't
support the generic address space for the purposes of these builtins. In
reality, the builtins with the private address space are functionally
equivalent to the generic ones, so users won't notice.
For the sake of code clarity, although the 'generic' keyword is technically reserved, we know that clang defines it to be the corresponding unqualified generic address space, so we use that to be explicit. We always compile with clang so it shouldn't be a problem with portability.
With this we can also enable a LIT test for HIP, which was previously failing as it couldn't find the generic address space overloads of the fract and lgamma_r builtins.
There are other builtins that this treatment (may) need applied to, such as the vload and vstore variants. Those will be handled in a subsequent patch.