File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,11 @@ template <>
359359struct get_device_info_impl <std::vector<info::execution_capability>,
360360 info::device::execution_capabilities> {
361361 static std::vector<info::execution_capability> get (const DeviceImplPtr &Dev) {
362+ if (Dev->getBackend () != backend::opencl)
363+ throw exception (make_error_code (errc::invalid),
364+ " info::device::execution_capabilities is available for "
365+ " backend::opencl only" );
366+
362367 ur_device_exec_capability_flag_t result;
363368 Dev->getAdapter ()->call <UrApiKind::urDeviceGetInfo>(
364369 Dev->getHandleRef (),
Original file line number Diff line number Diff line change @@ -313,9 +313,17 @@ int main() {
313313 dev, " Is compiler available" );
314314 print_info<info::device::is_linker_available, bool >(dev,
315315 " Is linker available" );
316- print_info<info::device::execution_capabilities,
317- std::vector<info::execution_capability>>(dev,
318- " Execution capabilities" );
316+ try {
317+ print_info<info::device::execution_capabilities,
318+ std::vector<info::execution_capability>>(
319+ dev, " Execution capabilities" );
320+ assert (backend == sycl::backend::opencl &&
321+ " An exception is expected for non OpenCL backend" );
322+ } catch (const sycl::exception &e) {
323+ assert (e.code () == sycl::errc::invalid &&
324+ backend != sycl::backend::opencl && " Unexpected exception" );
325+ }
326+
319327 print_info<info::device::queue_profiling, bool >(dev, " Queue profiling" );
320328 print_info<info::device::built_in_kernels, std::vector<std::string>>(
321329 dev, " Built in kernels" );
You can’t perform that action at this time.
0 commit comments