diff --git a/sycl/include/sycl/detail/common.hpp b/sycl/include/sycl/detail/common.hpp index a8c94e32d81c6..13919a39f823a 100644 --- a/sycl/include/sycl/detail/common.hpp +++ b/sycl/include/sycl/detail/common.hpp @@ -148,13 +148,6 @@ class __SYCL_EXPORT tls_code_loc_t { bool MLocalScope = true; }; -__SYCL_EXPORT const char *stringifyErrorCode(pi_int32 error); - -inline std::string codeToString(pi_int32 code) { - return std::string(std::to_string(code) + " (" + stringifyErrorCode(code) + - ")"); -} - } // namespace detail } // namespace _V1 } // namespace sycl diff --git a/sycl/include/sycl/exception.hpp b/sycl/include/sycl/exception.hpp index 7cd41224b315e..472d5b335f141 100644 --- a/sycl/include/sycl/exception.hpp +++ b/sycl/include/sycl/exception.hpp @@ -12,7 +12,6 @@ #include // for backend #include // for cl_int -#include // for codeToString #include // for __SYCL2020_DEPRECATED #include // for __SYCL_EXPORT #include // for pi_int32 @@ -58,6 +57,13 @@ __SYCL_EXPORT std::error_code make_error_code(sycl::errc E) noexcept; __SYCL_EXPORT const std::error_category &sycl_category() noexcept; namespace detail { +__SYCL_EXPORT const char *stringifyErrorCode(pi_int32 error); + +inline std::string codeToString(pi_int32 code) { + return std::string(std::to_string(code) + " (" + stringifyErrorCode(code) + + ")"); +} + class __SYCL_EXPORT SYCLCategory : public std::error_category { public: const char *name() const noexcept override { return "sycl"; } diff --git a/sycl/source/detail/common.cpp b/sycl/source/detail/common.cpp index 9e6aee1e85693..7bc85e026dc71 100644 --- a/sycl/source/detail/common.cpp +++ b/sycl/source/detail/common.cpp @@ -53,22 +53,6 @@ tls_code_loc_t::~tls_code_loc_t() { const detail::code_location &tls_code_loc_t::query() { return GCodeLocTLS; } -const char *stringifyErrorCode(pi_int32 error) { - switch (error) { -#define _PI_ERRC(NAME, VAL) \ - case NAME: \ - return #NAME; -#define _PI_ERRC_WITH_MSG(NAME, VAL, MSG) \ - case NAME: \ - return MSG; -#include -#undef _PI_ERRC -#undef _PI_ERRC_WITH_MSG - - default: - return "Unknown error code"; - } -} } // namespace detail } // namespace _V1 } // namespace sycl diff --git a/sycl/source/exception.cpp b/sycl/source/exception.cpp index 836769389f98c..e558d0ef29995 100644 --- a/sycl/source/exception.cpp +++ b/sycl/source/exception.cpp @@ -94,5 +94,24 @@ std::error_code make_error_code(sycl::errc Err) noexcept { return {static_cast(Err), sycl_category()}; } +namespace detail { +const char *stringifyErrorCode(pi_int32 error) { + switch (error) { +#define _PI_ERRC(NAME, VAL) \ + case NAME: \ + return #NAME; +#define _PI_ERRC_WITH_MSG(NAME, VAL, MSG) \ + case NAME: \ + return MSG; +#include +#undef _PI_ERRC +#undef _PI_ERRC_WITH_MSG + + default: + return "Unknown error code"; + } +} +} // namespace detail + } // namespace _V1 } // namespace sycl diff --git a/sycl/source/spirv_ops.cpp b/sycl/source/spirv_ops.cpp index a635dea89d955..8a80e53ec9742 100644 --- a/sycl/source/spirv_ops.cpp +++ b/sycl/source/spirv_ops.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include