Skip to content

Commit a9d24ec

Browse files
committed
GPU OpenCL: Improve compiler command line arguments
1 parent c4bc9f4 commit a9d24ec

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

GPU/Common/GPUCommonMath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ GPUdi() T GPUCommonMath::MaxWithRef(T x, T y, T z, T w, S refX, S refY, S refZ,
399399

400400
GPUdi() float GPUCommonMath::InvSqrt(float _x)
401401
{
402-
#ifdef GPUCA_NO_FAST_MATH
402+
#if defined(GPUCA_NO_FAST_MATH) || defined(__OPENCL__)
403403
return 1.f / Sqrt(_x);
404404
#elif defined(__CUDACC__) || defined(__HIPCC__)
405405
return __frsqrt_rn(_x);

GPU/GPUTracking/Base/opencl2/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ endif()
2323
set(CL_SRC ${GPUDIR}/Base/opencl-common/GPUReconstructionOCL.cl)
2424
set(CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCL2Code)
2525

26-
set(OCL_FLAGS -ferror-limit=1000 -Dcl_clang_storage_class_specifiers -Wno-invalid-constexpr -Wno-unused-command-line-argument -cl-std=CLC++2021)
26+
set(OCL_FLAGS -Dcl_clang_storage_class_specifiers -cl-std=CLC++2021)
2727
if(NOT DEFINED GPUCA_NO_FAST_MATH OR NOT ${GPUCA_NO_FAST_MATH})
28-
set(OCL_FLAGS ${OCL_FLAGS} -Xclang -fdenormal-fp-math-f32=ieee -cl-mad-enable -cl-no-signed-zeros)
28+
set(OCL_FLAGS ${OCL_FLAGS} -cl-denorms-are-zero -cl-mad-enable -cl-no-signed-zeros -cl-fast-relaxed-math)
29+
else()
30+
set(OCL_FLAGS ${OCL_FLAGS} -cl-fp32-correctly-rounded-divide-sqrt)
2931
endif()
3032
set(OCL_DEFINECL "-D$<JOIN:$<TARGET_PROPERTY:O2::GPUTracking,COMPILE_DEFINITIONS>,$<SEMICOLON>-D>"
3133
"-I$<JOIN:$<FILTER:$<TARGET_PROPERTY:O2::GPUTracking,INCLUDE_DIRECTORIES>,EXCLUDE,^/usr/include/?>,$<SEMICOLON>-I>"
@@ -47,6 +49,7 @@ if(OPENCL2_ENABLED_SPIRV) # BUILD OpenCL2 intermediate code for SPIR-V target
4749
-O0
4850
--target=spirv64
4951
-fno-integrated-objemitter
52+
-ferror-limit=1000 -Wno-invalid-constexpr -Wno-unused-command-line-argument
5053
${OCL_FLAGS}
5154
${OCL_DEFINECL}
5255
-o ${CL_BIN}.spirv -c ${CL_SRC}
@@ -64,6 +67,7 @@ if(OPENCL2_ENABLED) # BUILD OpenCL2 source code for runtime compilation target
6467
add_custom_command(
6568
OUTPUT ${CL_BIN}.src
6669
COMMAND ${LLVM_CLANG}
70+
-Wno-unused-command-line-argument
6771
${OCL_FLAGS}
6872
${OCL_DEFINECL}
6973
-cl-no-stdinc

0 commit comments

Comments
 (0)