Skip to content

Commit

Permalink
[SYCL] Update error handling for sycl_ext_oneapi_device_architecture …
Browse files Browse the repository at this point in the history
…in SYCL RT (intel#14190)

The file in this patch was accidentally missing during commit and push
for intel#14077, adding it here.
  • Loading branch information
dm-vodopyanov authored Jun 17, 2024
1 parent 2620292 commit 57b8401
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions sycl/source/detail/device_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,10 +674,7 @@ struct get_device_info_impl<
if (Item.first == arch)
return Item.second;
}
throw sycl::exception(
make_error_code(errc::runtime),
"The current device architecture is not supported by "
"sycl_ext_oneapi_device_architecture.");
return ext::oneapi::experimental::architecture::unknown;
};
uint32_t DeviceIp;
Dev->getPlugin()->call<PiApiKind::piDeviceGetInfo>(
Expand All @@ -693,10 +690,7 @@ struct get_device_info_impl<
if (std::string_view(Item.first) == arch)
return Item.second;
}
throw sycl::exception(
make_error_code(errc::runtime),
"The current device architecture is not supported by "
"sycl_ext_oneapi_device_architecture.");
return ext::oneapi::experimental::architecture::unknown;
};
size_t ResultSize = 0;
Dev->getPlugin()->call<PiApiKind::piDeviceGetInfo>(
Expand Down Expand Up @@ -727,21 +721,7 @@ struct get_device_info_impl<
return MapArchIDToArchName(DeviceIp);
} // else is not needed
// TODO: add support of other architectures by extending with else if
// Generating a user-friendly error message
std::string DeviceStr;
if (Dev->is_gpu())
DeviceStr = "GPU";
else if (Dev->is_cpu())
DeviceStr = "CPU";
else if (Dev->is_accelerator())
DeviceStr = "accelerator";
// else if not needed
std::stringstream ErrorMessage;
ErrorMessage
<< "sycl_ext_oneapi_device_architecture feature is not supported on "
<< DeviceStr << " device with sycl::backend::" << CurrentBackend
<< " backend.";
throw sycl::exception(make_error_code(errc::runtime), ErrorMessage.str());
return ext::oneapi::experimental::architecture::unknown;
}
};

Expand Down

0 comments on commit 57b8401

Please sign in to comment.