Skip to content

Commit f3fb858

Browse files
authored
Merge pull request #1570 from frasercrmck/dpcxx_build_flags
[CTS] Allow users to pass build flags to DPC++
2 parents 1539cbc + d3391b3 commit f3fb858

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ option(UR_BUILD_EXAMPLE_CODEGEN "Build the codegen example." OFF)
4848
option(VAL_USE_LIBBACKTRACE_BACKTRACE "enable libbacktrace validation backtrace for linux" OFF)
4949
option(UR_ENABLE_ASSERTIONS "Enable assertions for all build types" OFF)
5050
set(UR_DPCXX "" CACHE FILEPATH "Path of the DPC++ compiler executable")
51+
set(UR_DPCXX_BUILD_FLAGS "" CACHE STRING "Build flags to pass to DPC++ when compiling device programs")
5152
set(UR_SYCL_LIBRARY_DIR "" CACHE PATH
5253
"Path of the SYCL runtime library directory")
5354
set(UR_CONFORMANCE_TARGET_TRIPLES "" CACHE STRING

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ List of options provided by CMake:
140140
| UR_HIP_PLATFORM | Build HIP adapter for AMD or NVIDIA platform | AMD/NVIDIA | AMD |
141141
| UR_ENABLE_COMGR | Enable comgr lib usage | AMD/NVIDIA | AMD |
142142
| UR_DPCXX | Path of the DPC++ compiler executable to build CTS device binaries | File path | `""` |
143+
| UR_DPCXX_BUILD_FLAGS | Build flags to pass to DPC++ when compiling device programs | Space-separated options list | `""` |
143144
| UR_SYCL_LIBRARY_DIR | Path of the SYCL runtime library directory to build CTS device binaries | Directory path | `""` |
144145
| UR_HIP_ROCM_DIR | Path of the default ROCm HIP installation | Directory path | `/opt/rocm` |
145146
| UR_HIP_INCLUDE_DIR | Path of the ROCm HIP include directory | Directory path | `${UR_HIP_ROCM_DIR}/include` |

test/conformance/device_code/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ macro(add_device_binary SOURCE_FILE)
5252
set(EXTRA_ENV DYLD_FALLBACK_LIBRARY_PATH=${UR_SYCL_LIBRARY_DIR})
5353
endif()
5454
endif()
55+
56+
# Convert build flags to a regular CMake list, splitting by unquoted white
57+
# space as necessary.
58+
separate_arguments(DPCXX_BUILD_FLAGS_LIST NATIVE_COMMAND "${UR_DPCXX_BUILD_FLAGS}")
59+
5560
foreach(TRIPLE ${TARGET_TRIPLES})
5661
set(EXE_PATH "${DEVICE_BINARY_DIR}/${KERNEL_NAME}_${TRIPLE}")
5762
if(${TRIPLE} MATCHES "amd")
@@ -79,7 +84,7 @@ macro(add_device_binary SOURCE_FILE)
7984
add_custom_command(OUTPUT ${EXE_PATH}
8085
COMMAND ${UR_DPCXX} -fsycl -fsycl-targets=${TRIPLE} -fsycl-device-code-split=off
8186
${AMD_TARGET_BACKEND} ${AMD_OFFLOAD_ARCH} ${AMD_NOGPULIB}
82-
${SOURCE_FILE} -o ${EXE_PATH}
87+
${DPCXX_BUILD_FLAGS_LIST} ${SOURCE_FILE} -o ${EXE_PATH}
8388

8489
COMMAND ${CMAKE_COMMAND} -E env ${EXTRA_ENV} SYCL_DUMP_IMAGES=true
8590
${EXE_PATH} || exit 0

0 commit comments

Comments
 (0)