Skip to content

Commit f607b03

Browse files
Merge pull request #872 from vinser52/svinogra_fix_l0
Fix Level Zero related CMake configs
2 parents 5b7ca1c + 17d7654 commit f607b03

File tree

3 files changed

+58
-67
lines changed

3 files changed

+58
-67
lines changed

CMakeLists.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,64 @@ if(hwloc_targ_SOURCE_DIR)
218218
endif()
219219
endif()
220220

221+
# Fetch L0 loader only if needed i.e.: if building L0 provider is ON and L0
222+
# headers are not provided by the user (via setting UMF_LEVEL_ZERO_INCLUDE_DIR).
223+
if(UMF_BUILD_LEVEL_ZERO_PROVIDER AND (NOT UMF_LEVEL_ZERO_INCLUDE_DIR))
224+
include(FetchContent)
225+
226+
set(LEVEL_ZERO_LOADER_REPO "https://github.com/oneapi-src/level-zero.git")
227+
set(LEVEL_ZERO_LOADER_TAG v1.17.39)
228+
229+
message(
230+
STATUS
231+
"Fetching L0 loader (${LEVEL_ZERO_LOADER_TAG}) from ${LEVEL_ZERO_LOADER_REPO} ..."
232+
)
233+
234+
FetchContent_Declare(
235+
level-zero-loader
236+
GIT_REPOSITORY ${LEVEL_ZERO_LOADER_REPO}
237+
GIT_TAG ${LEVEL_ZERO_LOADER_TAG}
238+
EXCLUDE_FROM_ALL)
239+
FetchContent_MakeAvailable(level-zero-loader)
240+
241+
set(LEVEL_ZERO_INCLUDE_DIRS
242+
${level-zero-loader_SOURCE_DIR}/include
243+
CACHE PATH "Path to Level Zero Headers")
244+
message(STATUS "Level Zero include directory: ${LEVEL_ZERO_INCLUDE_DIRS}")
245+
elseif(UMF_BUILD_LEVEL_ZERO_PROVIDER)
246+
# Only header is needed to build UMF
247+
set(LEVEL_ZERO_INCLUDE_DIRS ${UMF_LEVEL_ZERO_INCLUDE_DIR})
248+
message(STATUS "Level Zero include directory: ${LEVEL_ZERO_INCLUDE_DIRS}")
249+
endif()
250+
251+
# Fetch CUDA only if needed i.e.: if building CUDA provider is ON and CUDA
252+
# headers are not provided by the user (via setting UMF_CUDA_INCLUDE_DIR).
253+
if(UMF_BUILD_CUDA_PROVIDER AND (NOT UMF_CUDA_INCLUDE_DIR))
254+
include(FetchContent)
255+
256+
set(CUDA_REPO
257+
"https://gitlab.com/nvidia/headers/cuda-individual/cudart.git")
258+
set(CUDA_TAG cuda-12.5.1)
259+
260+
message(STATUS "Fetching CUDA ${CUDA_TAG} from ${CUDA_REPO} ...")
261+
262+
FetchContent_Declare(
263+
cuda-headers
264+
GIT_REPOSITORY ${CUDA_REPO}
265+
GIT_TAG ${CUDA_TAG}
266+
EXCLUDE_FROM_ALL)
267+
FetchContent_MakeAvailable(cuda-headers)
268+
269+
set(CUDA_INCLUDE_DIRS
270+
${cuda-headers_SOURCE_DIR}
271+
CACHE PATH "Path to CUDA headers")
272+
message(STATUS "CUDA include directory: ${CUDA_INCLUDE_DIRS}")
273+
elseif(UMF_BUILD_CUDA_PROVIDER)
274+
# Only header is needed to build UMF
275+
set(CUDA_INCLUDE_DIRS ${UMF_CUDA_INCLUDE_DIR})
276+
message(STATUS "CUDA include directory: ${CUDA_INCLUDE_DIRS}")
277+
endif()
278+
221279
# This build type check is not possible on Windows when CMAKE_BUILD_TYPE is not
222280
# set, because in this case the build type is determined after a CMake
223281
# configuration is done (at the build time)

