DPC++ Runtime
Runtime libraries for oneAPI DPC++
types.hpp File Reference
#include <sycl/detail/generic_type_traits.hpp>
#include <sycl/access/access.hpp>
#include <sycl/aliases.hpp>
#include <sycl/detail/common.hpp>
#include <sycl/detail/helpers.hpp>
#include <sycl/detail/type_traits.hpp>
#include <sycl/half_type.hpp>
#include <sycl/marray.hpp>
#include <sycl/multi_ptr.hpp>
#include <sycl/detail/cl.h>
#include <array>
#include <cmath>
#include <cstring>
#include <optional>
#include <variant>
#include <cfenv>
#include "swizzles.def"
Include dependency graph for types.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sycl::_V1::elem
 
struct  sycl::_V1::detail::vec_helper< T >
 
struct  sycl::_V1::detail::vec_helper< std::byte >
 
class  sycl::_V1::detail::SwizzleOp< VecT, OperationLeftT, OperationRightT, OperationCurrentT, Indexes >
 
struct  sycl::_V1::detail::VecStorage< T, N, V >
 
class  sycl::_V1::detail::GetOp< T >
 
class  sycl::_V1::detail::GetScalarOp< T >
 
struct  sycl::_V1::detail::EqualTo< T >
 
struct  sycl::_V1::detail::NotEqualTo< T >
 
struct  sycl::_V1::detail::GreaterEqualTo< T >
 
struct  sycl::_V1::detail::LessEqualTo< T >
 
struct  sycl::_V1::detail::GreaterThan< T >
 
struct  sycl::_V1::detail::LessThan< T >
 
struct  sycl::_V1::detail::LogicalAnd< T >
 
struct  sycl::_V1::detail::LogicalOr< T >
 
struct  sycl::_V1::detail::RShift< T >
 
struct  sycl::_V1::detail::LShift< T >
 
class  sycl::_V1::detail::RoundedRangeKernel< TransformedArgType, Dims, KernelType >
 
class  sycl::_V1::detail::RoundedRangeKernelWithKH< TransformedArgType, Dims, KernelType >
 
class  sycl::_V1::vec< Type, NumElements >
 Provides a cross-patform vector class template that works efficiently on SYCL devices as well as in host C++ code. More...
 
class  sycl::_V1::detail::SwizzleOp< VecT, OperationLeftT, OperationRightT, OperationCurrentT, Indexes >
 
struct  sycl::_V1::detail::VecStorage< T, N, V >
 
struct  sycl::_V1::detail::VecStorageImpl< T, N >
 
struct  sycl::_V1::detail::VecStorage< bool, 1, void >
 
struct  sycl::_V1::detail::VecStorage< bool, N, typename std::enable_if_t< isValidVectorSize(N)> >
 
struct  sycl::_V1::detail::VecStorage< T, 1, typename std::enable_if_t< is_sigeninteger< T >::value > >
 
struct  sycl::_V1::detail::VecStorage< T, 1, typename std::enable_if_t< is_sugeninteger< T >::value > >
 
struct  sycl::_V1::detail::VecStorage< T, 1, typename std::enable_if_t<!is_half< T >::value &&is_sgenfloat< T >::value > >
 
struct  sycl::_V1::detail::VecStorage< T, N, typename std::enable_if_t< isValidVectorSize(N) &&(is_sgeninteger< T >::value||(is_sgenfloat< T >::value &&!is_half< T >::value))> >
 
struct  sycl::_V1::detail::VecStorage< half, 1, void >
 
struct  sycl::_V1::is_device_copyable< T, typename >
 is_device_copyable is a user specializable class template to indicate that a type T is device copyable, which means that SYCL implementation may copy objects of the type T between host and device or between two devices. More...
 
struct  sycl::_V1::is_device_copyable< T, std::enable_if_t< std::is_trivially_copyable< T >::value > >
 
struct  sycl::_V1::is_device_copyable< std::array< T, 0 > >
 
struct  sycl::_V1::is_device_copyable< std::array< T, N >, std::enable_if_t<!std::is_trivially_copyable< std::array< T, N > >::value > >
 
struct  sycl::_V1::is_device_copyable< std::optional< T >, std::enable_if_t<!std::is_trivially_copyable< std::optional< T > >::value > >
 
