27 enum class errc : unsigned int {
50 __SYCL_EXPORT
const std::error_category &
sycl_category() noexcept;
55 const char *
name() const noexcept
override {
return "sycl"; }
56 std::string
message(
int)
const override {
return "SYCL Error"; }
63 class __SYCL_EXPORT
exception :
public std::exception {
66 "no arguments is deprecated.")
69 exception(std::error_code,
const char *Msg);
71 exception(std::error_code,
const std::string &Msg);
75 exception(
int,
const std::error_category &,
const std::string &);
76 exception(
int,
const std::error_category &,
const char *);
77 exception(
int,
const std::error_category &);
86 const std::error_code &code()
const noexcept;
87 const std::error_category &category()
const noexcept;
89 const char *what()
const noexcept
final;
91 bool has_context()
const;
96 cl_int get_cl_code()
const;
101 std::shared_ptr<context> MContext;
106 std::shared_ptr<context> Context =
nullptr)
109 std::shared_ptr<context> Context =
nullptr)
110 : MMsg(Msg +
" " + detail::
codeToString(CLErr)), MCLErr(CLErr),
115 std::shared_ptr<context> Context =
nullptr)
119 std::shared_ptr<context> Context =
nullptr)
124 exception(
const std::string &Msg) : MMsg(Msg), MContext(nullptr) {}
129 exception(std::error_code ec, std::shared_ptr<context> SharedPtrCtx,
130 const std::string &what_arg);
134 "use
sycl::exception with sycl::errc::runtime
instead.") runtime_error
139 runtime_error(
const char *Msg,
cl_int Err)
140 : runtime_error(
std::string(Msg), Err) {}
142 runtime_error(
const std::string &Msg,
cl_int Err)
145 runtime_error(std::error_code ec,
const std::string &Msg,
const cl_int CLErr)
146 : exception(ec, Msg, CLErr) {}
149 runtime_error(std::error_code ec) : exception(ec) {}
153 "errc::kernel_argument
instead.") kernel_error
154 :
public runtime_error {
158 kernel_error(
const char *Msg,
cl_int Err)
159 : kernel_error(
std::string(Msg), Err) {}
161 kernel_error(
const std::string &Msg,
cl_int Err)
166 "use
sycl::exception with sycl::errc::accessor
instead.") accessor_error
167 :
public runtime_error {
171 accessor_error(
const char *Msg,
cl_int Err)
172 : accessor_error(
std::string(Msg), Err) {}
174 accessor_error(
const std::string &Msg,
cl_int Err)
179 "use
sycl::exception with sycl::errc::nd_range
instead.") nd_range_error
180 :
public runtime_error {
184 nd_range_error(
const char *Msg,
cl_int Err)
185 : nd_range_error(
std::string(Msg), Err) {}
187 nd_range_error(
const std::string &Msg,
cl_int Err)
193 :
public runtime_error {
197 event_error(
const char *Msg,
cl_int Err)
198 : event_error(
std::string(Msg), Err) {}
200 event_error(
const std::string &Msg,
cl_int Err)
206 invalid_parameter_error :
public runtime_error {
208 invalid_parameter_error()
211 invalid_parameter_error(
const char *Msg,
cl_int Err)
212 : invalid_parameter_error(
std::string(Msg), Err) {}
214 invalid_parameter_error(
const std::string &Msg,
cl_int Err)
224 device_error(
const char *Msg,
cl_int Err)
225 : device_error(
std::string(Msg), Err) {}
227 device_error(
const std::string &Msg,
cl_int Err)
231 device_error(std::error_code ec) : exception(ec) {}
233 device_error(std::error_code ec,
const std::string &Msg,
const cl_int CLErr)
234 : exception(ec, Msg, CLErr) {}
252 link_program_error :
public device_error {
256 link_program_error(
const char *Msg,
cl_int Err)
257 : link_program_error(
std::string(Msg), Err) {}
259 link_program_error(
const std::string &Msg,
cl_int Err)
265 invalid_object_error :
public device_error {
269 invalid_object_error(
const char *Msg,
cl_int Err)
270 : invalid_object_error(
std::string(Msg), Err) {}
272 invalid_object_error(
const std::string &Msg,
cl_int Err)
277 "use
sycl::exception with sycl::errc::memory_allocation
instead.")
278 memory_allocation_error :
public device_error {
280 memory_allocation_error()
283 memory_allocation_error(
const char *Msg,
cl_int Err)
284 : memory_allocation_error(
std::string(Msg), Err) {}
286 memory_allocation_error(
const std::string &Msg,
cl_int Err)
292 :
public device_error {
296 platform_error(
const char *Msg,
cl_int Err)
297 : platform_error(
std::string(Msg), Err) {}
299 platform_error(
const std::string &Msg,
cl_int Err)
304 "use
sycl::exception with sycl::errc::profiling
instead.") profiling_error
305 :
public device_error {
309 profiling_error(
const char *Msg,
cl_int Err)
310 : profiling_error(
std::string(Msg), Err) {}
312 profiling_error(
const std::string &Msg,
cl_int Err)
317 "use
sycl::exception with sycl::errc::feature_not_supported
instead.")