src/CMakeLists.txt

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -16,64 +16,6 @@ set(UMF_CUDA_INCLUDE_DIR
1616
# TODO: Cleanup the compile definitions across all the CMake files
1717
set(UMF_COMMON_COMPILE_DEFINITIONS UMF_VERSION=${UMF_VERSION})
1818

19-
# Fetch L0 loader only if needed i.e.: if building L0 provider is ON and L0
20-
# headers are not provided by the user (via setting UMF_LEVEL_ZERO_INCLUDE_DIR).
21-
if(UMF_BUILD_LEVEL_ZERO_PROVIDER AND (NOT UMF_LEVEL_ZERO_INCLUDE_DIR))
22-
include(FetchContent)
23-
24-
set(LEVEL_ZERO_LOADER_REPO "https://github.com/oneapi-src/level-zero.git")
25-
set(LEVEL_ZERO_LOADER_TAG v1.17.39)
26-
27-
message(
28-
STATUS
29-
"Fetching L0 loader (${LEVEL_ZERO_LOADER_TAG}) from ${LEVEL_ZERO_LOADER_REPO} ..."
30-
)
31-
32-
FetchContent_Declare(
33-
level-zero-loader
34-
GIT_REPOSITORY ${LEVEL_ZERO_LOADER_REPO}
35-
GIT_TAG ${LEVEL_ZERO_LOADER_TAG}
36-
EXCLUDE_FROM_ALL)
37-
FetchContent_MakeAvailable(level-zero-loader)
38-
39-
set(LEVEL_ZERO_INCLUDE_DIRS
40-
${level-zero-loader_SOURCE_DIR}/include
41-
CACHE PATH "Path to Level Zero Headers")
42-
message(STATUS "Level Zero include directory: ${LEVEL_ZERO_INCLUDE_DIRS}")
43-
elseif(UMF_BUILD_LEVEL_ZERO_PROVIDER)
44-
# Only header is needed to build UMF
45-
set(LEVEL_ZERO_INCLUDE_DIRS ${UMF_LEVEL_ZERO_INCLUDE_DIR})
46-
message(STATUS "Level Zero include directory: ${LEVEL_ZERO_INCLUDE_DIRS}")
47-
endif()
48-
49-
# Fetch CUDA only if needed i.e.: if building CUDA provider is ON and CUDA
50-
# headers are not provided by the user (via setting UMF_CUDA_INCLUDE_DIR).
51-
if(UMF_BUILD_CUDA_PROVIDER AND (NOT UMF_CUDA_INCLUDE_DIR))
52-
include(FetchContent)
53-
54-
set(CUDA_REPO
55-
"https://gitlab.com/nvidia/headers/cuda-individual/cudart.git")
56-
set(CUDA_TAG cuda-12.5.1)
57-
58-
message(STATUS "Fetching CUDA ${CUDA_TAG} from ${CUDA_REPO} ...")
59-
60-
FetchContent_Declare(
61-
cuda-headers
62-
GIT_REPOSITORY ${CUDA_REPO}
63-
GIT_TAG ${CUDA_TAG}
64-
EXCLUDE_FROM_ALL)
65-
FetchContent_MakeAvailable(cuda-headers)
66-
67-
set(CUDA_INCLUDE_DIRS
68-
${cuda-headers_SOURCE_DIR}
69-
CACHE PATH "Path to CUDA headers")
70-
message(STATUS "CUDA include directory: ${CUDA_INCLUDE_DIRS}")
71-
elseif(UMF_BUILD_CUDA_PROVIDER)
72-
# Only header is needed to build UMF
73-
set(CUDA_INCLUDE_DIRS ${UMF_CUDA_INCLUDE_DIR})
74-
message(STATUS "CUDA include directory: ${CUDA_INCLUDE_DIRS}")
75-
endif()
76-
7719
add_subdirectory(utils)
7820

7921
set(UMF_LIBS $<BUILD_INTERFACE:umf_utils>)

test/providers/provider_level_zero.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,6 @@ TEST_P(umfLevelZeroProviderTest, allocInvalidSize) {
263263
umfMemoryProviderGetLastNativeError(provider, &message, &error);
264264
ASSERT_EQ(error, ZE_RESULT_ERROR_UNSUPPORTED_SIZE);
265265

266-
// in case of size == 0 we should got INVALID_ARGUMENT error
267-
// NOTE: this is invalid only for the DEVICE or SHARED allocations
268-
if (params.memory_type != UMF_MEMORY_TYPE_HOST) {
269-
umf_result = umfMemoryProviderAlloc(provider, 0, 0, &ptr);
270-
ASSERT_EQ(umf_result, UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC);
271-
umfMemoryProviderGetLastNativeError(provider, &message, &error);
272-
ASSERT_EQ(error, ZE_RESULT_ERROR_UNSUPPORTED_SIZE);
273-
}
274-
275266
umfMemoryProviderDestroy(provider);
276267
}
277268

0 commit comments

Comments
 (0)