Skip to content

[libclc] Have all targets build all CLC functions #124779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions libclc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
spirv64/lib/SOURCES;
# CLC internal libraries
clc/lib/generic/SOURCES;
clc/lib/clspv/SOURCES;
clc/lib/clspv64/SOURCES;
clc/lib/spirv/SOURCES;
clc/lib/spirv64/SOURCES;
)

set( LIBCLC_MIN_LLVM 3.9.0 )
Expand Down Expand Up @@ -266,15 +262,15 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
list( GET TRIPLE 1 VENDOR )
list( GET TRIPLE 2 OS )

set( dirs )
set( opencl_dirs )

if ( NOT ${ARCH} STREQUAL spirv AND NOT ${ARCH} STREQUAL spirv64 AND
NOT ${ARCH} STREQUAL clspv AND NOT ${ARCH} STREQUAL clspv64)
LIST( APPEND dirs generic )
LIST( APPEND opencl_dirs generic )
endif()

if( ${ARCH} STREQUAL r600 OR ${ARCH} STREQUAL amdgcn )
list( APPEND dirs amdgpu )
list( APPEND opencl_dirs amdgpu )
endif()

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

set( clc_lib_files )
set( clc_dirs ${dirs} generic )

libclc_configure_lib_source(
clc_lib_files
CLC_INTERNAL
LIB_ROOT_DIR clc
DIRS ${dirs} ${DARCH} ${DARCH}-${OS} ${DARCH}-${VENDOR}-${OS}
DIRS ${clc_dirs} ${DARCH} ${DARCH}-${OS} ${DARCH}-${VENDOR}-${OS}
)

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

libclc_configure_lib_source(
opencl_lib_files
DIRS ${dirs} ${DARCH} ${DARCH}-${OS} ${DARCH}-${VENDOR}-${OS}
DIRS ${opencl_dirs} ${DARCH} ${DARCH}-${OS} ${DARCH}-${VENDOR}-${OS}
)

foreach( d ${${t}_devices} )
Expand Down
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/integer/clc_abs.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
#ifndef __CLC_INTEGER_CLC_ABS_H__
#define __CLC_INTEGER_CLC_ABS_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible abs
#define __clc_abs abs
#else

#define __CLC_BODY <clc/integer/clc_abs.inc>
#include <clc/integer/gentype.inc>

#endif

#endif // __CLC_INTEGER_CLC_ABS_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/integer/clc_abs_diff.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
#ifndef __CLC_INTEGER_CLC_ABS_DIFF_H__
#define __CLC_INTEGER_CLC_ABS_DIFF_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible abs_diff
#define __clc_abs_diff abs_diff
#else

#define __CLC_BODY <clc/integer/clc_abs_diff.inc>
#include <clc/integer/gentype.inc>

#endif

#endif // __CLC_INTEGER_CLC_ABS_DIFF_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_all.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ALL_H__
#define __CLC_RELATIONAL_CLC_ALL_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible all
#define __clc_all all
#else

#include <clc/clcfunc.h>
#include <clc/clctypes.h>

Expand All @@ -27,6 +22,4 @@ _CLC_VECTOR_ALL_DECL(long)
#undef _CLC_ALL_DECL
#undef _CLC_VECTOR_ALL_DECL

#endif

#endif // __CLC_RELATIONAL_CLC_ALL_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_any.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ANY_H__
#define __CLC_RELATIONAL_CLC_ANY_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible any
#define __clc_any any
#else

#include <clc/clcfunc.h>
#include <clc/clctypes.h>

Expand All @@ -27,6 +22,4 @@ _CLC_VECTOR_ANY_DECL(long)
#undef _CLC_ANY_DECL
#undef _CLC_VECTOR_ANY_DECL

#endif

#endif // __CLC_RELATIONAL_CLC_ANY_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_isequal.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISEQUAL_H__
#define __CLC_RELATIONAL_CLC_ISEQUAL_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible isequal
#define __clc_isequal isequal
#else

#include <clc/clcfunc.h>
#include <clc/clctypes.h>

Expand Down Expand Up @@ -37,6 +32,4 @@ _CLC_VECTOR_ISEQUAL_DECL(half, short)
#undef _CLC_ISEQUAL_DECL
#undef _CLC_VECTOR_ISEQUAL_DECL

#endif

#endif // __CLC_RELATIONAL_CLC_ISEQUAL_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_isfinite.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISFINITE_H__
#define __CLC_RELATIONAL_CLC_ISFINITE_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible isfinite
#define __clc_isfinite isfinite
#else

#define __CLC_FUNCTION __clc_isfinite
#define __CLC_BODY <clc/relational/unary_decl.inc>

Expand All @@ -14,6 +9,4 @@
#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif

#endif // __CLC_RELATIONAL_CLC_ISFINITE_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_isgreater.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISGREATER_H__
#define __CLC_RELATIONAL_CLC_ISGREATER_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible isgreater
#define __clc_isgreater isgreater
#else

#define __CLC_FUNCTION __clc_isgreater
#define __CLC_BODY <clc/relational/binary_decl.inc>

Expand All @@ -14,6 +9,4 @@
#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif

