Skip to content

Commit 93f1498

Browse files
authored
[SYCL] Fix build with XPTI disabled (#18269)
There were two issues: 1) Setting `UR_ENABLE_TRACING` on the command line didn't work because the SYCL code calling the FetchUR CMake files didn't use `CACHE`, also fixed two other vars with the same problem. 2) XPTI SYCL tests were built even if XPTI wasn't built, causing a build failure. Also add two errors so the problem isn't discovered in a build failure. --------- Signed-off-by: Sarnie, Nick <[email protected]>
1 parent 2b6242c commit 93f1498

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

sycl/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,12 @@ if (NOT WIN32)
359359
COMPONENT sycl-headers-extras)
360360
endif()
361361

362+
if(SYCL_ENABLE_XPTI_TRACING AND
363+
DEFINED LLVM_EXTERNAL_PROJECTS AND
364+
(NOT "xpti" IN_LIST LLVM_EXTERNAL_PROJECTS OR NOT "xptifw" IN_LIST LLVM_EXTERNAL_PROJECTS))
365+
message(FATAL_ERROR "SYCL_ENABLE_XPTI_TRACING=ON but XPTI is not going to be built")
366+
endif()
367+
362368
if (SYCL_ENABLE_XPTI_TRACING)
363369
if (MSVC)
364370
set(XPTIFW_LIBS xpti xptid xptifw xptifwd)

sycl/cmake/modules/FetchUnifiedRuntime.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ set(UR_BUILD_TESTS "${SYCL_UR_BUILD_TESTS}" CACHE BOOL "" FORCE)
2929
set(UR_BUILD_EXAMPLES "${SYCL_UR_BUILD_TESTS}" CACHE BOOL "" FORCE)
3030

3131
# Here we override the defaults to unified-runtime
32-
set(UR_BUILD_XPTI_LIBS OFF)
32+
set(UR_BUILD_XPTI_LIBS OFF CACHE BOOL "")
3333
set(UR_ENABLE_SYMBOLIZER ON CACHE BOOL "Enable symbolizer for sanitizer layer.")
34-
set(UR_ENABLE_TRACING ON)
34+
set(UR_ENABLE_TRACING ON CACHE BOOL "")
3535

3636
set(UR_EXTERNAL_DEPENDENCIES "sycl-headers" CACHE STRING
3737
"List of external CMake targets for executables/libraries to depend on" FORCE)

sycl/unittests/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ if (LLVM_ENABLE_ZSTD)
5757
endif()
5858

5959
# TODO Enable xpti tests for Windows
60-
if (NOT WIN32)
60+
if (SYCL_ENABLE_XPTI_TRACING AND NOT WIN32)
6161
add_subdirectory(xpti_trace)
6262
endif()
6363
add_subdirectory(sampler)

unified-runtime/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ else()
159159
set(UR_DPCXX_DEPS "")
160160
endif()
161161

162+
if(NOT UR_STANDALONE_BUILD AND
163+
UR_ENABLE_TRACING AND
164+
DEFINED LLVM_EXTERNAL_PROJECTS AND
165+
(NOT "xpti" IN_LIST LLVM_EXTERNAL_PROJECTS OR NOT "xptifw" IN_LIST LLVM_EXTERNAL_PROJECTS))
166+
message(FATAL_ERROR "UR_ENABLE_TRACING=ON but XPTI is not going to be built")
167+
endif()
168+
162169
if(UR_ENABLE_TRACING)
163170
add_compile_definitions(UR_ENABLE_TRACING)
164171

0 commit comments

Comments
 (0)