Skip to content

Commit 97297d6

Browse files
committed
Add declare-spirv-builtins flag to libclc compilation.
This removes the need for forward declaring SPIR-V builtins in OpenCL files.
1 parent 70815f6 commit 97297d6

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

libclc/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
343343
set( opt_flags -O3 )
344344
endif()
345345

346+
# Enable SPIR-V builtin function declarations, so they don't
347+
# have to be explicity declared in the soruce.
348+
list( APPEND flags -Xclang -fdeclare-spirv-builtins)
349+
346350
add_libclc_builtin_set(libspirv-${arch_suffix}
347351
TRIPLE ${t}
348352
TARGET_ENV libspirv

libclc/amdgcn/lib/mem_fence/fence.cl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#include <clc/clc.h>
22

3-
_CLC_OVERLOAD _CLC_DEF void __spirv_MemoryBarrier(unsigned int memory,
4-
unsigned int semantics);
5-
63
// We don't have separate mechanism for read and write fences
74
_CLC_DEF _CLC_OVERLOAD void read_mem_fence(cl_mem_fence_flags flags) {
85
__spirv_MemoryBarrier(flags, 1);

libclc/amdgcn/lib/synchronization/barrier.cl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#include <clc/clc.h>
22

3-
_CLC_OVERLOAD _CLC_DEF _CLC_CONVERGENT void
4-
__spirv_ControlBarrier(unsigned int scope, unsigned int memory,
5-
unsigned int semantics);
6-
73
_CLC_DEF _CLC_OVERLOAD void barrier(cl_mem_fence_flags flags) {
84
// Call spir-v implementation of the barrier.
95
// Set semantics to not None, so it performs mem fence.

0 commit comments

Comments
 (0)