@@ -71,29 +71,8 @@ class adapter_impl {
7171 // / \throw SYCL 2020 exception(errc) if ur_result is not UR_RESULT_SUCCESS
7272 template <sycl::errc errc = sycl::errc::runtime>
7373 void checkUrResult (ur_result_t ur_result) const {
74- if (ur_result == UR_RESULT_ERROR_ADAPTER_SPECIFIC) {
75- assert (!adapterReleased);
76- const char *message = nullptr ;
77- int32_t adapter_error = 0 ;
78- ur_result = call_nocheck<UrApiKind::urAdapterGetLastError>(
79- MAdapter, &message, &adapter_error);
80- throw sycl::detail::set_ur_error (
81- sycl::exception (
82- sycl::make_error_code (errc),
83- __SYCL_UR_ERROR_REPORT (MBackend) +
84- sycl::detail::codeToString (ur_result) +
85- (message ? " \n " + std::string (message) + " (adapter error )" +
86- std::to_string (adapter_error) + " \n "
87- : std::string{})),
88- ur_result);
89- }
90- if (ur_result != UR_RESULT_SUCCESS) {
91- throw sycl::detail::set_ur_error (
92- sycl::exception (sycl::make_error_code (errc),
93- __SYCL_UR_ERROR_REPORT (MBackend) +
94- sycl::detail::codeToString (ur_result)),
95- ur_result);
96- }
74+ if (__builtin_expect (ur_result != UR_RESULT_SUCCESS, false ))
75+ ur_failed_throw_exception (errc, ur_result);
9776 }
9877
9978 std::vector<ur_platform_handle_t > &getUrPlatforms () {
@@ -225,6 +204,8 @@ class adapter_impl {
225204 bool adapterReleased = false ;
226205
227206private:
207+ void ur_failed_throw_exception (sycl::errc errc, ur_result_t ur_result) const ;
208+
228209 ur_adapter_handle_t MAdapter;
229210 backend MBackend;
230211 // Mutex to guard UrPlatforms and LastDeviceIds.
0 commit comments