struct  sycl::_V1::is_device_copyable< std::pair< T1, T2 >, std::enable_if_t<!std::is_trivially_copyable< std::pair< T1, T2 > >::value > >
 
struct  sycl::_V1::is_device_copyable< std::tuple<> >
 
struct  sycl::_V1::is_device_copyable< std::tuple< T, Ts... >, std::enable_if_t<!std::is_trivially_copyable< std::tuple< T, Ts... > >::value > >
 
struct  sycl::_V1::is_device_copyable< std::variant<> >
 
struct  sycl::_V1::is_device_copyable< std::variant< Ts... >, std::enable_if_t<!std::is_trivially_copyable< std::variant< Ts... > >::value > >
 
struct  sycl::_V1::is_device_copyable< sycl::marray< T, N >, std::enable_if_t< is_device_copyable< T >::value &&!std::is_trivially_copyable< T >::value > >
 
struct  sycl::_V1::is_device_copyable< T[N], std::enable_if_t<!std::is_trivially_copyable< T >::value > >
 
struct  sycl::_V1::is_device_copyable< T, std::enable_if_t<!std::is_trivially_copyable< T >::value &&(std::is_const_v< T >||std::is_volatile_v< T >)> >
 
struct  sycl::_V1::detail::IsDeprecatedDeviceCopyable< T, typename >
 

Namespaces

 sycl
 ---— Error handling, matching OpenCL plugin semantics.
 
 sycl::_V1
 
 sycl::_V1::detail
 

Macros

#define __SYCL_ALIGNED_VAR(type, x, var)   alignas(x) type var
 
#define __SYCL_ALLOW_VECTOR_SIZES(num_elements)
 
#define __SYCL_ALLOW_VECTOR_TYPES(num_elements)
 
#define __SYCL_ACCESS_RETURN   this
 
#define __SYCL_BINOP(BINOP, OPASSIGN)
 
#define __SYCL_RELLOGOP(RELLOGOP)
 
#define __SYCL_UOP(UOP, OPASSIGN)
 
#define __SYCL_OPASSIGN(OPASSIGN, OP)
 
#define __SYCL_UOP(UOP, OPASSIGN)
 
#define __SYCL_ACCESS_RETURN   m_Vector
 
#define __SYCL_BINOP(BINOP)
 
#define __SYCL_RELLOGOP(RELLOGOP)
 
#define __SYCL_DEFINE_VECSTORAGE_IMPL(type, cl_type, num)
 
#define __SYCL_DEFINE_VECSTORAGE_IMPL_FOR_TYPE(type, cl_type)
 
#define __SYCL_DEFINE_HALF_VECSTORAGE(Num)
 
#define SYCL_DEVICE_COPYABLE   1
 This macro must be defined to 1 when SYCL implementation allows user applications to explicitly declare certain class types as device copyable by adding specializations of is_device_copyable type trait class. More...
 

Typedefs

template<typename DataT >
using sycl::_V1::detail::rel_t = typename detail::conditional_t< sizeof(DataT)==sizeof(opencl::cl_char), opencl::cl_char, typename detail::conditional_t< sizeof(DataT)==sizeof(opencl::cl_short), opencl::cl_short, typename detail::conditional_t< sizeof(DataT)==sizeof(opencl::cl_int), opencl::cl_int, typename detail::conditional_t< sizeof(DataT)==sizeof(opencl::cl_long), opencl::cl_long, bool > >> >
 
template<typename T , typename R >
using sycl::_V1::detail::is_int_to_int = std::integral_constant< bool, std::is_integral< T >::value &&std::is_integral< R >::value >
 
template<typename T , typename R >
using sycl::_V1::detail::is_sint_to_sint = std::integral_constant< bool, is_sigeninteger< T >::value &&is_sigeninteger< R >::value >
 
template<typename T , typename R >
using sycl::_V1::detail::is_uint_to_uint = std::integral_constant< bool, is_sugeninteger< T >::value &&is_sugeninteger< R >::value >
 
template<typename T , typename R >
using sycl::_V1::detail::is_sint_to_from_uint = std::integral_constant< bool,(is_sugeninteger< T >::value &&is_sigeninteger< R >::value)||(is_sigeninteger< T >::value &&is_sugeninteger< R >::value)>
 
