Skip to content

Commit 192662b

Browse files
[SYCL] Remove *SUPPRESS* macros and move some others to source/ (intel#13905)
The ones being removed had no documentation nor known uses.
1 parent 8b27ee2 commit 192662b

File tree

4 files changed

+43
-69
lines changed

4 files changed

+43
-69
lines changed

sycl/include/sycl/detail/common.hpp

-68
Original file line numberDiff line numberDiff line change
@@ -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.

sycl/source/detail/device_binary_image.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <sycl/detail/os_util.hpp>
1212
#include <sycl/detail/pi.hpp>
1313

14+
#include <sycl/detail/iostream_proxy.hpp>
15+
1416
#include <atomic>
1517
#include <cstring>
1618
#include <memory>

sycl/source/detail/plugin.hpp

+40
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,46 @@
2121
#include "xpti/xpti_trace_framework.h"
2222
#endif
2323

24+
#include <sycl/detail/iostream_proxy.hpp>
25+
26+
#define __SYCL_REPORT_PI_ERR_TO_STREAM(expr) \
27+
{ \
28+
auto code = expr; \
29+
if (code != PI_SUCCESS) { \
30+
std::cerr << __SYCL_PI_ERROR_REPORT << sycl::detail::codeToString(code) \
31+
<< std::endl; \
32+
} \
33+
}
34+
35+
#define __SYCL_REPORT_PI_ERR_TO_EXC(expr, exc, str) \
36+
{ \
37+
auto code = expr; \
38+
if (code != PI_SUCCESS) { \
39+
std::string err_str = \
40+
str ? "\n" + std::string(str) + "\n" : std::string{}; \
41+
throw exc(__SYCL_PI_ERROR_REPORT + sycl::detail::codeToString(code) + \
42+
err_str, \
43+
code); \
44+
} \
45+
}
46+
47+
#define __SYCL_REPORT_ERR_TO_EXC_VIA_ERRC(expr, errc) \
48+
{ \
49+
auto code = expr; \
50+
if (code != PI_SUCCESS) { \
51+
throw sycl::exception(sycl::make_error_code(errc), \
52+
__SYCL_PI_ERROR_REPORT + \
53+
sycl::detail::codeToString(code)); \
54+
} \
55+
}
56+
57+
#define __SYCL_CHECK_OCL_CODE_THROW(X, EXC, STR) \
58+
__SYCL_REPORT_PI_ERR_TO_EXC(X, EXC, STR)
59+
#define __SYCL_CHECK_OCL_CODE_NO_EXC(X) __SYCL_REPORT_PI_ERR_TO_STREAM(X)
60+
61+
#define __SYCL_CHECK_CODE_THROW_VIA_ERRC(X, ERRC) \
62+
__SYCL_REPORT_ERR_TO_EXC_VIA_ERRC(X, ERRC)
63+
2464
namespace sycl {
2565
inline namespace _V1 {
2666
namespace detail {

sycl/test/include_deps/sycl_buffer.hpp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
// CHECK-NEXT: CL/cl_platform.h
3636
// CHECK-NEXT: CL/cl_ext.h
3737
// CHECK-NEXT: detail/common.hpp
38-
// CHECK-NEXT: detail/iostream_proxy.hpp
3938
// CHECK-NEXT: range.hpp
4039
// CHECK-NEXT: info/info_desc.hpp
4140
// CHECK-NEXT: detail/type_traits.hpp
@@ -75,6 +74,7 @@
7574
// CHECK-NEXT: aliases.hpp
7675
// CHECK-NEXT: half_type.hpp
7776
// CHECK-NEXT: bit_cast.hpp
77+
// CHECK-NEXT: detail/iostream_proxy.hpp
7878
// CHECK-NEXT: detail/vector_traits.hpp
7979
// CHECK-NEXT: ext/oneapi/matrix/matrix-unified-utils.hpp
8080
// CHECK-NEXT: info/platform_traits.def

0 commit comments

Comments
 (0)