[libclc] [libclc] Support the generic address space (PR #137183)
Fraser Cormack via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 28 08:05:08 PDT 2025
================
@@ -420,12 +420,37 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
-D${CLC_TARGET_DEFINE}
# All libclc builtin libraries see CLC headers
-I${CMAKE_CURRENT_SOURCE_DIR}/clc/include
+ # Error on undefined macros
+ -Werror=undef
)
if( NOT "${cpu}" STREQUAL "" )
list( APPEND build_flags -mcpu=${cpu} )
endif()
+ # Generic address space support.
+ # Note: when declaring builtins, we must consider that even if a target
+ # formally/nominally supports the generic address space, in practice that
+ # target may map it to the same target address space as another address
+ # space (often the private one). In such cases we must be careful not to
+ # multiply-define a builtin in a single target address space, as it would
+ # result in a mangling clash.
+ # For this reason we must consider the target support of the generic
+ # address space separately from the *implementation* decision about whether
+ # to declare certain builtins in that address space.
+ # FIXME: Shouldn't clang automatically enable this extension based on the
+ # target?
----------------
frasercrmck wrote:
See the first PR for AMDGPU support: https://github.com/llvm/llvm-project/pull/137636.
I'll do a separate one for NVPTX. It looks like SPIRV (and X86) enable all by default. That should cover all libclc targets.
https://github.com/llvm/llvm-project/pull/137183
More information about the cfe-commits
mailing list