template<typename T , typename R >
using sycl::_V1::detail::is_sint_to_float = std::integral_constant< bool, std::is_integral< T >::value &&!(std::is_unsigned< T >::value) &&detail::is_floating_point< R >::value >
 
template<typename T , typename R >
using sycl::_V1::detail::is_uint_to_float = std::integral_constant< bool, std::is_unsigned< T >::value &&detail::is_floating_point< R >::value >
 
template<typename T , typename R >
using sycl::_V1::detail::is_int_to_float = std::integral_constant< bool, std::is_integral< T >::value &&detail::is_floating_point< R >::value >
 
template<typename T , typename R >
using sycl::_V1::detail::is_float_to_int = std::integral_constant< bool, detail::is_floating_point< T >::value &&std::is_integral< R >::value >
 
template<typename T , typename R >
using sycl::_V1::detail::is_float_to_float = std::integral_constant< bool, detail::is_floating_point< T >::value &&detail::is_floating_point< R >::value >
 
template<typename T >
using sycl::_V1::detail::is_standard_type = std::integral_constant< bool, detail::is_sgentype< T >::value >
 
template<typename T >
using sycl::_V1::vec_data = detail::vec_helper< T >
 
template<typename T >
using sycl::_V1::vec_data_t = typename detail::vec_helper< T >::RetType
 
template<typename _IN , typename T8 , typename T16 , typename T32 , typename T64 >
using sycl::_V1::detail::select_apply_cl_t = conditional_t< sizeof(_IN)==1, T8, conditional_t< sizeof(_IN)==2, T16, conditional_t< sizeof(_IN)==4, T32, T64 > >>
 

Enumerations

enum  sycl::_V1::rounding_mode {
  sycl::_V1::rounding_mode::automatic = 0, sycl::_V1::rounding_mode::rte = 1, sycl::_V1::rounding_mode::rtz = 2, sycl::_V1::rounding_mode::rtp = 3,
  sycl::_V1::rounding_mode::rtn = 4
}
 

Functions

template<typename T , typename R , rounding_mode roundingMode, typename OpenCLT , typename OpenCLR >
detail::enable_if_t< std::is_same< T, R >::value, R > sycl::_V1::detail::convertImpl (T Value)
 
template<typename T , typename R , rounding_mode roundingMode, typename OpenCLT , typename OpenCLR >
detail::enable_if_t<!std::is_same< T, R >::value &&(is_int_to_int< T, R >::value||is_int_to_float< T, R >::value||is_float_to_float< T, R >::value), R > sycl::_V1::detail::convertImpl (T Value)
 
template<typename T , typename R , rounding_mode roundingMode, typename OpenCLT , typename OpenCLR >
detail::enable_if_t< is_float_to_int< T, R >::value, R > sycl::_V1::detail::convertImpl (T Value)
 
constexpr bool sycl::_V1::detail::isValidVectorSize (int N)
 
template<typename T >
struct sycl::_V1::detail::__SYCL2020_DEPRECATED ("This type isn't device copyable in SYCL 2020") IsDeprecatedDeviceCopyable< T
 

Variables

template<typename T >
constexpr bool sycl::_V1::is_device_copyable_v = is_device_copyable<T>::value
 

Macro Definition Documentation

◆ __SYCL_ACCESS_RETURN [1/2]

#define __SYCL_ACCESS_RETURN   this

Definition at line 1879 of file types.hpp.

◆ __SYCL_ACCESS_RETURN [2/2]

#define __SYCL_ACCESS_RETURN   m_Vector

Definition at line 1879 of file types.hpp.

◆ __SYCL_ALIGNED_VAR

#define __SYCL_ALIGNED_VAR (   type,
  x,
  var 
)    alignas(x) type var

Definition at line 560 of file types.hpp.

◆ __SYCL_ALLOW_VECTOR_SIZES

