Skip to content

Commit

Permalink
[SYCL][Joint Matrix] Relax matrix_combinations error handling (#12866)
Browse files Browse the repository at this point in the history
This patch relaxes reporting of unsupported HW for matrix_combinations
query.
Before: exception thrown in case customer uses matrix_combinations
query on platform unsupported by ext_oneapi_device_architecture.
With this patch: customer gets empty vector from matrix_combinations
query on platform unsupported by ext_oneapi_device_architecture.

---------

Co-authored-by: Sergey Semenov <sergey.semenov@intel.com>
  • Loading branch information
dm-vodopyanov and sergey-semenov authored Mar 7, 2024
1 parent 90a55a5 commit c00305b
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions sycl/source/detail/device_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,9 +740,26 @@ struct get_device_info_impl<
using namespace ext::oneapi::experimental::matrix;
using namespace ext::oneapi::experimental;
backend CurrentBackend = Dev->getBackend();
architecture DeviceArch = get_device_info_impl<
ext::oneapi::experimental::architecture,
ext::oneapi::experimental::info::device::architecture>::get(Dev);
auto get_current_architecture = [&Dev]() -> std::optional<architecture> {
// this helper lambda ignores all runtime-related exceptions from
// quering the device architecture. For instance, if device architecture
// on user's machine is not supported by
// sycl_ext_oneapi_device_architecture, the runtime exception is omitted,
// and std::nullopt is returned.
try {
return get_device_info_impl<
architecture,
ext::oneapi::experimental::info::device::architecture>::get(Dev);
} catch (sycl::exception &e) {
if (e.code() != errc::runtime)
std::rethrow_exception(std::make_exception_ptr(e));
}
return std::nullopt;
};
std::optional<architecture> DeviceArchOpt = get_current_architecture();
if (!DeviceArchOpt.has_value())
return {};
architecture DeviceArch = DeviceArchOpt.value();
if (architecture::intel_cpu_spr == DeviceArch)
return {
{16, 16, 64, 0, 0, 0, matrix_type::uint8, matrix_type::uint8,
Expand Down Expand Up @@ -850,10 +867,7 @@ struct get_device_info_impl<
for (const auto &Item : NvidiaArchNumbs)
if (Item.second == arch)
return Item.first;
throw sycl::exception(
make_error_code(errc::runtime),
"The current device architecture is not supported by "
"sycl_ext_oneapi_matrix.");
return 0.f;
};
float ComputeCapability = GetArchNum(DeviceArch);
std::vector<combination> sm_70_combinations = {
Expand Down

0 comments on commit c00305b

Please sign in to comment.