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/defines_elementary.hpp>
#include <sycl/detail/generic_type_lists.hpp>
#include <sycl/detail/memcpy.hpp>
#include <sycl/detail/type_list.hpp>
#include <sycl/detail/type_traits.hpp>
#include <sycl/detail/vector_convert.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 <sycl/ext/oneapi/bfloat16.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/detail/cl.h>
#include <cstring>
#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< sycl::ext::oneapi::bfloat16 >
 
struct  sycl::_V1::detail::vec_helper< std::byte >
 
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::vec< Type, NumElements >
 defined(__INTEL_PREVIEW_BREAKING_CHANGES) More...
 
class  sycl::_V1::detail::SwizzleOp< VecT, OperationLeftT, OperationRightT, OperationCurrentT, Indexes >
 
struct  sycl::_V1::detail::VecStorage< T, N, V >
 
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< std::byte, 1, void >
 
struct  sycl::_V1::detail::VecStorage< T, 1, typename std::enable_if_t< is_sigeninteger_v< T > > >
 
struct  sycl::_V1::detail::VecStorage< T, 1, typename std::enable_if_t< is_sugeninteger_v< T > > >
 
struct  sycl::_V1::detail::VecStorage< T, 1, typename std::enable_if_t<!is_half_or_bf16_v< T > &&is_sgenfloat_v< T > > >
 
struct  sycl::_V1::detail::VecStorage< T, N, typename std::enable_if_t< isValidVectorSize(N) &&(is_sgeninteger_v< T >||(is_sgenfloat_v< T > &&!is_half_or_bf16_v< T >))> >
 
struct  sycl::_V1::detail::VecStorage< half, 1, void >
 
struct  sycl::_V1::detail::VecStorage< sycl::ext::oneapi::bfloat16, 1, void >
 
struct  sycl::_V1::detail::is_device_copyable_impl< T, typename >
 
struct  sycl::_V1::detail::is_device_copyable_impl< T, std::enable_if_t<!std::is_same_v< T, std::remove_cv_t< T > > > >
 
struct  sycl::_V1::is_device_copyable< T >
 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< std::array< T, 0 > >
 
struct  sycl::_V1::is_device_copyable< std::array< T, N > >
 
struct  sycl::_V1::is_device_copyable< std::optional< T > >
 
struct  sycl::_V1::is_device_copyable< std::pair< T1, T2 > >
 
struct  sycl::_V1::is_device_copyable< std::tuple< Ts... > >
 
struct  sycl::_V1::is_device_copyable< std::variant< Ts... > >
 
struct  sycl::_V1::is_device_copyable< sycl::marray< T, N > >
 
struct  sycl::_V1::is_device_copyable< T[N]>
 
struct  sycl::_V1::detail::IsDeprecatedDeviceCopyable< T, typename >
 

Namespaces

 sycl
 
 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, 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_DEFINE_BF16_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 >
using sycl::_V1::vec_data = detail::vec_helper< T >
 
template<typename T >
using sycl::_V1::vec_data_t = typename detail::vec_helper< T >::RetType
 

Functions

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 2304 of file types.hpp.

◆ __SYCL_ACCESS_RETURN [2/2]

#define __SYCL_ACCESS_RETURN   m_Vector

Definition at line 2304 of file types.hpp.

◆ __SYCL_ALIGNED_VAR

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

Definition at line 337 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 2417 of file types.hpp.

◆ __SYCL_BINOP [2/2]

#define __SYCL_BINOP (   BINOP,
  OPASSIGN,
  CONVERT 
)
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 std::enable_if_t< \
std::is_convertible_v<DataT, T> && \
(std::is_fundamental_v<vec_data_t<T>> || \
detail::is_half_or_bf16_v<typename std::remove_const_t<T>>), \
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 2417 of file types.hpp.

◆ __SYCL_DEFINE_BF16_VECSTORAGE

#define __SYCL_DEFINE_BF16_VECSTORAGE (   Num)
Value:
template <> struct VecStorage<sycl::ext::oneapi::bfloat16, Num, void> { \
using DataType = sycl::ext::oneapi::detail::bf16::Vec##Num##StorageT; \
using VectorDataType = \
sycl::ext::oneapi::detail::bf16::Vec##Num##StorageT; \
};
detail::host_half_impl::half StorageT
Definition: half_type.hpp:253
Definition: access.hpp:18

Definition at line 2737 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; \
};
sycl::detail::half_impl::half half
Definition: aliases.hpp:101

Definition at line 2716 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 2568 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)
#define __SYCL_DEFINE_VECSTORAGE_IMPL(type, cl_type, num)
Definition: types.hpp:2568

Definition at line 2575 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 1817 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) { \
/* We cannot use SetValue here as the operator is not a friend of*/ \
/* Ret on Windows. */ \
Ret[I] = static_cast<rel_t>(-(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_v<T, DataT> && \
(std::is_fundamental_v<vec_data_t<T>> || \
detail::is_half_or_bf16_v<T>), \
vec<rel_t, NumElements>> \
operator RELLOGOP(const T & Rhs) const { \
return *this RELLOGOP vec(static_cast<const DataT &>(Rhs)); \
}
constexpr tuple_element< I, tuple< Types... > >::type & get(sycl::detail::tuple< Types... > &Arg) noexcept
Definition: tuple.hpp:198
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 > >> > rel_t
Definition: types.hpp:221

Definition at line 2472 of file types.hpp.

◆ __SYCL_RELLOGOP [2/2]

#define __SYCL_RELLOGOP (   RELLOGOP)

Definition at line 2472 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 1843 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 1843 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 2754 of file types.hpp.