[libclc] [libclc] Move sign to the CLC builtins library (PR #115699)
Karol Herbst via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 19 06:26:17 PST 2024
================
@@ -322,22 +322,26 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
if ( ARCH STREQUAL spirv OR ARCH STREQUAL spirv64 )
set( build_flags -O0 -finline-hint-functions -DCLC_SPIRV )
- set( opt_flags )
+ set( clc_opt_flags )
+ # Inline CLC functions into OpenCL builtins
+ set( opencl_opt_flags "--passes=always-inline" )
----------------
karolherbst wrote:
Yeah, we in mesa we can map all those SPIR-V CL ExtInst to either a libclc spir-v implementation or something mesa implementation defined.
There is also like the problem with `fma`, which should never get inlined no matter what, because some devices might actually need the emulation, so it's either having two or mor spir-vs (with fma emulation enabled/disabled and potential other options) or one for everything and we just pick whatever we need.
We aren't linking against the libclc SPIR-V on a SPIR-V level, but do it way later, so we have way more flexibility here and can cope with a single variant. However, that relies on builtins not being inlined into other bultins implementations.
Besides that one we are fine with optimizations as long as the SPIR-V remains valid, which if you enable LLVM optimizations isn't simply the case anymore and the SPIRV-LLVM-Translator ends up generating invalid SPIR-V. But this is another issue.
https://github.com/llvm/llvm-project/pull/115699
More information about the cfe-commits
mailing list