From 808f7531265e50700c0f576f0886e0f3ecd22ab4 Mon Sep 17 00:00:00 2001 From: "Jiang, Zhiwei" Date: Wed, 16 Oct 2024 16:28:35 +0800 Subject: [PATCH 1/2] [SYCL][COMPAT] Add get_error_string_dummy() function Signed-off-by: Jiang, Zhiwei --- sycl/doc/syclcompat/README.md | 5 +++++ sycl/include/syclcompat/defs.hpp | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/sycl/doc/syclcompat/README.md b/sycl/doc/syclcompat/README.md index df8d453a41d57..919b3e12e6ab3 100644 --- a/sycl/doc/syclcompat/README.md +++ b/sycl/doc/syclcompat/README.md @@ -1585,6 +1585,10 @@ If a `std::runtime_error` exception is caught, `syclcompat::error_code::default_error` is returned instead. For both cases, it prints the error message to the standard error stream. +`get_error_string_dummy` is a dummy function introduced to assist auto +migration. It needs to be replaced with a real error-handling function. SYCL +reports errors using exceptions and does not use error codes. + ``` c++ namespace syclcompat { @@ -1616,6 +1620,7 @@ template class syclcompat_kernel_scalar; namespace syclcompat { enum error_code { success = 0, backend_error = 1, default_error = 999 }; +inline const char *get_error_string_dummy(int ec); } #define SYCLCOMPAT_CHECK_ERROR(expr) diff --git a/sycl/include/syclcompat/defs.hpp b/sycl/include/syclcompat/defs.hpp index 2415d1fe8847c..21ff35afe57d4 100644 --- a/sycl/include/syclcompat/defs.hpp +++ b/sycl/include/syclcompat/defs.hpp @@ -68,7 +68,15 @@ template class syclcompat_kernel_scalar; namespace syclcompat { enum error_code { success = 0, backend_error = 1, default_error = 999 }; +/// A dummy function introduced to assist auto migration. +/// It needs to be replaced with a real error-handling function. SYCL reports +/// errors using exceptions and does not use error codes. +inline const char *get_error_string_dummy(int ec) { + (void)ec; + return ""; // Return the error string for the error code + // ec. } +} // namespace syclcompat #define SYCLCOMPAT_CHECK_ERROR(expr) \ [&]() { \ From 0ffef5c6b1dbae3a32c9c7406d5b0ed2c84a05f7 Mon Sep 17 00:00:00 2001 From: "Jiang, Zhiwei" Date: Wed, 16 Oct 2024 17:45:11 +0800 Subject: [PATCH 2/2] Address feedback Signed-off-by: Jiang, Zhiwei --- sycl/doc/syclcompat/README.md | 4 ++-- sycl/include/syclcompat/defs.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sycl/doc/syclcompat/README.md b/sycl/doc/syclcompat/README.md index 919b3e12e6ab3..cb2a2615f51f2 100644 --- a/sycl/doc/syclcompat/README.md +++ b/sycl/doc/syclcompat/README.md @@ -1586,8 +1586,8 @@ If a `std::runtime_error` exception is caught, prints the error message to the standard error stream. `get_error_string_dummy` is a dummy function introduced to assist auto -migration. It needs to be replaced with a real error-handling function. SYCL -reports errors using exceptions and does not use error codes. +migration. The SYCLomatic user should replace it with a real error-handling +function. SYCL reports errors using exceptions and does not use error codes. ``` c++ namespace syclcompat { diff --git a/sycl/include/syclcompat/defs.hpp b/sycl/include/syclcompat/defs.hpp index 21ff35afe57d4..e1ee5969c0534 100644 --- a/sycl/include/syclcompat/defs.hpp +++ b/sycl/include/syclcompat/defs.hpp @@ -69,8 +69,8 @@ template class syclcompat_kernel_scalar; namespace syclcompat { enum error_code { success = 0, backend_error = 1, default_error = 999 }; /// A dummy function introduced to assist auto migration. -/// It needs to be replaced with a real error-handling function. SYCL reports -/// errors using exceptions and does not use error codes. +/// The SYCLomatic user should replace it with a real error-handling function. +/// SYCL reports errors using exceptions and does not use error codes. inline const char *get_error_string_dummy(int ec) { (void)ec; return ""; // Return the error string for the error code