DPC++ Runtime
Runtime libraries for oneAPI DPC++
types.hpp File Reference
#include <sycl/access/access.hpp>
#include <sycl/aliases.hpp>
#include <sycl/detail/common.hpp>
#include <sycl/detail/defines_elementary.hpp>
#include <sycl/detail/generic_type_lists.hpp>
#include <sycl/detail/generic_type_traits.hpp>
#include <sycl/detail/memcpy.hpp>
#include <sycl/detail/type_list.hpp>
#include <sycl/detail/type_traits.hpp>
#include <sycl/detail/vector_traits.hpp>
#include <sycl/exception.hpp>
#include <sycl/half_type.hpp>
#include <sycl/marray.hpp>
#include <sycl/multi_ptr.hpp>
#include <array>
#include <assert.h>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <iterator>
#include <optional>
#include <ostream>
#include <tuple>
#include <type_traits>
#include <utility>
#include <variant>
#include <sycl/builtins_scalar_gen.hpp>
#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< bool >
 
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_v< T > > >
 
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_v< std::array< T, N > > > >
 
struct  sycl::_V1::is_device_copyable< std::optional< T >, std::enable_if_t<!std::is_trivially_copyable_v< std::optional< T > > > >
 
struct  sycl::_V1::is_device_copyable< std::pair< T1, T2 >, std::enable_if_t<!std::is_trivially_copyable_v< std::pair< T1, T2 > > > >
 
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_v< std::tuple< T, Ts... > > > >
 
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_v< std::variant< Ts... > > > >
 
struct  sycl::_V1::is_device_copyable< sycl::marray< T, N >, std::enable_if_t< is_device_copyable< T >::value &&!std::is_trivially_copyable_v< T > > >
 
struct  sycl::_V1::is_device_copyable< T[N], std::enable_if_t<!std::is_trivially_copyable_v< T > > >
 
struct  sycl::_V1::is_device_copyable< T, std::enable_if_t<!std::is_trivially_copyable_v< T > &&(std::is_const_v< T >||std::is_volatile_v< T >)> >
 
struct  sycl::_V1::detail::IsDeprecatedDeviceCopyable< T, typename >
 

Namespaces

 sycl
 
 sycl::_V1
 
 sycl::_V1::detail
 

Macros

#define __SYCL_ALLOW_VECTOR_SIZES(num_elements)
 
#define __SYCL_ALLOW_VECTOR_TYPES(num_elements)
 
#define __SYCL_ACCESS_RETURN   this
 
#define __SYCL_BINOP(BINOP, OPASSIGN, CONVERT)
 
#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 _IN , typename T8 , typename T16 , typename T32 , typename T64 >
using sycl::_V1::detail::select_apply_cl_t = std::conditional_t< sizeof(_IN)==1, T8, std::conditional_t< sizeof(_IN)==2, T16, std::conditional_t< sizeof(_IN)==4, T32, T64 > >>
 
template<typename DataT >
using sycl::_V1::detail::rel_t = typename std::conditional_t< sizeof(DataT)==sizeof(opencl::cl_char), opencl::cl_char, typename std::conditional_t< sizeof(DataT)==sizeof(opencl::cl_short), opencl::cl_short, typename std::conditional_t< sizeof(DataT)==sizeof(opencl::cl_int), opencl::cl_int, typename std::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_v< T > &&std::is_integral_v< R > >
 
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_v< T > &&!(std::is_unsigned_v< T >)&&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_v< T > &&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_v< T > &&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_v< R > >
 
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
 

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 >
std::enable_if_t< std::is_same_v< T, R >, R > sycl::_V1::detail::convertImpl (T Value)
 
template<typename T , typename R , rounding_mode roundingMode, typename OpenCLT , typename OpenCLR >
std::enable_if_t<!std::is_same_v< T, R > &&(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 >
std::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 1981 of file types.hpp.

◆ __SYCL_ACCESS_RETURN [2/2]

#define __SYCL_ACCESS_RETURN   m_Vector

Definition at line 1981 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...> \
: std::conditional_t< \
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...> \
: std::conditional_t< \
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...> \
: std::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 2093 of file types.hpp.

◆ __SYCL_BINOP [2/2]

#define __SYCL_BINOP (   BINOP,
  OPASSIGN,
  CONVERT 
)
Value:
vec operator BINOP(const vec &Rhs) const { \
vec Ret{}; \
if constexpr (NativeVec) \
Ret.getAsVector() = getAsVector() BINOP Rhs.getAsVector(); \
else \
for (size_t I = 0; I < NumElements; ++I) \
Ret.setValue(I, (DataT)(vec_data<DataT>::get(getValue( \
I)) BINOP vec_data<DataT>::get(Rhs.getValue(I)))); \
return Ret; \
} \
template <typename T> \
typename std::enable_if_t< \
std::is_convertible<DataT, T>::value && \
(std::is_fundamental<vec_data_t<T>>::value || \
std::is_same<typename std::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 std::enable_if_t<Num != 1, vec &> operator OPASSIGN( \
const DataT &Rhs) { \
*this = *this BINOP vec(Rhs); \
return *this; \
}

Definition at line 2093 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; \
using VectorDataType = sycl::detail::half_impl::Vec##Num##StorageT; \
};

Definition at line 2313 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 = std::array<type, (num == 3) ? 4 : num>; \
using VectorDataType = ::cl_##cl_type##num; \
};

Definition at line 2227 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 2233 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 1592 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 std::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 2148 of file types.hpp.

◆ __SYCL_RELLOGOP [2/2]

#define __SYCL_RELLOGOP (   RELLOGOP)

Definition at line 2148 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 1618 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 1618 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 2329 of file types.hpp.

detail
---— Error handling, matching OpenCL plugin semantics.
Definition: common.hpp:44
sycl::_V1::vec_data_t
typename detail::vec_helper< T >::RetType vec_data_t
Definition: types.hpp:545
sycl::_V1::vec_data
detail::vec_helper< T > vec_data
Definition: types.hpp:542
std::get
constexpr tuple_element< I, tuple< Types... > >::type & get(sycl::detail::tuple< Types... > &Arg) noexcept
Definition: tuple.hpp:198
__SYCL_DEFINE_VECSTORAGE_IMPL
#define __SYCL_DEFINE_VECSTORAGE_IMPL(type, cl_type, num)
Definition: types.hpp:2227
sycl::_V1::half
sycl::detail::half_impl::half half
Definition: aliases.hpp:101
std
Definition: accessor.hpp:4139
sycl::_V1::detail::half_impl::StorageT
detail::host_half_impl::half StorageT
Definition: half_type.hpp:253