@@ -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)
@@ -92,3 +94,24 @@ target_include_directories(LevelZeroLoader-Headers
9294 INTERFACE "$<BUILD_INTERFACE:${LEVEL_ZERO_INCLUDE_DIR} >"
9395 "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >"
9496)
97+
98+ if (UR_COMPUTE_RUNTIME_REPO STREQUAL "" )
99+ set (UR_COMPUTE_RUNTIME_REPO "https://github.com/intel/compute-runtime.git" )
100+ endif ()
101+ if (UR_COMPUTE_RUNTIME_TAG STREQUAL "" )
102+ set (UR_COMPUTE_RUNTIME_TAG 24.39.31294.12)
103+ endif ()
104+ include (FetchContent)
105+ # Sparse fetch only the dir with level zero headers to avoid pulling in the entire compute-runtime.
106+ FetchContentSparse_Declare(compute-runtime-level-zero-headers ${UR_COMPUTE_RUNTIME_REPO} "${UR_COMPUTE_RUNTIME_TAG} " "level_zero/include" )
107+ FetchContent_GetProperties(compute-runtime-level-zero-headers)
108+ if (NOT compute-runtime-level-zero-headers_POPULATED)
109+ FetchContent_Populate(compute-runtime-level-zero-headers)
110+ endif ()
111+ add_library (ComputeRuntimeLevelZero-Headers INTERFACE )
112+ set (COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE "${compute-runtime-level-zero-headers_SOURCE_DIR}/../.." )
113+ message (STATUS "Level Zero Adapter: Using Level Zero headers from ${COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE} " )
114+ target_include_directories (ComputeRuntimeLevelZero-Headers
115+ INTERFACE "$<BUILD_INTERFACE:${COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE} >"
116+ "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >"
117+ )
0 commit comments