DPC++ Runtime
Runtime libraries for oneAPI DPC++
|
|
Go to the documentation of this file.
23 #include <type_traits>
26 inline namespace _V1 {
66 std::is_same_v<T, sycl::marray<marray_element_t<T>, T::size()>> &&
102 template <
typename T>
105 template <
typename T>
108 template <
typename T>
111 template <
typename T>
114 template <
typename T>
117 template <
typename T>
120 template <
typename T>
123 template <
typename T>
128 template <
typename T>
131 template <
typename T>
134 template <
typename T>
137 template <
typename T>
140 template <
typename T>
143 template <
typename T>
146 template <
typename T>
151 template <
typename T>
154 template <
typename T>
157 template <
typename T>
160 template <
typename T>
163 template <
typename T>
166 template <
typename T>
171 template <
typename T>
174 template <
typename T>
177 template <
typename T>
180 template <
typename T>
183 template <
typename T>
186 template <
typename T>
189 template <
typename T>
192 template <
typename T>
199 template <
typename T>
202 template <
typename T>
205 template <
typename T>
208 template <
typename T>
211 template <
typename T>
214 template <
typename T>
217 template <
typename T>
220 template <
typename T>
223 template <
typename T>
226 template <
typename T>
229 template <
typename T>
232 template <
typename T>
235 template <
typename T>
238 template <
typename T>
241 template <
typename T>
249 std::is_same_v<T, sycl::marray<marray_element_t<T>, T::size()>> &&
256 template <
typename T>
270 template <
typename T>
278 template <
typename T,
typename Enable =
void>
struct nan_types;
280 template <
typename T>
282 T,
std::enable_if_t<is_contained<T, gtl::unsigned_short_list>::value, T>> {
287 template <
typename T>
289 T,
std::enable_if_t<is_contained<T, gtl::unsigned_int_list>::value, T>> {
294 template <
typename T>
296 T,
std::enable_if_t<is_contained<T, gtl::unsigned_long_integer_list>::value,
305 template <
typename T>
308 template <
typename T>
311 template <
typename T>
314 template <
typename T>
318 template <
typename T,
typename B,
typename Enable =
void>
321 template <
typename T,
typename B>
323 std::enable_if_t<is_sgentype<T>::value, T>> {
327 template <
typename T,
typename B>
329 std::enable_if_t<is_vgentype<T>::value, T>> {
333 template <
typename T,
typename B>
340 template <
typename A>
static typename A::pointer_t check(
const A &);
341 template <
typename A>
static typename A::pointer check(
const A &);
344 using type = decltype(check(T()));
346 std::is_pointer_v<T> || !std::is_same_v<T, type>;
353 template <
typename A>
static typename A::element_type check(
const A &);
354 template <
typename A>
static typename A::value_type check(
const A &);
357 using type = decltype(check(T()));
358 static constexpr
bool value = !std::is_same_v<T, type>;
364 template <
typename A>
static typename A::vector_t check(
const A &);
367 using type = decltype(check(T()));
368 static constexpr
bool value = !std::is_same_v<T, type>;
375 template <
typename A>
380 template <
typename A>
384 using type = decltype(check(T()));
388 template <
typename From>
static To
Convert(From *t) {
389 return reinterpret_cast<To
>(t);
392 template <
typename From>
static To
Convert(From &t) {
393 if constexpr (is_non_legacy_multi_ptr_v<From>) {
394 return detail::cast_AS<To>(t.get_decorated());
395 }
else if constexpr (is_legacy_multi_ptr_v<From>) {
396 return detail::cast_AS<To>(t.get());
400 return reinterpret_cast<To
>(t.get());
408 template <
typename From>
410 return address_space_cast<Space, DecorateAddress>(
414 template <
typename From>
416 return address_space_cast<Space, DecorateAddress>(
420 template <
typename From>
427 template <
typename To,
typename From,
428 typename =
typename std::enable_if_t<TryToGetPointerT<From>::value>>
437 template <
typename To,
typename From>
438 typename std::enable_if_t<!TryToGetPointerT<From>::value, To>
440 return static_cast<To
>(t);
449 multi_ptr<ElementType, Space, IsDecorated>,
450 std::enable_if_t<IsDecorated == access::decorated::no ||
451 IsDecorated == access::decorated::yes>> {
459 template <
typename T>
464 template <
typename T,
typename T8,
typename T16,
typename T32,
typename T64>
467 std::conditional_t<
sizeof(T) == 2, T16,
468 std::conditional_t<
sizeof(T) == 4, T32, T64>>>;
471 template <
typename T>
476 template <
typename T>
481 template <
typename T>
493 template <
typename T>
497 template <
typename T>
499 std::conditional_t<std::is_signed_v<T>,
505 template <
typename T>
513 std::conditional_t<is_half<T>::value,
520 template <
typename T,
typename Enable =
void>
523 template <
typename T>
525 T, typename
std::enable_if_t<is_vgentype<T>::value>> {
536 template <
typename T>
538 T, typename
std::enable_if_t<!is_vgentype<T>::value &&
539 !std::is_pointer_v<T>>> {
543 template <
typename T>
546 typename
std::enable_if_t<!is_vgentype<T>::value && std::is_pointer_v<T>>> {
549 #ifdef __SYCL_DEVICE_ONLY__
560 template <
typename T,
typename Enable =
void>
569 #if (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE != 0)
589 template <
typename T>
592 typename
std::enable_if_t<is_genptr<T>::value && !std::is_pointer_v<T>>> {
598 template <
typename T>
601 typename
std::enable_if_t<!is_genptr<T>::value || std::is_pointer_v<T>>> {
606 template <
typename T>
612 template <
typename T >
615 std::conditional_t<TryToGetPointerT<T>::value,
617 template <
typename T>
623 template <
typename FROM,
typename TO>
625 sizeof(TO) ==
sizeof(FROM),
628 return t.template as<TO>();
631 template <
typename FROM,
typename TO>
632 typename std::enable_if_t<!(is_vgentype<FROM>::value &&
633 is_vgentype<TO>::value) &&
634 sizeof(TO) ==
sizeof(FROM),
637 return ConvertNonVectorType<TO>(t);
641 template <
typename T>
inline constexpr T
msbMask(T) {
643 return T(UT(1) << (
sizeof(T) * 8 - 1));
646 template <
typename T>
inline constexpr
bool msbIsSet(
const T x) {
656 template <
typename T>
661 template <
int N>
struct Boolean;
666 template <
typename T>
668 T, typename
std::enable_if_t<TryToGetVectorT<T>::value>> {
669 static constexpr
int value = T::size();
671 template <
typename T>
673 T, typename
std::enable_if_t<!TryToGetVectorT<T>::value>> {
674 static constexpr
int value = 1;
679 #ifdef __SYCL_DEVICE_ONLY__
687 template <
typename T>
692 #ifdef __SYCL_DEVICE_ONLY__
701 template <
typename T>
705 template <
typename T>
711 template <
typename T>
713 typename
std::enable_if_t<TryToGetElementType<T>::value>> {
714 static const int N = T::size();
715 #ifdef __SYCL_DEVICE_ONLY__
724 #ifdef __SYCL_DEVICE_ONLY__
725 typename ret_t::vector_t result(0);
726 for (
size_t I = 0; I < N; ++I) {
727 result[I] = value[I];
736 template <
typename T>
738 typename
std::enable_if_t<!TryToGetElementType<T>::value>> {
740 #ifdef __SYCL_DEVICE_ONLY__
749 template <
typename T>
static constexpr T
max_v() {
753 template <
typename T>
static constexpr T
min_v() {
764 template <
int FirstSize,
typename T,
typename... Args>
768 static constexpr
bool IsSizeEqual = (Size == FirstSize);
771 static constexpr
bool value =
775 template <
int FirstSize>
789 "The built-in function arguments must [point to|have] types "
790 "with the same number of elements.");
std::enable_if_t< is_vgentype< FROM >::value &&is_vgentype< TO >::value &&sizeof(TO)==sizeof(FROM), TO > convertDataToType(FROM t)
static To Convert(From &t)
find_same_size_type_t< gtl::scalar_unsigned_int_list, float > arg_type
is_gen_based_on_type_sizeof< T, 8, is_ugeninteger > is_ugeninteger64bit
select_apply_cl_scalar_t< T, sycl::opencl::cl_uchar, sycl::opencl::cl_ushort, sycl::opencl::cl_uint, sycl::opencl::cl_ulong > select_cl_scalar_integral_unsigned_t
make_type_t< T, gtl::scalar_signed_integer_list > make_singed_integer_t
is_gen_based_on_type_sizeof< T, 8, is_igeninteger > is_igeninteger64bit
typename TypeHelper< T >::RetType type_helper
find_same_size_type_t< gtl::scalar_unsigned_short_list, half > arg_type
is_gen_based_on_type_sizeof< T, 1, is_ugeninteger > is_ugeninteger8bit
std::bool_constant< is_pointer< T >::value &&is_genfloat< remove_pointer_t< T > >::value &&is_address_space_compliant< T, gvl::nonconst_address_space_list >::value > is_genfloatptr
is_gen_based_on_type_sizeof< T, 2, is_geninteger > is_geninteger16bit
constexpr bool msbIsSet(const T x)
common_rel_ret_t< T > type
select_apply_cl_scalar_t< T, sycl::opencl::cl_char, sycl::opencl::cl_short, sycl::opencl::cl_int, sycl::opencl::cl_long > select_cl_scalar_integral_signed_t
std::conditional_t< sizeof(T)==1, T8, std::conditional_t< sizeof(T)==2, T16, std::conditional_t< sizeof(T)==4, T32, T64 > >> select_apply_cl_scalar_t
vec< B, T::size()> operator()(T t)
static constexpr bool value
static constexpr T quiet_NaN()
typename select_cl_vector_or_scalar_or_ptr< T >::type type
To ConvertNonVectorType(From &t)
---— Error handling, matching OpenCL plugin semantics.
decltype(check(T())) type
std::bool_constant< std::is_same_v< T, sycl::marray< marray_element_t< T >, T::size()> > &&is_genint< marray_element_t< remove_pointer_t< T > >>::value &&is_address_space_compliant< multi_ptr< T, AddressSpace, IsDecorated >, gvl::nonconst_address_space_list >::value &&(IsDecorated==access::decorated::yes||IsDecorated==access::decorated::no)> is_genintptr_marray
change_base_type_t< T, float > ret_type
static constexpr bool value
simd< _Tp, _Abi > max(const simd< _Tp, _Abi > &, const simd< _Tp, _Abi > &) noexcept
typename multi_ptr< ElementType, Space, IsDecorated >::value_type type
static constexpr T min_v()
internal_rel_ret_t< T > ret_t
find_same_size_type_t< gtl::scalar_unsigned_long_integer_list, double > arg_type
std::bool_constant< S< T >::value &&(sizeof(vector_element_t< T >)==N)> is_gen_based_on_type_sizeof
change_base_type_t< T, half > ret_type
static multi_ptr< ElementType, Space, DecorateAddress > Convert(multi_ptr< ElementType, Space, DecorateAddress > &t)
typename remove_decoration< T >::type remove_decoration_t
std::bool_constant< std::is_same_v< T, sycl::marray< marray_element_t< T >, T::size()> > &&is_svgenfloat< marray_element_t< T > >::value > is_mgenfloat
typename make_type_impl< T, TL >::type make_type_t
typename RelationalTestForSignBitType< T >::argument_type rel_sign_bit_test_arg_t
typename make_unsigned< T >::type make_unsigned_t
typename remove_pointer< T >::type remove_pointer_t
is_gen_based_on_type_sizeof< T, 2, is_igeninteger > is_igeninteger16bit
Provides constructors for address space qualified and non address space qualified pointers to allow i...
typename RelationalReturnType< T >::type internal_rel_ret_t
make_type_t< T, gtl::scalar_floating_list > make_floating_point_t
typename change_base_type< T, B >::type change_base_type_t
typename mptr_or_vec_elem_type< T >::type mptr_or_vec_elem_type_t
volatile typename TypeHelper< T >::RetType RetType
internal_rel_ret_t< T > R
static constexpr bool value
find_type_t< TypeList, is_type_size_equal, T > find_same_size_type_t
make_type_t< T, gtl::scalar_unsigned_integer_list > make_unsinged_integer_t
static constexpr bool value
static R apply(value_t value)
select_cl_scalar_t< T > type
const typename TypeHelper< T >::RetType RetType
typename RelationalTestForSignBitType< T >::return_type rel_sign_bit_test_ret_t
std::conditional_t< std::is_same_v< ElementType, half >, sycl::detail::half_impl::BIsRepresentationT, ElementType > element_type
decltype(check(T())) type
change_base_type_t< T, double > ret_type
std::conditional_t< std::is_signed_v< T >, select_cl_scalar_integral_signed_t< T >, select_cl_scalar_integral_unsigned_t< T > > select_cl_scalar_integral_t
typename multi_ptr< ElementType, Space, IsDecorated > ::element_type type
decltype(check(T())) type
typename nan_types< T, T >::ret_type nan_return_t
is_gen_based_on_type_sizeof< T, 8, is_geninteger > is_geninteger64bit
static ret_t apply(bool_t value)
decltype(check(T())) type
Provides a cross-patform vector class template that works efficiently on SYCL devices as well as in h...
select_apply_cl_scalar_t< T, std::false_type, sycl::opencl::cl_half, sycl::opencl::cl_float, sycl::opencl::cl_double > select_cl_scalar_float_t
std::bool_constant< is_pointer< T >::value &&is_gentype< remove_pointer_t< T > >::value &&is_address_space_compliant< T, gvl::nonconst_address_space_list >::value > is_genptr
static multi_ptr< ElementType, Space, DecorateAddress > Convert(From *t)
static constexpr T max_v()
is_gen_based_on_type_sizeof< T, 1, is_geninteger > is_geninteger8bit
typename select_cl_vector_or_scalar_or_ptr< std::remove_pointer_t< T > >::type * elem_ptr_type
is_gen_based_on_type_sizeof< T, 4, is_ugeninteger > is_ugeninteger32bit
const volatile typename TypeHelper< T >::RetType RetType
std::bool_constant< is_pointer< T >::value &&is_genint< remove_pointer_t< T > >::value &&is_address_space_compliant< T, gvl::nonconst_address_space_list >::value > is_genintptr
ConvertToOpenCLTypeImpl_t< SelectMatchingOpenCLType_t< T > > ConvertToOpenCLType_t
std::conditional_t< is_vgentype< T >::value, make_singed_integer_t< T >, bool > common_rel_ret_t
is_gen_based_on_type_sizeof< T, 4, is_igeninteger > is_igeninteger32bit
static To Convert(From *t)
typename nan_types< T, T >::arg_type nan_argument_base_t
is_gen_based_on_type_sizeof< T, 4, is_geninteger > is_geninteger32bit
std::conditional_t< std::is_integral_v< T >, select_cl_scalar_integral_t< T >, std::conditional_t< std::is_floating_point_v< T >, select_cl_scalar_float_t< T >, std::conditional_t< is_half< T >::value, sycl::detail::half_impl::BIsRepresentationT, select_cl_scalar_complex_or_T_t< T > >> > select_cl_scalar_t
is_gen_based_on_type_sizeof< T, 2, is_ugeninteger > is_ugeninteger16bit
static multi_ptr< ElementType, Space, DecorateAddress > Convert(From &t)
typename select_cl_scalar_complex_or_T< T >::type select_cl_scalar_complex_or_T_t
std::conditional_t< TryToGetVectorT< T >::value, typename TryToGetVectorT< T >::type, std::conditional_t< TryToGetPointerT< T >::value, typename TryToGetPointerVecT< T >::type, T > > ConvertToOpenCLTypeImpl_t
is_gen_based_on_type_sizeof< T, 1, is_igeninteger > is_igeninteger8bit
std::bool_constant< is_mgenfloat< T >::value &&is_address_space_compliant< multi_ptr< T, AddressSpace, IsDecorated >, gvl::nonconst_address_space_list >::value &&(IsDecorated==access::decorated::yes||IsDecorated==access::decorated::no)> is_genfloatptr_marray
typename detail::LegacyPointerTypes< ElementType, Space >::pointer_t pointer_t
simd< _Tp, _Abi > min(const simd< _Tp, _Abi > &, const simd< _Tp, _Abi > &) noexcept
typename select_cl_mptr_or_vector_or_scalar_or_ptr< T >::type SelectMatchingOpenCLType_t