Skip to content

Commit 4dec390

Browse files
authored
[libclc] Have all targets build all CLC functions (#124779)
This removes all remaining SPIR-V workarounds for CLC functions, in an effort to streamline the CLC implementation and prevent further issues that #124614 had to fix. This commit fixes the same issue for the SPIR-V targets. Target-specific CLC implementations can and will exist, but for now they're all identical and so the target-specific SOURCES files have been removed. Target implementations now always include the 'generic' CLC directory, meaning we can avoid unnecessary duplication of SOURCES listings.
1 parent 6fd99de commit 4dec390

22 files changed

+7
-191
lines changed

libclc/CMakeLists.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
3232
spirv64/lib/SOURCES;
3333
# CLC internal libraries
3434
clc/lib/generic/SOURCES;
35-
clc/lib/clspv/SOURCES;
36-
clc/lib/clspv64/SOURCES;
37-
clc/lib/spirv/SOURCES;
38-
clc/lib/spirv64/SOURCES;
3935
)
4036

4137
set( LIBCLC_MIN_LLVM 3.9.0 )
@@ -266,15 +262,15 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
266262
list( GET TRIPLE 1 VENDOR )
267263
list( GET TRIPLE 2 OS )
268264

269-
set( dirs )
265+
set( opencl_dirs )
270266

271267
if ( NOT ${ARCH} STREQUAL spirv AND NOT ${ARCH} STREQUAL spirv64 AND
272268
NOT ${ARCH} STREQUAL clspv AND NOT ${ARCH} STREQUAL clspv64)
273-
LIST( APPEND dirs generic )
269+
LIST( APPEND opencl_dirs generic )
274270
endif()
275271

276272
if( ${ARCH} STREQUAL r600 OR ${ARCH} STREQUAL amdgcn )
277-
list( APPEND dirs amdgpu )
273+
list( APPEND opencl_dirs amdgpu )
278274
endif()
279275

280276
# Some targets' directories alias others
@@ -291,11 +287,13 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
291287
endif()
292288

293289
set( clc_lib_files )
290+
set( clc_dirs ${dirs} generic )
291+
294292
libclc_configure_lib_source(
295293
clc_lib_files
296294
CLC_INTERNAL
297295
LIB_ROOT_DIR clc
298-
DIRS ${dirs} ${DARCH} ${DARCH}-${OS} ${DARCH}-${VENDOR}-${OS}
296+
DIRS ${clc_dirs} ${DARCH} ${DARCH}-${OS} ${DARCH}-${VENDOR}-${OS}
299297
)
300298

301299
set( opencl_lib_files )
@@ -312,7 +310,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
312310

313311
libclc_configure_lib_source(
314312
opencl_lib_files
315-
DIRS ${dirs} ${DARCH} ${DARCH}-${OS} ${DARCH}-${VENDOR}-${OS}
313+
DIRS ${opencl_dirs} ${DARCH} ${DARCH}-${OS} ${DARCH}-${VENDOR}-${OS}
316314
)
317315

318316
foreach( d ${${t}_devices} )
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
#ifndef __CLC_INTEGER_CLC_ABS_H__
22
#define __CLC_INTEGER_CLC_ABS_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible abs
6-
#define __clc_abs abs
7-
#else
8-
94
#define __CLC_BODY <clc/integer/clc_abs.inc>
105
#include <clc/integer/gentype.inc>
116

12-
#endif
13-
147
#endif // __CLC_INTEGER_CLC_ABS_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
#ifndef __CLC_INTEGER_CLC_ABS_DIFF_H__
22
#define __CLC_INTEGER_CLC_ABS_DIFF_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible abs_diff
6-
#define __clc_abs_diff abs_diff
7-
#else
8-
94
#define __CLC_BODY <clc/integer/clc_abs_diff.inc>
105
#include <clc/integer/gentype.inc>
116

12-
#endif
13-
147
#endif // __CLC_INTEGER_CLC_ABS_DIFF_H__

libclc/clc/include/clc/relational/clc_all.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ALL_H__
22
#define __CLC_RELATIONAL_CLC_ALL_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible all
6-
#define __clc_all all
7-
#else
8-
94
#include <clc/clcfunc.h>
105
#include <clc/clctypes.h>
116

@@ -27,6 +22,4 @@ _CLC_VECTOR_ALL_DECL(long)
2722
#undef _CLC_ALL_DECL
2823
#undef _CLC_VECTOR_ALL_DECL
2924

