Skip to content

[SYCL] added type declarations to support boolX and pass scalar_sycl_types test #2381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions sycl/include/CL/sycl/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2117,6 +2117,14 @@ using select_apply_cl_t =
GET_CL_TYPE(int, num), GET_CL_TYPE(long, num)>; \
};

#define DECLARE_BOOL_CONVERTER(num) \
template <> class BaseCLTypeConverter<bool, num> { \
public: \
using DataType = detail::select_apply_cl_t< \
bool, GET_CL_TYPE(char, num), GET_CL_TYPE(short, num), \
GET_CL_TYPE(int, num), GET_CL_TYPE(long, num)>; \
};

#define DECLARE_HALF_CONVERTER(base, num) \
template <> class BaseCLTypeConverter<base, num> { \
public: \
Expand All @@ -2129,6 +2137,12 @@ using select_apply_cl_t =
using DataType = schar; \
};

#define DECLARE_SCALAR_BOOL_CONVERTER \
template <> class BaseCLTypeConverter<bool, 1> { \
public: \
using DataType = bool; \
};

#define DECLARE_SCALAR_CONVERTER(base) \
template <> class BaseCLTypeConverter<base, 1> { \
public: \
Expand Down Expand Up @@ -2212,8 +2226,19 @@ using select_apply_cl_t =
DECLARE_SCALAR_SCHAR_CONVERTER \
} // namespace detail

#define DECLARE_BOOL_VECTOR_CONVERTERS \
namespace detail { \
DECLARE_BOOL_CONVERTER(2) \
DECLARE_BOOL_CONVERTER(3) \
DECLARE_BOOL_CONVERTER(4) \
DECLARE_BOOL_CONVERTER(8) \
DECLARE_BOOL_CONVERTER(16) \
DECLARE_SCALAR_BOOL_CONVERTER \
} // namespace detail

DECLARE_VECTOR_CONVERTERS(char)
DECLARE_SCHAR_VECTOR_CONVERTERS
DECLARE_BOOL_VECTOR_CONVERTERS
DECLARE_UNSIGNED_INTEGRAL_VECTOR_CONVERTERS(uchar)
DECLARE_SIGNED_INTEGRAL_VECTOR_CONVERTERS(short)
DECLARE_UNSIGNED_INTEGRAL_VECTOR_CONVERTERS(ushort)
Expand All @@ -2236,6 +2261,9 @@ DECLARE_FLOAT_VECTOR_CONVERTERS(double)
#undef DECLARE_SCHAR_VECTOR_CONVERTERS
#undef DECLARE_SCHAR_CONVERTER
#undef DECLARE_SCALAR_SCHAR_CONVERTER
#undef DECLARE_BOOL_VECTOR_CONVERTERS
#undef DECLARE_BOOL_CONVERTER
#undef DECLARE_SCALAR_BOOL_CONVERTER

} // namespace sycl
} // __SYCL_INLINE_NAMESPACE(cl)
Expand Down