-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libclc] Move sign to the CLC builtins library #115699
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
Conversation
CC @tstellar @fooishbar who might be able to account for the Mesa/SPIR-V target? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is the sign function currently implemented in the OpenCL headers?
The sign function for SPIR-V/Mesa is currently implemented by libclc here. With this change, |
This comment was marked as outdated.
This comment was marked as outdated.
cc @karolherbst @airlied who are better contacts for CL in Mesa these days |
3f5b4d2
to
0a9bcdc
Compare
0a9bcdc
to
d01bbfd
Compare
@arsenm I've just updated this PR. It still moves the alive2 seems to be happy with the transformation (for Let me know what you think. |
I'll look into undoing the CMake changes and building the dependent CLC functions for SPIR-V targets later on. |
bcaf223
to
ca117e3
Compare
ping, thanks |
This patch necessitates some changes to how CLSPV and SPIR-V targets are built. This is the first patch in this series in which an OpenCL function declaration has been called from the CLC library for these targets. Since libclc's OpenCL headers aren't being included at this stage, the OpenCL sign function isn't available. To fix this, these two libclc targets now have clang declare OpenCL builtins when building the internal CLC library. The __CLC_INTERNAL preprocessor definition has been repurposed (without the leading underscores) to be passed when building the internal CLC library. It was only used in one other place to guard an extra maths preprocessor definition, which we can do unconditionally. There are no changes (with llvm-diff) to any libclc target other than SPIR-V, which now has OpenCL sign call __clc_sign.
ca117e3
to
44adfb0
Compare
This commit moves the sign builtin's implementation to the CLC library. It simultaneously optimizes it (for vector types) by removing control-flow from the implementation. The __CLC_INTERNAL preprocessor definition has been repurposed (without the leading underscores) to be passed when building the internal CLC library. It was only used in one other place to guard an extra maths preprocessor definition, which we can do unconditionally.
This commit moves the sign builtin's implementation to the CLC library. It simultaneously optimizes it (for vector types) by removing control-flow from the implementation. The __CLC_INTERNAL preprocessor definition has been repurposed (without the leading underscores) to be passed when building the internal CLC library. It was only used in one other place to guard an extra maths preprocessor definition, which we can do unconditionally.
This commit moves the sign builtin's implementation to the CLC library. It simultaneously optimizes it (for vector types) by removing control-flow from the implementation. The __CLC_INTERNAL preprocessor definition has been repurposed (without the leading underscores) to be passed when building the internal CLC library. It was only used in one other place to guard an extra maths preprocessor definition, which we can do unconditionally.
Local branch amd-gfx 0ea0575 Manual merge main:2cd8207b26ea into amd-gfx:6f68ba52734c Remote branch main 64735ad [libclc] Move sign to the CLC builtins library (llvm#115699)
This commit moves the sign builtin's implementation to the CLC library.
It simultaneously optimizes it (for vector types) by removing
control-flow from the implementation.
The __CLC_INTERNAL preprocessor definition has been repurposed (without
the leading underscores) to be passed when building the internal CLC
library. It was only used in one other place to guard an extra maths
preprocessor definition, which we can do unconditionally.