Skip to content

Commit ad4a2ac

Browse files
authored
Follow up fixes after enabling LIT for Level Zero (#1876)
Follow up fixes after enabling LIT for Level Zero * Fix return values in lit.cfg.py * Fix CMake file for get_device_count_by_type tool for the case when local Level Zero lib and headers are provided. Signed-off-by: Artur Gainullin <[email protected]>
1 parent ed2846f commit ad4a2ac

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

sycl/plugins/level_zero/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,16 @@ if (NOT DEFINED L0_LIBRARY OR NOT DEFINED L0_INCLUDE_DIR)
4646
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS l0-loader)
4747
else()
4848
include_directories("${L0_INCLUDE_DIR}")
49+
add_custom_target(l0-loader
50+
DEPENDS ${L0_LIBRARY} COMMENT "Using provided L0 Loader")
4951
endif()
5052

53+
add_library (L0Loader-Headers INTERFACE)
54+
add_library (L0Loader::Headers ALIAS L0Loader-Headers)
55+
target_include_directories(L0Loader-Headers
56+
INTERFACE "${L0_INCLUDE_DIR}"
57+
)
58+
5159
include_directories("${sycl_inc_dir}")
5260
include_directories(${OPENCL_INCLUDE})
5361

sycl/test/lit.cfg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def getDeviceCount(device_type):
9090
if exit_code != 0:
9191
lit_config.error("getDeviceCount {TYPE} {BACKEND}: Non-zero exit code {CODE}".format(
9292
TYPE=device_type, BACKEND=backend, CODE=exit_code))
93-
return [0,False]
93+
return [0,False,False]
9494

9595
result = output.decode().replace('\n', '').split(':', 1)
9696
try:

sycl/tools/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ add_subdirectory(sycl-ls)
88
add_executable(get_device_count_by_type get_device_count_by_type.cpp)
99
add_dependencies(get_device_count_by_type ocl-headers ocl-icd l0-loader)
1010

11-
if(MSVC)
12-
set(L0_LIBRARY
11+
if (NOT DEFINED L0_LIBRARY)
12+
if(MSVC)
13+
set(L0_LIBRARY
1314
"${LLVM_LIBRARY_OUTPUT_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ze_loader${CMAKE_STATIC_LIBRARY_SUFFIX}")
14-
else()
15-
set(L0_LIBRARY
15+
else()
16+
set(L0_LIBRARY
1617
"${LLVM_LIBRARY_OUTPUT_INTDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}ze_loader${CMAKE_SHARED_LIBRARY_SUFFIX}")
18+
endif()
1719
endif()
1820

1921
target_link_libraries(get_device_count_by_type
2022
PRIVATE
2123
OpenCL::Headers
24+
L0Loader::Headers
2225
${OpenCL_LIBRARIES}
2326
${L0_LIBRARY}
2427
$<$<BOOL:${SYCL_BUILD_PI_CUDA}>:cudadrv>

0 commit comments

Comments
 (0)