Skip to content

Commit 4db498a

Browse files
committed
Fix handling resident_device_handles in L0 provider
handles were being ignored in the initialize function.
1 parent 36beed3 commit 4db498a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/provider/provider_level_zero.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,25 @@ static umf_result_t ze_memory_provider_initialize(void *params,
177177
sizeof(ze_provider->device_properties));
178178
}
179179

180+
if (ze_params->resident_device_count) {
181+
ze_provider->resident_device_handles = umf_ba_global_alloc(
182+
sizeof(ze_device_handle_t) * ze_params->resident_device_count);
183+
if (!ze_provider->resident_device_handles) {
184+
umf_ba_global_free(ze_provider);
185+
return UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY;
186+
}
187+
188+
ze_provider->resident_device_count = ze_params->resident_device_count;
189+
190+
for (uint32_t i = 0; i < ze_provider->resident_device_count; i++) {
191+
ze_provider->resident_device_handles[i] =
192+
ze_params->resident_device_handles[i];
193+
}
194+
} else {
195+
ze_provider->resident_device_handles = NULL;
196+
ze_provider->resident_device_count = 0;
197+
}
198+
180199
*provider = ze_provider;
181200

182201
return UMF_RESULT_SUCCESS;
@@ -188,6 +207,9 @@ static void ze_memory_provider_finalize(void *provider) {
188207
return;
189208
}
190209

210+
ze_memory_provider_t *ze_provider = (ze_memory_provider_t *)provider;
211+
umf_ba_global_free(ze_provider->resident_device_handles);
212+
191213
umf_ba_global_free(provider);
192214
}
193215

0 commit comments

Comments
 (0)