@@ -10,6 +10,10 @@ set(UR_LEVEL_ZERO_LOADER_TAG "" CACHE STRING " GIT tag of the Level Loader taken
10
10
set (UR_COMPUTE_RUNTIME_REPO "" CACHE STRING "Github repo to get the compute runtime sources from" )
11
11
set (UR_COMPUTE_RUNTIME_TAG "" CACHE STRING " GIT tag of the compute runtime taken from github repo" )
12
12
13
+ # If UR_COMPUTE_RUNTIME_FETCH_REPO is set to OFF, then UR_COMPUTE_RUNTIME_REPO should be defined and
14
+ # should point to the compute runtime repo.
15
+ set (UR_COMPUTE_RUNTIME_FETCH_REPO ON CACHE BOOL "Flag to indicate wheather to fetch the compute runtime repo" )
16
+
13
17
# Copy Level Zero loader/headers locally to the build to avoid leaking their path.
14
18
set (LEVEL_ZERO_COPY_DIR ${CMAKE_CURRENT_BINARY_DIR} /level_zero_loader )
15
19
if (NOT UR_LEVEL_ZERO_LOADER_LIBRARY STREQUAL "" )
@@ -102,23 +106,45 @@ target_include_directories(LevelZeroLoader-Headers
102
106
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >"
103
107
)
104
108
105
- if (UR_COMPUTE_RUNTIME_REPO STREQUAL "" )
106
- set (UR_COMPUTE_RUNTIME_REPO "https://github.com/intel/compute-runtime.git" )
107
- endif ()
108
- if (UR_COMPUTE_RUNTIME_TAG STREQUAL "" )
109
- set (UR_COMPUTE_RUNTIME_TAG 25.05.32567.17 )
110
- endif ()
111
- include (FetchContent )
112
- # Sparse fetch only the dir with level zero headers for experimental features to avoid pulling in the entire compute-runtime.
113
- FetchContentSparse_Declare (exp-headers ${UR_COMPUTE_RUNTIME_REPO} "${UR_COMPUTE_RUNTIME_TAG} " "level_zero/include" )
114
- FetchContent_GetProperties (exp-headers )
115
- if (NOT exp-headers_POPULATED )
116
- FetchContent_Populate (exp-headers )
109
+ # Fetch only if UR_COMPUTE_RUNTIME_FETCH_REPO is set to ON.
110
+ if (UR_COMPUTE_RUNTIME_FETCH_REPO )
111
+
112
+ if (UR_COMPUTE_RUNTIME_REPO STREQUAL "" )
113
+ set (UR_COMPUTE_RUNTIME_REPO "https://github.com/intel/compute-runtime.git" )
114
+ endif ()
115
+ if (UR_COMPUTE_RUNTIME_TAG STREQUAL "" )
116
+ set (UR_COMPUTE_RUNTIME_TAG 25.05.32567.17 )
117
+ endif ()
118
+
119
+ include (FetchContent )
120
+ # Sparse fetch only the dir with level zero headers for experimental features to avoid pulling in the entire compute-runtime.
121
+ FetchContentSparse_Declare (exp-headers ${UR_COMPUTE_RUNTIME_REPO} "${UR_COMPUTE_RUNTIME_TAG} " "level_zero/include" )
122
+ FetchContent_GetProperties (exp-headers )
123
+ if (NOT exp-headers_POPULATED )
124
+ FetchContent_Populate (exp-headers )
125
+ endif ()
126
+
127
+ set (COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE "${exp-headers_SOURCE_DIR}" )
128
+ set (COMPUTE_RUNTIME_REPO_PATH "${exp-headers_SOURCE_DIR}/../.." )
129
+
130
+ # When UR_COMPUTE_RUNTIME_FETCH_REPO is OFF, use UR_COMPUTE_RUNTIME_REPO as repo.
131
+ else ()
132
+
133
+ # Check if UR_COMPUTE_RUNTIME_REPO is set. Throw if not.
134
+ if (UR_COMPUTE_RUNTIME_REPO STREQUAL "" )
135
+ message (FATAL_ERROR "UR_COMPUTE_RUNTIME_FETCH_REPO is set to OFF but UR_COMPUTE_RUNTIME_REPO is not set. Please set it to the compute runtime repo." )
136
+ endif ()
137
+
138
+ set (COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE "${UR_COMPUTE_RUNTIME_REPO} /level_zero/include" )
139
+ set (COMPUTE_RUNTIME_REPO_PATH "${UR_COMPUTE_RUNTIME_REPO} " )
117
140
endif ()
141
+
142
+ message (STATUS "Using Level Zero include headers from ${COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE} " )
143
+
118
144
add_library (ComputeRuntimeLevelZero-Headers INTERFACE )
119
- set (COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE "${exp-headers_SOURCE_DIR}/../.." )
120
145
message (STATUS "Level Zero Adapter: Using Level Zero headers from ${COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE} " )
121
146
target_include_directories (ComputeRuntimeLevelZero-Headers
122
147
INTERFACE "$<BUILD_INTERFACE:${COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE} >"
148
+ "$<BUILD_INTERFACE:${COMPUTE_RUNTIME_REPO_PATH} >"
123
149
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >"
124
150
)
0 commit comments