@@ -7,6 +7,8 @@ set(UR_LEVEL_ZERO_LOADER_LIBRARY "" CACHE FILEPATH "Path of the Level Zero Loade
77set (UR_LEVEL_ZERO_INCLUDE_DIR "" CACHE FILEPATH "Directory containing the Level Zero Headers" )
88set (UR_LEVEL_ZERO_LOADER_REPO "" CACHE STRING "Github repo to get the Level Zero loader sources from" )
99set (UR_LEVEL_ZERO_LOADER_TAG "" CACHE STRING " GIT tag of the Level Loader taken from github repo" )
10+ set (UR_COMPUTE_RUNTIME_REPO "" CACHE STRING "Github repo to get the compute runtime sources from" )
11+ set (UR_COMPUTE_RUNTIME_TAG "" CACHE STRING " GIT tag of the compute runtime taken from github repo" )
1012
1113# Copy Level Zero loader/headers locally to the build to avoid leaking their path.
1214set (LEVEL_ZERO_COPY_DIR ${CMAKE_CURRENT_BINARY_DIR} /level_zero_loader)
@@ -40,7 +42,7 @@ if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR)
4042 set (UR_LEVEL_ZERO_LOADER_REPO "https://github.com/oneapi-src/level-zero.git" )
4143 endif ()
4244 if (UR_LEVEL_ZERO_LOADER_TAG STREQUAL "" )
43- set (UR_LEVEL_ZERO_LOADER_TAG v1.18.5 )
45+ set (UR_LEVEL_ZERO_LOADER_TAG v1.19.2 )
4446 endif ()
4547
4648 # Disable due to a bug https://github.com/oneapi-src/level-zero/issues/104
@@ -87,8 +89,31 @@ target_link_libraries(LevelZeroLoader
8789 INTERFACE "${LEVEL_ZERO_LIB_NAME} "
8890)
8991
92+ file (GLOB LEVEL_ZERO_LOADER_API_HEADERS "${LEVEL_ZERO_INCLUDE_DIR} /*.h" )
93+ file (COPY ${LEVEL_ZERO_LOADER_API_HEADERS} DESTINATION ${LEVEL_ZERO_INCLUDE_DIR} /level_zero)
9094add_library (LevelZeroLoader-Headers INTERFACE )
9195target_include_directories (LevelZeroLoader-Headers
92- INTERFACE "$<BUILD_INTERFACE:${LEVEL_ZERO_INCLUDE_DIR} >"
96+ INTERFACE "$<BUILD_INTERFACE:${LEVEL_ZERO_INCLUDE_DIR} ;${LEVEL_ZERO_INCLUDE_DIR} /level_zero>"
97+ "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >"
98+ )
99+
100+ if (UR_COMPUTE_RUNTIME_REPO STREQUAL "" )
101+ set (UR_COMPUTE_RUNTIME_REPO "https://github.com/intel/compute-runtime.git" )
102+ endif ()
103+ if (UR_COMPUTE_RUNTIME_TAG STREQUAL "" )
104+ set (UR_COMPUTE_RUNTIME_TAG 24.39.31294.12)
105+ endif ()
106+ include (FetchContent)
107+ # Sparse fetch only the dir with level zero headers to avoid pulling in the entire compute-runtime.
108+ FetchContentSparse_Declare(compute-runtime-level-zero-headers ${UR_COMPUTE_RUNTIME_REPO} "${UR_COMPUTE_RUNTIME_TAG} " "level_zero/include" )
109+ FetchContent_GetProperties(compute-runtime-level-zero-headers)
110+ if (NOT compute-runtime-level-zero-headers_POPULATED)
111+ FetchContent_Populate(compute-runtime-level-zero-headers)
112+ endif ()
113+ add_library (ComputeRuntimeLevelZero-Headers INTERFACE )
114+ set (COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE "${compute-runtime-level-zero-headers_SOURCE_DIR}/../.." )
115+ message (STATUS "Level Zero Adapter: Using Level Zero headers from ${COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE} " )
116+ target_include_directories (ComputeRuntimeLevelZero-Headers
117+ INTERFACE "$<BUILD_INTERFACE:${COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE} >"
93118 "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >"
94119)
0 commit comments