30-
#endif
31-
3225
#endif // __CLC_RELATIONAL_CLC_ALL_H__

libclc/clc/include/clc/relational/clc_any.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ANY_H__
22
#define __CLC_RELATIONAL_CLC_ANY_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible any
6-
#define __clc_any any
7-
#else
8-
94
#include <clc/clcfunc.h>
105
#include <clc/clctypes.h>
116

@@ -27,6 +22,4 @@ _CLC_VECTOR_ANY_DECL(long)
2722
#undef _CLC_ANY_DECL
2823
#undef _CLC_VECTOR_ANY_DECL
2924

30-
#endif
31-
3225
#endif // __CLC_RELATIONAL_CLC_ANY_H__

libclc/clc/include/clc/relational/clc_isequal.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISEQUAL_H__
22
#define __CLC_RELATIONAL_CLC_ISEQUAL_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible isequal
6-
#define __clc_isequal isequal
7-
#else
8-
94
#include <clc/clcfunc.h>
105
#include <clc/clctypes.h>
116

@@ -37,6 +32,4 @@ _CLC_VECTOR_ISEQUAL_DECL(half, short)
3732
#undef _CLC_ISEQUAL_DECL
3833
#undef _CLC_VECTOR_ISEQUAL_DECL
3934

40-
#endif
41-
4235
#endif // __CLC_RELATIONAL_CLC_ISEQUAL_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISFINITE_H__
22
#define __CLC_RELATIONAL_CLC_ISFINITE_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible isfinite
6-
#define __clc_isfinite isfinite
7-
#else
8-
94
#define __CLC_FUNCTION __clc_isfinite
105
#define __CLC_BODY <clc/relational/unary_decl.inc>
116

@@ -14,6 +9,4 @@
149
#undef __CLC_BODY
1510
#undef __CLC_FUNCTION
1611

17-
#endif
18-
1912
#endif // __CLC_RELATIONAL_CLC_ISFINITE_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISGREATER_H__
22
#define __CLC_RELATIONAL_CLC_ISGREATER_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible isgreater
6-
#define __clc_isgreater isgreater
7-
#else
8-
94
#define __CLC_FUNCTION __clc_isgreater
105
#define __CLC_BODY <clc/relational/binary_decl.inc>
116

@@ -14,6 +9,4 @@
149
#undef __CLC_BODY
1510
#undef __CLC_FUNCTION
1611

17-
#endif
18-
1912
#endif // __CLC_RELATIONAL_CLC_ISGREATER_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISGREATEREQUAL_H__
22
#define __CLC_RELATIONAL_CLC_ISGREATEREQUAL_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible isgreaterequal
6-
#define __clc_isgreaterequal isgreaterequal
7-
#else
8-
94
#define __CLC_FUNCTION __clc_isgreaterequal
105
#define __CLC_BODY <clc/relational/binary_decl.inc>
116

@@ -14,6 +9,4 @@
149
#undef __CLC_BODY
1510
#undef __CLC_FUNCTION
1611

17-
#endif
18-
1912
#endif // __CLC_RELATIONAL_CLC_ISGREATEREQUAL_H__

libclc/clc/include/clc/relational/clc_isinf.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISINF_H__
22
#define __CLC_RELATIONAL_CLC_ISINF_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible isinf
6-
#define __clc_isinf isinf
7-
#else
8-
94
#include <clc/clcfunc.h>
105
#include <clc/clctypes.h>
116

@@ -37,6 +32,4 @@ _CLC_VECTOR_ISINF_DECL(short, half)
3732
#undef _CLC_ISINF_DECL
3833
#undef _CLC_VECTOR_ISINF_DECL
3934

40-
#endif
41-
4235
#endif // __CLC_RELATIONAL_CLC_ISINF_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISLESS_H__
22
#define __CLC_RELATIONAL_CLC_ISLESS_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible isless
6-
#define __clc_isless isless
7-
#else
8-
94
#define __CLC_FUNCTION __clc_isless
105
#define __CLC_BODY <clc/relational/binary_decl.inc>
116

@@ -14,6 +9,4 @@
149
#undef __CLC_BODY
1510
#undef __CLC_FUNCTION
1611

17-
#endif
18-
1912
#endif // __CLC_RELATIONAL_CLC_ISLESS_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISLESSEQUAL_H__
22
#define __CLC_RELATIONAL_CLC_ISLESSEQUAL_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible islessequal
6-
#define __clc_islessequal islessequal
7-
#else
8-
94
#define __CLC_FUNCTION __clc_islessequal
105
#define __CLC_BODY <clc/relational/binary_decl.inc>
116

