Skip to content

Commit b3653cd

Browse files
committed
Build for OpenCL 3.0, enable all extensions and features
1 parent 35cfd64 commit b3653cd

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

libclc/CMakeLists.txt

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -387,39 +387,21 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
387387

388388
message( STATUS " device: ${d} ( ${${d}_aliases} )" )
389389

390-
# 1.2 is Clang's default OpenCL C language standard to compile for.
391-
set( opencl_lang_std "CL1.2" )
392-
393-
if ( DARCH STREQUAL spirv )
394-
set( opencl_lang_std "CL3.0" )
390+
if ( ARCH STREQUAL spirv OR ARCH STREQUAL spirv64 )
395391
set( build_flags -O0 -finline-hint-functions -DCLC_SPIRV )
396392
set( opt_flags )
397393
set( spvflags --spirv-max-version=1.1 )
398394
set( MACRO_ARCH SPIRV32 )
399395
if( ARCH STREQUAL spirv64 )
400396
set( MACRO_ARCH SPIRV64 )
401397
endif()
402-
elseif( DARCH STREQUAL clspv )
403-
# Refer to https://github.com/google/clspv for OpenCL version.
404-
set( opencl_lang_std "CL3.0" )
398+
elseif( ARCH STREQUAL clspv OR ARCH STREQUAL clspv64 )
405399
set( build_flags "-Wno-unknown-assumption" -DCLC_CLSPV )
406400
set( opt_flags -O3 )
407401
set( MACRO_ARCH CLSPV32 )
408402
if( ARCH STREQUAL clspv64 )
409403
set( MACRO_ARCH CLSPV64 )
410404
endif()
411-
elseif( DARCH STREQUAL nvptx )
412-
# Refer to https://developer.nvidia.com/opencl for OpenCL version.
413-
set( opencl_lang_std "CL3.0" )
414-
set( build_flags )
415-
set( opt_flags -O3 )
416-
set( MACRO_ARCH ${ARCH} )
417-
elseif( DARCH STREQUAL amdgcn OR DARCH STREQUAL amdgcn-amdhsa )
418-
# Refer to https://github.com/ROCm/clr/tree/develop/opencl for OpenCL version.
419-
set( opencl_lang_std "CL2.0" )
420-
set( build_flags )
421-
set( opt_flags -O3 )
422-
set( MACRO_ARCH ${ARCH} )
423405
else()
424406
set( build_flags )
425407
set( opt_flags -O3 )
@@ -429,7 +411,9 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
429411
set( LIBCLC_ARCH_OBJFILE_DIR "${LIBCLC_OBJFILE_DIR}/${arch_suffix}" )
430412
file( MAKE_DIRECTORY ${LIBCLC_ARCH_OBJFILE_DIR} )
431413

432-
list( APPEND build_flags -cl-std=${opencl_lang_std} )
414+
# Build for OpenCL 3.0 and enable all extensions and features independently
415+
# of the target or device.
416+
list( APPEND build_flags -cl-std=CL3.0 -Xclang -cl-ext=+all )
433417

434418
string( TOUPPER "CLC_${MACRO_ARCH}" CLC_TARGET_DEFINE )
435419

0 commit comments

Comments
 (0)