Skip to content

Commit 34dbd09

Browse files
committed
Correction gpu
1 parent 8833786 commit 34dbd09

File tree

5 files changed

+39
-43
lines changed

5 files changed

+39
-43
lines changed

.github/workflows/gpu.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@ jobs:
1717
strategy:
1818
matrix:
1919
build_type: [Release]
20-
compiler: [{c: gcc, cxx: g++}]
2120
shared_library: ['ON', 'OFF']
2221
include:
23-
- os: 'UBUNTU'
22+
- os: 'Ubuntu'
2423
compiler: [{c: gcc, cxx: g++}]
25-
level_zero_provider: 'ON'
26-
- os: 'WINDOWS'
24+
- os: 'Windows'
2725
compiler: [{c: cl, cxx: cl}]
28-
level_zero_provider: 'ON'
2926
extra_arg: "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Administrator/repo/vpckg/scripts/buildsystems/vpckg.cmake"
3027

3128
runs-on: ["DSS-LEVEL_ZERO", "DSS-${{matrix.os}}"]
@@ -35,14 +32,13 @@ jobs:
3532
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3633

3734
- name: Get information about platform
38-
if: matrix.os == 'UBUNTU'
35+
if: matrix.os == 'Ubuntu'
3936
run: .github/scripts/get_system_info.sh
4037

4138
- name: Configure build
4239
run: >
4340
cmake
4441
-B ${{github.workspace}}/build
45-
-DCMAKE_TOOLCHAIN_FILE=${{matrix.cmake_toolchain_file}}
4642
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
4743
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
4844
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
@@ -57,8 +53,9 @@ jobs:
5753
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON
5854
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
5955
-DUMF_ENABLE_POOL_TRACKING=ON
60-
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=${{matrix.level_zero_provider}}
61-
${{extra_arg}}
56+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
57+
${{matrix.extra_arg}}
58+
6259
- name: Build UMF
6360
run: >
6461
cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j $(nproc)

src/provider/provider_level_zero.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ static UTIL_ONCE_FLAG ze_is_initialized = UTIL_ONCE_FLAG_INIT;
5757
static bool Init_ze_global_state_failed;
5858

