Skip to content

Commit 5faaaf4

Browse files
committed
Further fix error checking on queries.
Signed-off-by: James Brodman <[email protected]>
1 parent b1ead33 commit 5faaaf4

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

sycl/include/CL/sycl/detail/device_info.hpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,11 @@ template <>
333333
struct get_device_info<bool, info::device::usm_device_allocations> {
334334
static bool get(RT::PiDevice dev) {
335335
pi_usm_capabilities caps;
336-
PI_CALL(piDeviceGetInfo)(
336+
pi_result Err = PI_CALL_NOCHECK(piDeviceGetInfo)(
337337
dev, pi::cast<RT::PiDeviceInfo>(info::device::usm_device_allocations),
338338
sizeof(pi_usm_capabilities), &caps, nullptr);
339-
return (caps != 0);
339+
340+
return (Err != PI_SUCCESS) ? false : (caps & PI_USM_ACCESS);
340341
}
341342
};
342343

@@ -345,10 +346,11 @@ template <>
345346
struct get_device_info<bool, info::device::usm_host_allocations> {
346347
static bool get(RT::PiDevice dev) {
347348
pi_usm_capabilities caps;
348-
PI_CALL(piDeviceGetInfo)(
349+
pi_result Err = PI_CALL_NOCHECK(piDeviceGetInfo)(
349350
dev, pi::cast<RT::PiDeviceInfo>(info::device::usm_host_allocations),
350351
sizeof(pi_usm_capabilities), &caps, nullptr);
351-
return (caps & PI_USM_ACCESS);
352+
353+
return (Err != PI_SUCCESS) ? false : (caps & PI_USM_ACCESS);
352354
}
353355
};
354356

@@ -357,10 +359,10 @@ template <>
357359
struct get_device_info<bool, info::device::usm_shared_allocations> {
358360
static bool get(RT::PiDevice dev) {
359361
pi_usm_capabilities caps;
360-
PI_CALL(piDeviceGetInfo)(
362+
pi_result Err = PI_CALL_NOCHECK(piDeviceGetInfo)(
361363
dev, pi::cast<RT::PiDeviceInfo>(info::device::usm_shared_allocations),
362364
sizeof(pi_usm_capabilities), &caps, nullptr);
363-
return (caps & PI_USM_ACCESS);
365+
return (Err != PI_SUCCESS) ? false : (caps & PI_USM_ACCESS);
364366
}
365367
};
366368

@@ -369,13 +371,15 @@ template <>
369371
struct get_device_info<bool, info::device::usm_restricted_shared_allocations> {
370372
static bool get(RT::PiDevice dev) {
371373
pi_usm_capabilities caps;
372-
PI_CALL(piDeviceGetInfo)(
374+
pi_result Err = PI_CALL_NOCHECK(piDeviceGetInfo)(
373375
dev,
374376
pi::cast<RT::PiDeviceInfo>(
375377
info::device::usm_restricted_shared_allocations),
376378
sizeof(pi_usm_capabilities), &caps, nullptr);
377379
// Check that we don't support any cross device sharing
378-
return !(caps & (PI_USM_ACCESS | PI_USM_CONCURRENT_ACCESS));
380+
return (Err != PI_SUCCESS)
381+
? false
382+
: !(caps & (PI_USM_ACCESS | PI_USM_CONCURRENT_ACCESS));
379383
}
380384
};
381385

@@ -384,11 +388,10 @@ template <>
384388
struct get_device_info<bool, info::device::usm_system_allocator> {
385389
static bool get(RT::PiDevice dev) {
386390
pi_usm_capabilities caps;
387-
PI_CALL(piDeviceGetInfo)(
391+
pi_result Err = PI_CALL_NOCHECK(piDeviceGetInfo)(
388392
dev, pi::cast<RT::PiDeviceInfo>(info::device::usm_system_allocator),
389393
sizeof(pi_usm_capabilities), &caps, nullptr);
390-
// Check that we don't support any cross device sharing
391-
return (caps & PI_USM_ACCESS);
394+
return (Err != PI_SUCCESS) ? false : (caps & PI_USM_ACCESS);
392395
}
393396
};
394397

0 commit comments

Comments
 (0)