-
Notifications
You must be signed in to change notification settings - Fork 790
[libspirv] Reuse clc function in generic math/common built-ins #19231
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
base: sycl
Are you sure you want to change the base?
Conversation
Delete unused .inc and .h files. Delete unused tables.cl.
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.
Good stuff, thank you.
I have been meaning to ask, are you testing all of these "generic" changes downstream with the SYCL-CTS? We unfortunately don't have great coverage of the "generic" implementations in pre-commit CI.
@frasercrmck Not yet, but these
For this PR, I only checked llvm-diff output. There are two main changes:
|
Sorry, after looking at llvm-diff again, I find following change which is unexpected:
I'll rework PR to limit the main change to be better vectorization only. |
Thanks for checking. Yesterday I did start some precursory investigations as to whether From what I remember, NV |
libclc/libspirv/lib/amdgcn-amdhsa/math/lgamma.cl libclc/libspirv/lib/amdgcn-amdhsa/math/log.cl libclc/libspirv/lib/amdgcn-amdhsa/math/sinpi.cl libclc/libspirv/lib/amdgcn-amdhsa/math/sqrt.cl libclc/libspirv/lib/amdgcn-amdhsa/math/fmax.cl libclc/libspirv/lib/amdgcn-amdhsa/math/fmin.cl libclc/libspirv/lib/ptx-nvidiacl/math/log.cl libclc/libspirv/lib/ptx-nvidiacl/math/sinpi.cl libclc/libspirv/lib/ptx-nvidiacl/math/sqrt.cl Move them into clc to eliminate llvm-diff differences of commit 96f547c Fix a typo in libspirv/lib/generic/math/sqrt.cl These functions use amdgcn and ptx clang built-ins and vector functions are scalarized. Therefore, they are not well vectorized compared to generic implementations. __nv_isinfd, __nv_isinff, __nv_isnand, __nv_isnanf and __nv_fma are not moved from libspirv to clc because they'll cause change in many other places since __clc_isinf/__clc_isnan/__clc_fma are widely used in many clc functions.
Yes, _nv* and _ocml* scalar clang builtin can't be vectorized in libspirv.
I have fixed llvm-diff caused by the first commit of this PR for following functions by moving their use from libspirv to clc in 3986a2d:
I'm not able to fix llvm-diff for __nv_isinfd, __nv_isinff, __nv_isnand, __nv_isnanf and __nv_fma. I can't move them from libspirv to clc because the moving will cause change in many other places since __clc_isinf/__clc_isnan/__clc_fma are widely used in many clc functions. |
I think that's probably fine, thanks. I do hesitate at introducing these changes to the OpenCL builtins. For one it increases our downstream changes which results in a higher maintenance burden. We also don't know these We could probably look at undoing these changes later and having these builtins use the generic implementation across the board. |
Delete unused .inc and .h files. Delete unused tables.cl.