#endif // __CLC_RELATIONAL_CLC_ISGREATER_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_isgreaterequal.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISGREATEREQUAL_H__
#define __CLC_RELATIONAL_CLC_ISGREATEREQUAL_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible isgreaterequal
#define __clc_isgreaterequal isgreaterequal
#else

#define __CLC_FUNCTION __clc_isgreaterequal
#define __CLC_BODY <clc/relational/binary_decl.inc>

Expand All @@ -14,6 +9,4 @@
#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif

#endif // __CLC_RELATIONAL_CLC_ISGREATEREQUAL_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_isinf.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISINF_H__
#define __CLC_RELATIONAL_CLC_ISINF_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible isinf
#define __clc_isinf isinf
#else

#include <clc/clcfunc.h>
#include <clc/clctypes.h>

Expand Down Expand Up @@ -37,6 +32,4 @@ _CLC_VECTOR_ISINF_DECL(short, half)
#undef _CLC_ISINF_DECL
#undef _CLC_VECTOR_ISINF_DECL

#endif

#endif // __CLC_RELATIONAL_CLC_ISINF_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_isless.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISLESS_H__
#define __CLC_RELATIONAL_CLC_ISLESS_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible isless
#define __clc_isless isless
#else

#define __CLC_FUNCTION __clc_isless
#define __CLC_BODY <clc/relational/binary_decl.inc>

Expand All @@ -14,6 +9,4 @@
#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif

#endif // __CLC_RELATIONAL_CLC_ISLESS_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_islessequal.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISLESSEQUAL_H__
#define __CLC_RELATIONAL_CLC_ISLESSEQUAL_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible islessequal
#define __clc_islessequal islessequal
#else

#define __CLC_FUNCTION __clc_islessequal
#define __CLC_BODY <clc/relational/binary_decl.inc>

Expand All @@ -14,6 +9,4 @@
#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif

#endif // __CLC_RELATIONAL_CLC_ISLESSEQUAL_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_islessgreater.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISLESSGREATER_H__
#define __CLC_RELATIONAL_CLC_ISLESSGREATER_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible islessgreater
#define __clc_islessgreater islessgreater
#else

#define __CLC_FUNCTION __clc_islessgreater
#define __CLC_BODY <clc/relational/binary_decl.inc>

Expand All @@ -14,6 +9,4 @@
#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif

#endif // __CLC_RELATIONAL_CLC_ISLESSGREATER_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_isnormal.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISNORMAL_H__
#define __CLC_RELATIONAL_CLC_ISNORMAL_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible isnormal
#define __clc_isnormal isnormal
#else

#define __CLC_FUNCTION __clc_isnormal
#define __CLC_BODY <clc/relational/unary_decl.inc>

Expand All @@ -14,6 +9,4 @@
#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif

#endif // __CLC_RELATIONAL_CLC_ISNORMAL_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_isnotequal.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISNOTEQUAL_H__
#define __CLC_RELATIONAL_CLC_ISNOTEQUAL_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible isnotequal
#define __clc_isnotequal isnotequal
#else

#define __CLC_FUNCTION __clc_isnotequal
#define __CLC_BODY <clc/relational/binary_decl.inc>

Expand All @@ -14,6 +9,4 @@
#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif

#endif // __CLC_RELATIONAL_CLC_ISNOTEQUAL_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_isordered.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISORDERED_H__
#define __CLC_RELATIONAL_CLC_ISORDERED_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible isordered
#define __clc_isordered isordered
#else

#define __CLC_FUNCTION __clc_isordered
#define __CLC_BODY <clc/relational/binary_decl.inc>

Expand All @@ -14,6 +9,4 @@
#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif

#endif // __CLC_RELATIONAL_CLC_ISORDERED_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_isunordered.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_ISUNORDERED_H__
#define __CLC_RELATIONAL_CLC_ISUNORDERED_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible isunordered
#define __clc_isunordered isunordered
#else

#define __CLC_FUNCTION __clc_isunordered
#define __CLC_BODY <clc/relational/binary_decl.inc>

Expand All @@ -14,6 +9,4 @@
#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif

#endif // __CLC_RELATIONAL_CLC_ISUNORDERED_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/relational/clc_signbit.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef __CLC_RELATIONAL_CLC_SIGNBIT_H__
#define __CLC_RELATIONAL_CLC_SIGNBIT_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible signbit
#define __clc_signbit signbit
#else

#define __CLC_FUNCTION __clc_signbit
#define __CLC_BODY <clc/relational/unary_decl.inc>

Expand All @@ -14,6 +9,4 @@
#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif

#endif // __CLC_RELATIONAL_CLC_SIGNBIT_H__
7 changes: 0 additions & 7 deletions libclc/clc/include/clc/shared/clc_max.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
#ifndef __CLC_SHARED_CLC_MAX_H__
#define __CLC_SHARED_CLC_MAX_H__

#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
// clspv and spir-v targets provide their own OpenCL-compatible max
#define __clc_max max
#else

#define __CLC_BODY <clc/shared/clc_max.inc>
#include <clc/integer/gentype.inc>

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

#endif

#endif // __CLC_SHARED_CLC_MAX_H__
Loading