5959
static void init_ze_global_state(void) {
60-
// check if Level Zero shared library is already loaded
61-
// we pass 0 as a handle to search the global symbol table
6260
#ifdef _WIN32
6361
const char *lib_name = "ze_loader.dll";
6462
#else
6563
const char *lib_name = "ze_loader.so";
6664
#endif
65+
// check if Level Zero shared library is already loaded
66+
// we pass 0 as a handle to search the global symbol table
6767
*(void **)&g_ze_ops.zeMemAllocHost =
6868
util_get_symbol_addr(0, "zeMemAllocHost", lib_name);
6969
*(void **)&g_ze_ops.zeMemAllocDevice =

src/utils/utils_load_library.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ static inline int util_close_library(void *handle) {
4343
}
4444

4545
static inline void *util_get_symbol_addr(void *handle, const char *symbol,
46-
const char *lib) {
46+
const char *libname) {
4747
if (handle == NULL) {
48-
if (lib == NULL) {
48+
if (libname == NULL) {
4949
return NULL;
5050
}
51-
handle = GetModuleHandle(lib);
51+
handle = GetModuleHandle(libname);
5252
}
5353
return GetProcAddress((HMODULE)handle, symbol);
5454
}
@@ -62,7 +62,8 @@ static inline void *util_open_library(const char *filename) {
6262
static inline int util_close_library(void *handle) { return dlclose(handle); }
6363

6464
static inline void *util_get_symbol_addr(void *handle, const char *symbol,
65-
const char *lib) {
65+
const char *libname) {
66+
(void)libname; //unused
6667
return dlsym(handle, symbol);
6768
}
6869

test/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,7 @@ if(LINUX) # OS-specific functions are implemented only for Linux now
181181
LIBS ${UMF_UTILS_FOR_TEST} ${LIBNUMA_LIBRARIES})
182182
endif()
183183

184-
# TODO add support for Windows
185-
if(UMF_BUILD_GPU_TESTS
186-
AND UMF_BUILD_LEVEL_ZERO_PROVIDER)
184+
if(UMF_BUILD_GPU_TESTS AND UMF_BUILD_LEVEL_ZERO_PROVIDER)
187185
# we have two test binaries here that use the same sources, but differ in
188186
# the way they are linked to the Level Zero (statically or at runtime using
189187
# dlopen)

test/providers/provider_level_zero.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
//workaround for std::numeric_limits
56
#define NOMINMAX
67
#include <ze_api.h>
78

@@ -63,70 +64,69 @@ struct umfLevelZeroProviderTest : umf_test::test {
6364

6465
#if USE_DLOPEN
6566
void InitLevelZeroOps() {
66-
// Load Level Zero symbols
6767
#ifdef _WIN32
68-
const char *lib = "ze_loader.dll";
68+
const char *lib_name = "ze_loader.dll";
6969
#else
70-
const char *lib = "ze_loader.so";
70+
const char *lib_name = "ze_loader.so";
7171
#endif
72-
//const char *lib = "ze_loader.dll";
73-
zeDlHandle = util_open_library(lib);
72+
// Load Level Zero symbols
73+
zeDlHandle = util_open_library(lib_name);
7474
*(void **)&libze_ops.zeInit =
75-
util_get_symbol_addr(zeDlHandle, "zeInit", lib);
75+
util_get_symbol_addr(zeDlHandle, "zeInit", lib_name);
7676
ASSERT_NE(libze_ops.zeInit, nullptr);
7777
*(void **)&libze_ops.zeDriverGet =
78-
util_get_symbol_addr(zeDlHandle, "zeDriverGet", lib);
78+
util_get_symbol_addr(zeDlHandle, "zeDriverGet", lib_name);
7979
ASSERT_NE(libze_ops.zeDriverGet, nullptr);
8080
*(void **)&libze_ops.zeDeviceGet =
81-
util_get_symbol_addr(zeDlHandle, "zeDeviceGet", lib);
81+
util_get_symbol_addr(zeDlHandle, "zeDeviceGet", lib_name);
8282
ASSERT_NE(libze_ops.zeDeviceGet, nullptr);
8383
*(void **)&libze_ops.zeDeviceGetProperties =
84-
util_get_symbol_addr(zeDlHandle, "zeDeviceGetProperties", lib);
84+
util_get_symbol_addr(zeDlHandle, "zeDeviceGetProperties", lib_name);
8585
ASSERT_NE(libze_ops.zeDeviceGetProperties, nullptr);
8686
*(void **)&libze_ops.zeContextCreate =
87-
util_get_symbol_addr(zeDlHandle, "zeContextCreate", lib);
87+
util_get_symbol_addr(zeDlHandle, "zeContextCreate", lib_name);
8888
ASSERT_NE(libze_ops.zeContextCreate, nullptr);
8989
*(void **)&libze_ops.zeContextDestroy =
90-
util_get_symbol_addr(zeDlHandle, "zeContextDestroy", lib);
90+
util_get_symbol_addr(zeDlHandle, "zeContextDestroy", lib_name);
9191
ASSERT_NE(libze_ops.zeContextDestroy, nullptr);
9292
*(void **)&libze_ops.zeCommandQueueCreate =
93-
util_get_symbol_addr(zeDlHandle, "zeCommandQueueCreate", lib);
93+
util_get_symbol_addr(zeDlHandle, "zeCommandQueueCreate", lib_name);
9494
ASSERT_NE(libze_ops.zeCommandQueueCreate, nullptr);
9595
*(void **)&libze_ops.zeCommandQueueDestroy =
96-
util_get_symbol_addr(zeDlHandle, "zeCommandQueueDestroy", lib);
96+
util_get_symbol_addr(zeDlHandle, "zeCommandQueueDestroy", lib_name);
9797
ASSERT_NE(libze_ops.zeCommandQueueDestroy, nullptr);
9898
*(void **)&libze_ops.zeCommandQueueExecuteCommandLists =
9999
util_get_symbol_addr(zeDlHandle,
100-
"zeCommandQueueExecuteCommandLists", lib);
100+
"zeCommandQueueExecuteCommandLists", lib_name);
101101
ASSERT_NE(libze_ops.zeCommandQueueExecuteCommandLists, nullptr);
102-
*(void **)&libze_ops.zeCommandQueueSynchronize =
103-
util_get_symbol_addr(zeDlHandle, "zeCommandQueueSynchronize", lib);
102+
*(void **)&libze_ops.zeCommandQueueSynchronize = util_get_symbol_addr(
103+
zeDlHandle, "zeCommandQueueSynchronize", lib_name);
104104
ASSERT_NE(libze_ops.zeCommandQueueSynchronize, nullptr);
105105
*(void **)&libze_ops.zeCommandListCreate =
106-
util_get_symbol_addr(zeDlHandle, "zeCommandListCreate", lib);
106+
util_get_symbol_addr(zeDlHandle, "zeCommandListCreate", lib_name);
107107
ASSERT_NE(libze_ops.zeCommandListCreate, nullptr);
108108
*(void **)&libze_ops.zeCommandListDestroy =
109-
util_get_symbol_addr(zeDlHandle, "zeCommandListDestroy", lib);
109+
util_get_symbol_addr(zeDlHandle, "zeCommandListDestroy", lib_name);
110110
ASSERT_NE(libze_ops.zeCommandListDestroy, nullptr);
111111
*(void **)&libze_ops.zeCommandListClose =
112-
util_get_symbol_addr(zeDlHandle, "zeCommandListClose", lib);
112+
util_get_symbol_addr(zeDlHandle, "zeCommandListClose", lib_name);
113113
ASSERT_NE(libze_ops.zeCommandListClose, nullptr);
114114
*(void **)&libze_ops.zeCommandListAppendMemoryCopy =
115115
util_get_symbol_addr(zeDlHandle, "zeCommandListAppendMemoryCopy",
116-
lib);
116+
lib_name);
117117
ASSERT_NE(libze_ops.zeCommandListAppendMemoryCopy, nullptr);
118118
*(void **)&libze_ops.zeCommandListAppendMemoryFill =
119119
util_get_symbol_addr(zeDlHandle, "zeCommandListAppendMemoryFill",
120-
lib);
120+
lib_name);
121121
ASSERT_NE(libze_ops.zeCommandListAppendMemoryFill, nullptr);
122-
*(void **)&libze_ops.zeMemGetAllocProperties =
123-
util_get_symbol_addr(zeDlHandle, "zeMemGetAllocProperties", lib);
122+
*(void **)&libze_ops.zeMemGetAllocProperties = util_get_symbol_addr(
123+
zeDlHandle, "zeMemGetAllocProperties", lib_name);
124124
ASSERT_NE(libze_ops.zeMemGetAllocProperties, nullptr);
125125
*(void **)&libze_ops.zeMemAllocDevice =
126-
util_get_symbol_addr(zeDlHandle, "zeMemAllocDevice", lib);
126+
util_get_symbol_addr(zeDlHandle, "zeMemAllocDevice", lib_name);
127127
ASSERT_NE(libze_ops.zeMemAllocDevice, nullptr);
128128
*(void **)&libze_ops.zeMemFree =
129-
util_get_symbol_addr(zeDlHandle, "zeMemFree", lib);
129+
util_get_symbol_addr(zeDlHandle, "zeMemFree", lib_name);
130130
ASSERT_NE(libze_ops.zeMemFree, nullptr);
131131
}
132132

0 commit comments

Comments
 (0)