@@ -165,75 +165,7 @@ class __SYCL_EXPORT tls_code_loc_t {
165165 /* ":" __SYCL_STRINGIFY(__LINE__) ": " */ \
166166 " Native API returns: "
167167
168- #ifndef __SYCL_SUPPRESS_PI_ERROR_REPORT
169- #include < sycl/detail/iostream_proxy.hpp>
170- // TODO: rename all names with direct use of OCL/OPENCL to be backend agnostic.
171- #define __SYCL_REPORT_PI_ERR_TO_STREAM (expr ) \
172- { \
173- auto code = expr; \
174- if (code != PI_SUCCESS) { \
175- std::cerr << __SYCL_PI_ERROR_REPORT << sycl::detail::codeToString (code) \
176- << std::endl; \
177- } \
178- }
179- #endif
180-
181- #ifndef SYCL_SUPPRESS_EXCEPTIONS
182168#include < sycl/exception.hpp>
183- // SYCL 1.2.1 exceptions
184- #define __SYCL_REPORT_PI_ERR_TO_EXC (expr, exc, str ) \
185- { \
186- auto code = expr; \
187- if (code != PI_SUCCESS) { \
188- std::string err_str = \
189- str ? " \n " + std::string (str) + " \n " : std::string{}; \
190- throw exc (__SYCL_PI_ERROR_REPORT + sycl::detail::codeToString (code) + \
191- err_str, \
192- code); \
193- } \
194- }
195- #define __SYCL_REPORT_PI_ERR_TO_EXC_THROW (code, exc, str ) \
196- __SYCL_REPORT_PI_ERR_TO_EXC (code, exc, str)
197- #define __SYCL_REPORT_PI_ERR_TO_EXC_BASE (code ) \
198- __SYCL_REPORT_PI_ERR_TO_EXC (code, sycl::runtime_error, nullptr )
199- #else
200- #define __SYCL_REPORT_PI_ERR_TO_EXC_BASE (code ) \
201- __SYCL_REPORT_PI_ERR_TO_STREAM (code)
202- #endif
203- // SYCL 2020 exceptions
204- #define __SYCL_REPORT_ERR_TO_EXC_VIA_ERRC (expr, errc ) \
205- { \
206- auto code = expr; \
207- if (code != PI_SUCCESS) { \
208- throw sycl::exception (sycl::make_error_code (errc), \
209- __SYCL_PI_ERROR_REPORT + \
210- sycl::detail::codeToString (code)); \
211- } \
212- }
213- #define __SYCL_REPORT_ERR_TO_EXC_THROW_VIA_ERRC (code, errc ) \
214- __SYCL_REPORT_ERR_TO_EXC_VIA_ERRC (code, errc)
215-
216- #ifdef __SYCL_SUPPRESS_PI_ERROR_REPORT
217- // SYCL 1.2.1 exceptions
218- #define __SYCL_CHECK_OCL_CODE (X ) (void )(X)
219- #define __SYCL_CHECK_OCL_CODE_THROW (X, EXC, STR ) \
220- { \
221- (void )(X); \
222- (void )(STR); \
223- }
224- #define __SYCL_CHECK_OCL_CODE_NO_EXC (X ) (void )(X)
225- // SYCL 2020 exceptions
226- #define __SYCL_CHECK_CODE_THROW_VIA_ERRC (X, ERRC ) (void )(X)
227- #else
228- // SYCL 1.2.1 exceptions
229- #define __SYCL_CHECK_OCL_CODE (X ) __SYCL_REPORT_PI_ERR_TO_EXC_BASE(X)
230- #define __SYCL_CHECK_OCL_CODE_THROW (X, EXC, STR ) \
231- __SYCL_REPORT_PI_ERR_TO_EXC_THROW (X, EXC, STR)
232- #define __SYCL_CHECK_OCL_CODE_NO_EXC (X ) __SYCL_REPORT_PI_ERR_TO_STREAM(X)
233- // SYCL 2020 exceptions
234- #define __SYCL_CHECK_CODE_THROW_VIA_ERRC (X, ERRC ) \
235- __SYCL_REPORT_ERR_TO_EXC_THROW_VIA_ERRC (X, ERRC)
236- #endif
237169
238170// Helper for enabling empty-base optimizations on MSVC.
239171// TODO: Remove this when MSVC has this optimization enabled by default.
0 commit comments