Skip to content

Commit 1f463fe

Browse files
committed
[SYCL] Fix long long support in vec::convert on Windows
- Keep `long long` and `unsigned long long` in `is_standard_type`. Excluding them resulted in duplicate `convertImpl` definitions on Windows when converting from `long long` or `unsigned long long`: SPIR-V-based and the non-standard type version. - For to-int SPIR-V-based `convertImpl` overload resolution, compare the OpenCL return type with cl_DestType instead of simply DestType ((u)char, (u)short, (u)int, (u)long). When converting to `long long` or `unsigned long long` on Windows, the non-standard type version was used instead of these functions, because `cl_long == long long != long` there.
1 parent f295e78 commit 1f463fe

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sycl/include/CL/sycl/types.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,8 @@ using is_float_to_float =
242242
std::integral_constant<bool, detail::is_floating_point<T>::value &&
243243
detail::is_floating_point<R>::value>;
244244
template <typename T>
245-
using is_standard_type = std::integral_constant<
246-
bool, detail::is_sgentype<T>::value && !std::is_same<T, long long>::value &&
247-
!std::is_same<T, unsigned long long>::value>;
245+
using is_standard_type =
246+
std::integral_constant<bool, detail::is_sgentype<T>::value>;
248247

249248
template <typename T, typename R, rounding_mode roundingMode, typename OpenCLT,
250249
typename OpenCLR>
@@ -330,7 +329,7 @@ convertImpl(T Value) {
330329
typename OpenCLT, typename OpenCLR> \
331330
detail::enable_if_t<is_sint_to_sint<T, R>::value && \
332331
!std::is_same<OpenCLT, OpenCLR>::value && \
333-
(std::is_same<OpenCLR, DestType>::value || \
332+
(std::is_same<OpenCLR, cl_##DestType>::value || \
334333
(std::is_same<OpenCLR, signed char>::value && \
335334
std::is_same<DestType, char>::value)), \
336335
R> \
@@ -352,7 +351,7 @@ __SYCL_GENERATE_CONVERT_IMPL(long)
352351
typename OpenCLT, typename OpenCLR> \
353352
detail::enable_if_t<is_uint_to_uint<T, R>::value && \
354353
!std::is_same<OpenCLT, OpenCLR>::value && \
355-
std::is_same<OpenCLR, DestType>::value, \
354+
std::is_same<OpenCLR, cl_##DestType>::value, \
356355
R> \
357356
convertImpl(T Value) { \
358357
OpenCLT OpValue = cl::sycl::detail::convertDataToType<T, OpenCLT>(Value); \
@@ -454,7 +453,7 @@ __SYCL_GENERATE_CONVERT_IMPL_FOR_ROUNDING_MODE(rtn, Rtn)
454453
template <typename T, typename R, rounding_mode roundingMode, \
455454
typename OpenCLT, typename OpenCLR> \
456455
detail::enable_if_t<is_float_to_int<T, R>::value && \
457-
(std::is_same<OpenCLR, DestType>::value || \
456+
(std::is_same<OpenCLR, cl_##DestType>::value || \
458457
std::is_same<OpenCLR, signed char>::value && \
459458
std::is_same<DestType, char>::value) && \
460459
RoundingModeCondition<roundingMode>::value, \

0 commit comments

Comments
 (0)