[libclc] [libclc] Move sign to the CLC builtins library (PR #115699)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 02:26:20 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" )
----------------
frasercrmck wrote:

Do you mean for SPIR-V in the context of this PR (to stop the introduction of new `always_inline` attributes), or generally across the whole of libclc?

I don't mind the former as, yeah, `always_inline` isn't ideal. But the SPIR-V/Mesa targets seem quite explicit that they don't want any optimizations. Limiting the optimizations to just the `always-inline` pass was my way of adhering to that wish as best as I could. I don't know if SPIR-V/Mesa opt out of optimizations because the SPIR-V translator couldn't handle optimized LLVM IR, or produced worse SPIR-V, or crashed, or whether it was just for compile-time reasons. Maybe it doesn't apply any more? I'm happy to do whatever with those targets, as long as someone can vouch for them.

The latter would be a significant change as in practice _every_ function for the AMDGPU/NVPTX targets - OpenCL or CLC - currently has the `always_inline`  attribute set, via `_CLC_DEF`. I'm not sure it's the best time to drop that assumption.

https://github.com/llvm/llvm-project/pull/115699


More information about the cfe-commits mailing list