Skip to content

Commit d52d779

Browse files
[SYCL] Don't throw in device_impl::has (#14355)
1) It isn't right 2) We need this change to get rid of deprecated `sycl::exception::get_cl_code`
1 parent 9ed5458 commit d52d779

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

sycl/source/detail/device_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,8 +747,8 @@ bool device_impl::has(aspect Aspect) const {
747747
return call_successful && support;
748748
}
749749
}
750-
throw runtime_error("This device aspect has not been implemented yet.",
751-
PI_ERROR_INVALID_DEVICE);
750+
751+
return false; // This device aspect has not been implemented yet.
752752
}
753753

754754
std::shared_ptr<device_impl> device_impl::getHostDeviceImpl() {

sycl/source/device.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,9 @@ device::get_info_impl<info::device::aspects>() const {
156156
#undef __SYCL_ASPECT
157157
};
158158

159-
auto UnsupportedAspects = std::remove_if(
160-
DeviceAspects.begin(), DeviceAspects.end(), [&](aspect Aspect) {
161-
try {
162-
return !impl->has(Aspect);
163-
} catch (const runtime_error &ex) {
164-
if (ex.get_cl_code() == PI_ERROR_INVALID_DEVICE)
165-
return true;
166-
throw;
167-
}
168-
});
159+
auto UnsupportedAspects =
160+
std::remove_if(DeviceAspects.begin(), DeviceAspects.end(),
161+
[&](aspect Aspect) { return !impl->has(Aspect); });
169162

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

0 commit comments

Comments
 (0)