Skip to content

Commit

Permalink
[SYCL][COMPAT] Add get_error_string_dummy() function (#15719)
Browse files Browse the repository at this point in the history
Signed-off-by: Jiang, Zhiwei <[email protected]>

---------

Signed-off-by: Jiang, Zhiwei <[email protected]>
  • Loading branch information
zhiweij1 authored Oct 18, 2024
1 parent 62cdfc7 commit 07fbce2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sycl/doc/syclcompat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1589,6 +1589,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. 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 {
Expand Down Expand Up @@ -1620,6 +1624,7 @@ template <int Arg> 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)
Expand Down
8 changes: 8 additions & 0 deletions sycl/include/syclcompat/defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,15 @@ template <int Arg> 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.
/// 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 "<FIXME: Placeholder>"; // Return the error string for the error code
// ec.
}
} // namespace syclcompat

#define SYCLCOMPAT_CHECK_ERROR(expr) \
[&]() { \
Expand Down

0 comments on commit 07fbce2

Please sign in to comment.