Skip to content

Commit 6a055ec

Browse files
authored
[SYCL] Widen (u)int8/16 to (u)int32 in group operations (#4242)
CPU device does not yet support the (u)int8/16 versions.
1 parent e5e6a7f commit 6a055ec

File tree

2 files changed

+505
-1
lines changed

2 files changed

+505
-1
lines changed

sycl/include/sycl/ext/oneapi/functional.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,15 @@ struct GroupOpTag<T, detail::enable_if_t<detail::is_sgenfloat<T>::value>> {
9191
#define __SYCL_CALC_OVERLOAD(GroupTag, SPIRVOperation, BinaryOperation) \
9292
template <typename T, __spv::GroupOperation O, __spv::Scope::Flag S> \
9393
static T calc(GroupTag, T x, BinaryOperation) { \
94-
using OCLT = detail::ConvertToOpenCLType_t<T>; \
94+
using ConvertedT = detail::ConvertToOpenCLType_t<T>; \
95+
\
96+
using OCLT = \
97+
conditional_t<std::is_same<ConvertedT, cl_char>() || \
98+
std::is_same<ConvertedT, cl_short>(), \
99+
cl_int, \
100+
conditional_t<std::is_same<ConvertedT, cl_uchar>() || \
101+
std::is_same<ConvertedT, cl_ushort>(), \
102+
cl_uint, ConvertedT>>; \
95103
OCLT Arg = x; \
96104
OCLT Ret = \
97105
__spirv_Group##SPIRVOperation(S, static_cast<unsigned int>(O), Arg); \

0 commit comments

Comments
 (0)