@@ -14,6 +9,4 @@
149
#undef __CLC_BODY
1510
#undef __CLC_FUNCTION
1611

17-
#endif
18-
1912
#endif // __CLC_RELATIONAL_CLC_ISLESSEQUAL_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISLESSGREATER_H__
22
#define __CLC_RELATIONAL_CLC_ISLESSGREATER_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible islessgreater
6-
#define __clc_islessgreater islessgreater
7-
#else
8-
94
#define __CLC_FUNCTION __clc_islessgreater
105
#define __CLC_BODY <clc/relational/binary_decl.inc>
116

@@ -14,6 +9,4 @@
149
#undef __CLC_BODY
1510
#undef __CLC_FUNCTION
1611

17-
#endif
18-
1912
#endif // __CLC_RELATIONAL_CLC_ISLESSGREATER_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISNORMAL_H__
22
#define __CLC_RELATIONAL_CLC_ISNORMAL_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible isnormal
6-
#define __clc_isnormal isnormal
7-
#else
8-
94
#define __CLC_FUNCTION __clc_isnormal
105
#define __CLC_BODY <clc/relational/unary_decl.inc>
116

@@ -14,6 +9,4 @@
149
#undef __CLC_BODY
1510
#undef __CLC_FUNCTION
1611

17-
#endif
18-
1912
#endif // __CLC_RELATIONAL_CLC_ISNORMAL_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISNOTEQUAL_H__
22
#define __CLC_RELATIONAL_CLC_ISNOTEQUAL_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible isnotequal
6-
#define __clc_isnotequal isnotequal
7-
#else
8-
94
#define __CLC_FUNCTION __clc_isnotequal
105
#define __CLC_BODY <clc/relational/binary_decl.inc>
116

@@ -14,6 +9,4 @@
149
#undef __CLC_BODY
1510
#undef __CLC_FUNCTION
1611

17-
#endif
18-
1912
#endif // __CLC_RELATIONAL_CLC_ISNOTEQUAL_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISORDERED_H__
22
#define __CLC_RELATIONAL_CLC_ISORDERED_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible isordered
6-
#define __clc_isordered isordered
7-
#else
8-
94
#define __CLC_FUNCTION __clc_isordered
105
#define __CLC_BODY <clc/relational/binary_decl.inc>
116

@@ -14,6 +9,4 @@
149
#undef __CLC_BODY
1510
#undef __CLC_FUNCTION
1611

17-
#endif
18-
1912
#endif // __CLC_RELATIONAL_CLC_ISORDERED_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_ISUNORDERED_H__
22
#define __CLC_RELATIONAL_CLC_ISUNORDERED_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible isunordered
6-
#define __clc_isunordered isunordered
7-
#else
8-
94
#define __CLC_FUNCTION __clc_isunordered
105
#define __CLC_BODY <clc/relational/binary_decl.inc>
116

@@ -14,6 +9,4 @@
149
#undef __CLC_BODY
1510
#undef __CLC_FUNCTION
1611

17-
#endif
18-
1912
#endif // __CLC_RELATIONAL_CLC_ISUNORDERED_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#ifndef __CLC_RELATIONAL_CLC_SIGNBIT_H__
22
#define __CLC_RELATIONAL_CLC_SIGNBIT_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible signbit
6-
#define __clc_signbit signbit
7-
#else
8-
94
#define __CLC_FUNCTION __clc_signbit
105
#define __CLC_BODY <clc/relational/unary_decl.inc>
116

@@ -14,6 +9,4 @@
149
#undef __CLC_BODY
1510
#undef __CLC_FUNCTION
1611

17-
#endif
18-
1912
#endif // __CLC_RELATIONAL_CLC_SIGNBIT_H__
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
#ifndef __CLC_SHARED_CLC_MAX_H__
22
#define __CLC_SHARED_CLC_MAX_H__
33

4-
#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
5-
// clspv and spir-v targets provide their own OpenCL-compatible max
6-
#define __clc_max max
7-
#else
8-
94
#define __CLC_BODY <clc/shared/clc_max.inc>
105
#include <clc/integer/gentype.inc>
116

127
#define __CLC_BODY <clc/shared/clc_max.inc>
138
#include <clc/math/gentype.inc>
149

15-
#endif
16-
1710
#endif // __CLC_SHARED_CLC_MAX_H__

0 commit comments

Comments
 (0)