Skip to content

[SYCL] Don't throw in device_impl::has #14355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sycl/source/detail/device_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,8 @@ bool device_impl::has(aspect Aspect) const {
return call_successful && support;
}
}
throw runtime_error("This device aspect has not been implemented yet.",
PI_ERROR_INVALID_DEVICE);

return false; // This device aspect has not been implemented yet.
}

std::shared_ptr<device_impl> device_impl::getHostDeviceImpl() {
Expand Down
13 changes: 3 additions & 10 deletions sycl/source/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,9 @@ device::get_info_impl<info::device::aspects>() const {
#undef __SYCL_ASPECT
};

auto UnsupportedAspects = std::remove_if(
DeviceAspects.begin(), DeviceAspects.end(), [&](aspect Aspect) {
try {
return !impl->has(Aspect);
} catch (const runtime_error &ex) {
if (ex.get_cl_code() == PI_ERROR_INVALID_DEVICE)
return true;
throw;
}
});
auto UnsupportedAspects =
std::remove_if(DeviceAspects.begin(), DeviceAspects.end(),
[&](aspect Aspect) { return !impl->has(Aspect); });

DeviceAspects.erase(UnsupportedAspects, DeviceAspects.end());

Expand Down
Loading