#define __SYCL_ALLOW_VECTOR_SIZES (   num_elements)
Value:
template <int Counter, int MaxValue, typename DataT_, class... tail> \
struct SizeChecker<Counter, MaxValue, vec<DataT_, num_elements>, tail...> \
Counter + (num_elements) <= MaxValue, \
SizeChecker<Counter + (num_elements), MaxValue, tail...>, \
std::false_type> {}; \
template <int Counter, int MaxValue, typename DataT_, typename T2, \
typename T3, template <typename> class T4, int... T5, \
class... tail> \
struct SizeChecker< \
Counter, MaxValue, \
detail::SwizzleOp<vec<DataT_, num_elements>, T2, T3, T4, T5...>, \
tail...> \
Counter + sizeof...(T5) <= MaxValue, \
SizeChecker<Counter + sizeof...(T5), MaxValue, tail...>, \
std::false_type> {}; \
template <int Counter, int MaxValue, typename DataT_, typename T2, \
typename T3, template <typename> class T4, int... T5, \
class... tail> \
struct SizeChecker< \
Counter, MaxValue, \
detail::SwizzleOp<const vec<DataT_, num_elements>, T2, T3, T4, T5...>, \
tail...> \
: detail::conditional_t< \
Counter + sizeof...(T5) <= MaxValue, \
SizeChecker<Counter + sizeof...(T5), MaxValue, tail...>, \
std::false_type> {};

◆ __SYCL_ALLOW_VECTOR_TYPES

#define __SYCL_ALLOW_VECTOR_TYPES (   num_elements)
Value:
template <typename DataT_> \
struct TypeChecker<vec<DataT_, num_elements>, DataT_> : std::true_type {}; \
template <typename DataT_, typename T2, typename T3, \
template <typename> class T4, int... T5> \
struct TypeChecker< \
detail::SwizzleOp<vec<DataT_, num_elements>, T2, T3, T4, T5...>, DataT_> \
: std::true_type {}; \
template <typename DataT_, typename T2, typename T3, \
template <typename> class T4, int... T5> \
struct TypeChecker< \
detail::SwizzleOp<const vec<DataT_, num_elements>, T2, T3, T4, T5...>, \
DataT_> : std::true_type {};

◆ __SYCL_BINOP [1/2]

#define __SYCL_BINOP (   BINOP)

Definition at line 1990 of file types.hpp.

◆ __SYCL_BINOP [2/2]

#define __SYCL_BINOP (   BINOP,
  OPASSIGN 
)
Value:
vec operator BINOP(const vec &Rhs) const { \
vec Ret; \
for (size_t I = 0; I < NumElements; ++I) { \
Ret.setValue(I, (getValue(I) BINOP Rhs.getValue(I))); \
} \
return Ret; \
} \
template <typename T> \
typename detail::enable_if_t< \
std::is_convertible<DataT, T>::value && \
(std::is_fundamental<vec_data_t<T>>::value || \
std::is_same<typename detail::remove_const_t<T>, half>::value), \
vec> \
operator BINOP(const T &Rhs) const { \
return *this BINOP vec(static_cast<const DataT &>(Rhs)); \
} \
vec &operator OPASSIGN(const vec &Rhs) { \
*this = *this BINOP Rhs; \
return *this; \
} \
template <int Num = NumElements> \
typename detail::enable_if_t<Num != 1, vec &> operator OPASSIGN( \
const DataT &Rhs) { \
*this = *this BINOP vec(Rhs); \
return *this; \
}

Definition at line 1990 of file types.hpp.

◆ __SYCL_DEFINE_HALF_VECSTORAGE

#define __SYCL_DEFINE_HALF_VECSTORAGE (   Num)
Value:
template <> struct VecStorage<half, Num, void> { \
using DataType = sycl::detail::half_impl::Vec##Num##StorageT; \
};

Definition at line 2199 of file types.hpp.

◆ __SYCL_DEFINE_VECSTORAGE_IMPL

#define __SYCL_DEFINE_VECSTORAGE_IMPL (   type,
  cl_type,
  num 
)
Value:
template <> struct VecStorageImpl<type, num> { \
using DataType = ::cl_##cl_type##num; \
};

Definition at line 2121 of file types.hpp.

◆ __SYCL_DEFINE_VECSTORAGE_IMPL_FOR_TYPE

