Skip to content

Commit 524f3ab

Browse files
committed
tmp: use zeInit
1 parent 01abcb4 commit 524f3ab

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

src/provider/provider_level_zero.c

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ typedef struct ze_memory_provider_t {
162162
} ze_memory_provider_t;
163163

164164
typedef struct ze_ops_t {
165+
ze_result_t (*zeInit)(ze_init_flags_t);
165166
ze_result_t (*zeInitDrivers)(uint32_t *, ze_driver_handle_t *,
166167
ze_init_driver_type_desc_t *);
167168
ze_result_t (*zeMemAllocHost)(ze_context_handle_t,
@@ -218,25 +219,25 @@ static umf_result_t ze2umf_result(ze_result_t result) {
218219
}
219220

220221
static umf_result_t ze_init_drivers() {
221-
ze_init_driver_type_desc_t desc = {
222-
.stype = ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC,
223-
.pNext = NULL,
224-
.flags = UINT32_MAX};
225-
uint32_t driverCount = 0;
226-
ze_result_t result = g_ze_ops.zeInitDrivers(&driverCount, NULL, &desc);
227-
if (result != ZE_RESULT_SUCCESS) {
228-
return ze2umf_result(result);
229-
}
230-
231-
assert(zeAllDrivers == NULL);
232-
zeAllDrivers =
233-
umf_ba_global_alloc(sizeof(ze_driver_handle_t) * driverCount);
234-
result = g_ze_ops.zeInitDrivers(&driverCount, zeAllDrivers, &desc);
235-
if (result != ZE_RESULT_SUCCESS) {
236-
return ze2umf_result(result);
237-
}
238-
239-
return UMF_RESULT_SUCCESS;
222+
// ze_init_driver_type_desc_t desc = {
223+
// .stype = ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC,
224+
// .pNext = NULL,
225+
// .flags = UINT32_MAX};
226+
// uint32_t driverCount = 0;
227+
// ze_result_t result = g_ze_ops.zeInitDrivers(&driverCount, NULL, &desc);
228+
// if (result != ZE_RESULT_SUCCESS) {
229+
// return ze2umf_result(result);
230+
// }
231+
232+
// assert(zeAllDrivers == NULL);
233+
// zeAllDrivers =
234+
// umf_ba_global_alloc(sizeof(ze_driver_handle_t) * driverCount);
235+
// result = g_ze_ops.zeInitDrivers(&driverCount, zeAllDrivers, &desc);
236+
// if (result != ZE_RESULT_SUCCESS) {
237+
// return ze2umf_result(result);
238+
// }
239+
240+
return ze2umf_result(g_ze_ops.zeInit(ZE_INIT_FLAG_GPU_ONLY));
240241
}
241242

242243
static void init_ze_global_state(void) {
@@ -256,6 +257,8 @@ static void init_ze_global_state(void) {
256257
return;
257258
}
258259

260+
*(void **)&g_ze_ops.zeInit =
261+
utils_get_symbol_addr(lib_handle, "zeInit", lib_name);
259262
*(void **)&g_ze_ops.zeInitDrivers =
260263
utils_get_symbol_addr(lib_handle, "zeInitDrivers", lib_name);
261264
*(void **)&g_ze_ops.zeMemAllocHost =

0 commit comments

Comments
 (0)