Skip to content

Commit 4dfd500

Browse files
[SYCL] Add type declarations to support boolX (#2381)
Signed-off-by: Chris Perkins <[email protected]>
1 parent b206293 commit 4dfd500

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

sycl/include/CL/sycl/types.hpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,14 @@ using select_apply_cl_t =
21172117
GET_CL_TYPE(int, num), GET_CL_TYPE(long, num)>; \
21182118
};
21192119

2120+
#define DECLARE_BOOL_CONVERTER(num) \
2121+
template <> class BaseCLTypeConverter<bool, num> { \
2122+
public: \
2123+
using DataType = detail::select_apply_cl_t< \
2124+
bool, GET_CL_TYPE(char, num), GET_CL_TYPE(short, num), \
2125+
GET_CL_TYPE(int, num), GET_CL_TYPE(long, num)>; \
2126+
};
2127+
21202128
#define DECLARE_HALF_CONVERTER(base, num) \
21212129
template <> class BaseCLTypeConverter<base, num> { \
21222130
public: \
@@ -2129,6 +2137,12 @@ using select_apply_cl_t =
21292137
using DataType = schar; \
21302138
};
21312139

2140+
#define DECLARE_SCALAR_BOOL_CONVERTER \
2141+
template <> class BaseCLTypeConverter<bool, 1> { \
2142+
public: \
2143+
using DataType = bool; \
2144+
};
2145+
21322146
#define DECLARE_SCALAR_CONVERTER(base) \
21332147
template <> class BaseCLTypeConverter<base, 1> { \
21342148
public: \
@@ -2212,8 +2226,19 @@ using select_apply_cl_t =
22122226
DECLARE_SCALAR_SCHAR_CONVERTER \
22132227
} // namespace detail
22142228

2229+
#define DECLARE_BOOL_VECTOR_CONVERTERS \
2230+
namespace detail { \
2231+
DECLARE_BOOL_CONVERTER(2) \
2232+
DECLARE_BOOL_CONVERTER(3) \
2233+
DECLARE_BOOL_CONVERTER(4) \
2234+
DECLARE_BOOL_CONVERTER(8) \
2235+
DECLARE_BOOL_CONVERTER(16) \
2236+
DECLARE_SCALAR_BOOL_CONVERTER \
2237+
} // namespace detail
2238+
22152239
DECLARE_VECTOR_CONVERTERS(char)
22162240
DECLARE_SCHAR_VECTOR_CONVERTERS
2241+
DECLARE_BOOL_VECTOR_CONVERTERS
22172242
DECLARE_UNSIGNED_INTEGRAL_VECTOR_CONVERTERS(uchar)
22182243
DECLARE_SIGNED_INTEGRAL_VECTOR_CONVERTERS(short)
22192244
DECLARE_UNSIGNED_INTEGRAL_VECTOR_CONVERTERS(ushort)
@@ -2236,6 +2261,9 @@ DECLARE_FLOAT_VECTOR_CONVERTERS(double)
22362261
#undef DECLARE_SCHAR_VECTOR_CONVERTERS
22372262
#undef DECLARE_SCHAR_CONVERTER
22382263
#undef DECLARE_SCALAR_SCHAR_CONVERTER
2264+
#undef DECLARE_BOOL_VECTOR_CONVERTERS
2265+
#undef DECLARE_BOOL_CONVERTER
2266+
#undef DECLARE_SCALAR_BOOL_CONVERTER
22392267

22402268
} // namespace sycl
22412269
} // __SYCL_INLINE_NAMESPACE(cl)

0 commit comments

Comments
 (0)