#define __SYCL_DEFINE_VECSTORAGE_IMPL_FOR_TYPE (   type,
  cl_type 
)
Value:
__SYCL_DEFINE_VECSTORAGE_IMPL(type, cl_type, 2) \
__SYCL_DEFINE_VECSTORAGE_IMPL(type, cl_type, 3) \
__SYCL_DEFINE_VECSTORAGE_IMPL(type, cl_type, 4) \
__SYCL_DEFINE_VECSTORAGE_IMPL(type, cl_type, 8) \
__SYCL_DEFINE_VECSTORAGE_IMPL(type, cl_type, 16)

Definition at line 2125 of file types.hpp.

◆ __SYCL_OPASSIGN

#define __SYCL_OPASSIGN (   OPASSIGN,
  OP 
)
Value:
SwizzleOp &operator OPASSIGN(const DataT &Rhs) { \
operatorHelper<OP>(vec_t(Rhs)); \
return *this; \
} \
template <typename RhsOperation> \
SwizzleOp &operator OPASSIGN(const RhsOperation &Rhs) { \
operatorHelper<OP>(Rhs); \
return *this; \
}

Definition at line 1515 of file types.hpp.

◆ __SYCL_RELLOGOP [1/2]

#define __SYCL_RELLOGOP (   RELLOGOP)
Value:
vec<rel_t, NumElements> operator RELLOGOP(const vec &Rhs) const { \
vec<rel_t, NumElements> Ret; \
for (size_t I = 0; I < NumElements; ++I) { \
Ret.setValue(I, -(vec_data<DataT>::get(getValue(I)) \
RELLOGOP vec_data<DataT>::get(Rhs.getValue(I)))); \
} \
return Ret; \
} \
template <typename T> \
typename detail::enable_if_t< \
std::is_convertible<T, DataT>::value && \
(std::is_fundamental<vec_data_t<T>>::value || \
std::is_same<T, half>::value), \
vec<rel_t, NumElements>> \
operator RELLOGOP(const T &Rhs) const { \
return *this RELLOGOP vec(static_cast<const DataT &>(Rhs)); \
}

Definition at line 2044 of file types.hpp.

◆ __SYCL_RELLOGOP [2/2]

#define __SYCL_RELLOGOP (   RELLOGOP)

Definition at line 2044 of file types.hpp.

◆ __SYCL_UOP [1/2]

#define __SYCL_UOP (   UOP,
  OPASSIGN 
)
Value:
vec &operator UOP() { \
*this OPASSIGN vec_data<DataT>::get(1); \
return *this; \
} \
vec operator UOP(int) { \
vec Ret(*this); \
*this OPASSIGN vec_data<DataT>::get(1); \
return Ret; \
}

Definition at line 1541 of file types.hpp.

◆ __SYCL_UOP [2/2]

#define __SYCL_UOP (   UOP,
  OPASSIGN 
)
Value:
SwizzleOp &operator UOP() { \
*this OPASSIGN static_cast<DataT>(1); \
return *this; \
} \
vec_t operator UOP(int) { \
vec_t Ret = *this; \
*this OPASSIGN static_cast<DataT>(1); \
return Ret; \
}

Definition at line 1541 of file types.hpp.

◆ SYCL_DEVICE_COPYABLE

#define SYCL_DEVICE_COPYABLE   1

This macro must be defined to 1 when SYCL implementation allows user applications to explicitly declare certain class types as device copyable by adding specializations of is_device_copyable type trait class.

Definition at line 2214 of file types.hpp.

sycl::_V1::detail::enable_if_t
typename std::enable_if< B, T >::type enable_if_t
Definition: stl_type_traits.hpp:24
std::get
constexpr tuple_element< I, tuple< Types... > >::type & get(sycl::detail::tuple< Types... > &Arg) noexcept
Definition: tuple.hpp:199
__SYCL_DEFINE_VECSTORAGE_IMPL
#define __SYCL_DEFINE_VECSTORAGE_IMPL(type, cl_type, num)
Definition: types.hpp:2121
sycl::_V1::half
sycl::detail::half_impl::half half
Definition: aliases.hpp:99
sycl::_V1::detail::half_impl::StorageT
detail::host_half_impl::half StorageT
Definition: half_type.hpp:241
sycl::_V1::detail::conditional_t
typename std::conditional< B, T, F >::type conditional_t
Definition: stl_type_traits.hpp:27