Skip to content

Commit f90d2b4

Browse files
[SYCL] Remove use of potentially invalid parameter from aspect queries (#7393)
Select device aspect queries were using an output type for extension device queries that did not match the output type of the corresponding info query. This commit changes these to not specify the size of the output but instead base the aspect checks on whether the backend is able to return a size of the output. Fixes #7011. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent a3e93e0 commit f90d2b4

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

sycl/source/detail/device_impl.cpp

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ pi_native_handle device_impl::getNative() const {
261261

262262
bool device_impl::has(aspect Aspect) const {
263263
size_t return_size = 0;
264-
pi_device_type device_type;
265264

266265
switch (Aspect) {
267266
case aspect::host:
@@ -319,44 +318,39 @@ bool device_impl::has(aspect Aspect) const {
319318
return get_info<info::device::usm_system_allocations>();
320319
case aspect::ext_intel_device_id:
321320
return getPlugin().call_nocheck<detail::PiApiKind::piDeviceGetInfo>(
322-
MDevice, PI_DEVICE_INFO_DEVICE_ID, 0,
323-
nullptr, &return_size) == PI_SUCCESS;
321+
MDevice, PI_DEVICE_INFO_DEVICE_ID, 0, nullptr, &return_size) ==
322+
PI_SUCCESS;
324323
case aspect::ext_intel_pci_address:
325324
return getPlugin().call_nocheck<detail::PiApiKind::piDeviceGetInfo>(
326325
MDevice, PI_DEVICE_INFO_PCI_ADDRESS, 0, nullptr, &return_size) ==
327326
PI_SUCCESS;
328327
case aspect::ext_intel_gpu_eu_count:
329328
return getPlugin().call_nocheck<detail::PiApiKind::piDeviceGetInfo>(
330-
MDevice, PI_DEVICE_INFO_GPU_EU_COUNT, sizeof(pi_device_type),
331-
&device_type, &return_size) == PI_SUCCESS;
329+
MDevice, PI_DEVICE_INFO_GPU_EU_COUNT, 0, nullptr,
330+
&return_size) == PI_SUCCESS;
332331
case aspect::ext_intel_gpu_eu_simd_width:
333332
return getPlugin().call_nocheck<detail::PiApiKind::piDeviceGetInfo>(
334-
MDevice, PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH,
335-
sizeof(pi_device_type), &device_type,
333+
MDevice, PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH, 0, nullptr,
336334
&return_size) == PI_SUCCESS;
337335
case aspect::ext_intel_gpu_slices:
338336
return getPlugin().call_nocheck<detail::PiApiKind::piDeviceGetInfo>(
339-
MDevice, PI_DEVICE_INFO_GPU_SLICES, sizeof(pi_device_type),
340-
&device_type, &return_size) == PI_SUCCESS;
337+
MDevice, PI_DEVICE_INFO_GPU_SLICES, 0, nullptr, &return_size) ==
338+
PI_SUCCESS;
341339
case aspect::ext_intel_gpu_subslices_per_slice:
342340
return getPlugin().call_nocheck<detail::PiApiKind::piDeviceGetInfo>(
343-
MDevice, PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE,
344-
sizeof(pi_device_type), &device_type,
341+
MDevice, PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE, 0, nullptr,
345342
&return_size) == PI_SUCCESS;
346343
case aspect::ext_intel_gpu_eu_count_per_subslice:
347344
return getPlugin().call_nocheck<detail::PiApiKind::piDeviceGetInfo>(
348-
MDevice, PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE,
349-
sizeof(pi_device_type), &device_type,
345+
MDevice, PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE, 0, nullptr,
350346
&return_size) == PI_SUCCESS;
351347
case aspect::ext_intel_gpu_hw_threads_per_eu:
352348
return getPlugin().call_nocheck<detail::PiApiKind::piDeviceGetInfo>(
353-
MDevice, PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU,
354-
sizeof(pi_device_type), &device_type,
349+
MDevice, PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU, 0, nullptr,
355350
&return_size) == PI_SUCCESS;
356351
case aspect::ext_intel_free_memory:
357352
return getPlugin().call_nocheck<detail::PiApiKind::piDeviceGetInfo>(
358-
MDevice, PI_EXT_INTEL_DEVICE_INFO_FREE_MEMORY,
359-
sizeof(pi_device_type), &device_type,
353+
MDevice, PI_EXT_INTEL_DEVICE_INFO_FREE_MEMORY, 0, nullptr,
360354
&return_size) == PI_SUCCESS;
361355
case aspect::ext_intel_device_info_uuid: {
362356
auto Result = getPlugin().call_nocheck<detail::PiApiKind::piDeviceGetInfo>(

0 commit comments

Comments
 (0)