Skip to content

Commit 49ec72a

Browse files
author
JackAKirk
committed
PI_DEVICE_INFO_ATOMIC_64 is now checked for all backends when get_info<info::device::atomic64>() is called.
If the PI returns the PI_INVALID_VALUE error then atomic64 is set false and the user is informed that the atomic64 aspect status is unknown for the device. Signed-off-by: JackAKirk <jack.kirk@codeplay.com>
1 parent ab8a600 commit 49ec72a

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

sycl/source/detail/device_info.hpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,24 +234,23 @@ template <> struct get_device_info<bool, info::device::queue_profiling> {
234234
};
235235

236236
// Specialization for atomic64 that is necessary because
237-
// PI_DEVICE_INFO_ATOMIC_64 isn't implemented for backend other than cuda.
238-
// TODO the if-statement can be removed when the other backends support
239-
// PI_DEVICE_INFO_ATOMIC_64.
237+
// PI_DEVICE_INFO_ATOMIC_64 is currently only implemented for the cuda backend.
240238
template <> struct get_device_info<bool, info::device::atomic64> {
241239
static bool get(RT::PiDevice dev, const plugin &Plugin) {
242240

243241
bool result = false;
244242

245-
platform plt =
246-
get_device_info<platform, info::device::platform>::get(dev, Plugin);
247-
248-
if (plt.get_backend() == backend::cuda) {
249-
Plugin.call<PiApiKind::piDeviceGetInfo>(
250-
dev, pi::cast<RT::PiDeviceInfo>(info::device::atomic64),
251-
sizeof(result), &result, nullptr);
243+
RT::PiResult Err = Plugin.call_nocheck<PiApiKind::piDeviceGetInfo>(
244+
dev, pi::cast<RT::PiDeviceInfo>(info::device::atomic64), sizeof(result),
245+
&result, nullptr);
246+
if (Err == PI_INVALID_VALUE) {
247+
std::cout
248+
<< "The Plugin Interface has returned an error:\n The value of "
249+
"the atomic64 device aspect is unknown, Setting atomic64 "
250+
"= false.\n\n";
252251
}
253252

254-
return (result);
253+
return result;
255254
}
256255
};
257256

0 commit comments

Comments
 (0)