From 57b8401938a26b860c151df9eeab6044272f1a86 Mon Sep 17 00:00:00 2001 From: Dmitry Vodopyanov Date: Mon, 17 Jun 2024 17:28:39 +0200 Subject: [PATCH] [SYCL] Update error handling for sycl_ext_oneapi_device_architecture in SYCL RT (#14190) The file in this patch was accidentally missing during commit and push for #14077, adding it here. --- sycl/source/detail/device_info.hpp | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/sycl/source/detail/device_info.hpp b/sycl/source/detail/device_info.hpp index 16f19b80e8fbd..ba90e6eb829cb 100644 --- a/sycl/source/detail/device_info.hpp +++ b/sycl/source/detail/device_info.hpp @@ -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( @@ -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( @@ -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; } };