DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl::_V1::ext::intel::esimd::simd< Ty, N > Class Template Reference

The main simd vector class. More...

#include <sycl/ext/intel/esimd/detail/types.hpp>

Collaboration diagram for sycl::_V1::ext::intel::esimd::simd< Ty, N >:

Public Types

using element_type = Ty
 
using raw_element_type = typename base_type::raw_element_type
 
using raw_vector_type = typename base_type::raw_vector_type
 

Public Member Functions

template<typename SimdT , class = std::enable_if_t<__ESIMD_DNS::is_simd_type_v<SimdT> && (length == SimdT::length)>>
 simd (const SimdT &RHS)
 Implicit conversion constructor from another simd object of the same length. More...
 
template<int N1 = N, class Ty1 = Ty, class SFINAE = std::enable_if_t< (N1 == N) && (N1 <= std::experimental::simd_abi::max_fixed_size< Ty>)&&!detail::is_wrapper_elem_type_v<Ty1>>>
 simd (const sycl::ext::oneapi::experimental::simd< Ty, N1 > &v)
 
template<typename T1 , class = std::enable_if_t<detail::is_valid_simd_elem_type_v<T1>>>
 simd (T1 Val)
 Broadcast constructor with conversion. More...
 
template<class To , class T = simd, class = std::enable_if_t<(T::length == 1) && detail::is_valid_simd_elem_type_v<To>>>
 operator To () const
 Converts this object to a scalar. More...
 
template<int N1, class Ty1 = Ty, class SFINAE = std::enable_if_t< (N1 == N) && (N1 <= std::experimental::simd_abi::max_fixed_size< Ty>)&&!detail::is_wrapper_elem_type_v<Ty1>>>
 operator sycl::ext::oneapi::experimental::simd< Ty, N1 > ()
 Implicitly converts this object to a sycl::ext::oneapi::experimental::simd object. More...
 
simdoperator= (const simd &other) noexcept
 Copy assignment operator. More...
 
simdoperator++ ()
 Prefix increment, increments elements of this object. More...
 
simd operator++ (int)
 Postfix increment. More...
 
simdoperator-- ()
 Prefix decrement, decrements elements of this object. More...
 
simd operator-- (int)
 Postfix decrement. More...
 

Static Public Attributes

static constexpr int length = N
 

Detailed Description

template<typename Ty, int N>
class sycl::_V1::ext::intel::esimd::simd< Ty, N >

The main simd vector class.

A vector of elements, which compiler tries to map to a GPU register. Supports all standard C++ unary and binary operations. See more details in the base class' docs: detail::simd_obj_impl.

Template Parameters
Tyelement type. Can be any C++ integer or floating point type or sycl::half.
Nthe number of elements.

Definition at line 34 of file types.hpp.

Member Typedef Documentation

◆ element_type

template<typename Ty , int N>
using sycl::_V1::ext::intel::esimd::simd< Ty, N >::element_type = Ty

Definition at line 62 of file simd.hpp.

◆ raw_element_type

template<typename Ty , int N>
using sycl::_V1::ext::intel::esimd::simd< Ty, N >::raw_element_type = typename base_type::raw_element_type

Definition at line 63 of file simd.hpp.

◆ raw_vector_type

template<typename Ty , int N>
using sycl::_V1::ext::intel::esimd::simd< Ty, N >::raw_vector_type = typename base_type::raw_vector_type

Definition at line 64 of file simd.hpp.

Constructor & Destructor Documentation

◆ simd() [1/3]

template<typename Ty , int N>
template<typename SimdT , class = std::enable_if_t<__ESIMD_DNS::is_simd_type_v<SimdT> && (length == SimdT::length)>>
sycl::_V1::ext::intel::esimd::simd< Ty, N >::simd ( const SimdT &  RHS)
inline

Implicit conversion constructor from another simd object of the same length.

Available when SimdT is

  • instantiation of simd
  • has the same number of elements
    Template Parameters
    SimdTtype of the object to convert from
    Parameters
    RHSobject to convert from

Definition at line 77 of file simd.hpp.

Referenced by sycl::_V1::ext::intel::esimd::simd< uint32_t, 16 >::simd().

◆ simd() [2/3]

template<typename Ty , int N>
template<int N1 = N, class Ty1 = Ty, class SFINAE = std::enable_if_t< (N1 == N) && (N1 <= std::experimental::simd_abi::max_fixed_size< Ty>)&&!detail::is_wrapper_elem_type_v<Ty1>>>
sycl::_V1::ext::intel::esimd::simd< Ty, N >::simd ( const sycl::ext::oneapi::experimental::simd< Ty, N1 > &  v)
inline

Definition at line 89 of file simd.hpp.

◆ simd() [3/3]

template<typename Ty , int N>
template<typename T1 , class = std::enable_if_t<detail::is_valid_simd_elem_type_v<T1>>>
sycl::_V1::ext::intel::esimd::simd< Ty, N >::simd ( T1  Val)
inline

Broadcast constructor with conversion.

Converts given value to element_type and replicates it in all elements. Available when T1 is a valid simd element type.

Template Parameters
T1broadcast value type
Valbroadcast value

Definition at line 99 of file simd.hpp.

Member Function Documentation

◆ operator sycl::ext::oneapi::experimental::simd< Ty, N1 >()

template<typename Ty , int N>
template<int N1, class Ty1 = Ty, class SFINAE = std::enable_if_t< (N1 == N) && (N1 <= std::experimental::simd_abi::max_fixed_size< Ty>)&&!detail::is_wrapper_elem_type_v<Ty1>>>
sycl::_V1::ext::intel::esimd::simd< Ty, N >::operator sycl::ext::oneapi::experimental::simd< Ty, N1 > ( )
inline

Implicitly converts this object to a sycl::ext::oneapi::experimental::simd object.

Available when the number of elements does not exceed maximum fixed size of the oneapi's simd_abi and (TODO, temporary limitation) the element type is a primitive type (e.g. can't be sycl::half).

Definition at line 125 of file simd.hpp.

◆ operator To()

template<typename Ty , int N>
template<class To , class T = simd, class = std::enable_if_t<(T::length == 1) && detail::is_valid_simd_elem_type_v<To>>>
sycl::_V1::ext::intel::esimd::simd< Ty, N >::operator To ( ) const
inline

Converts this object to a scalar.

Available when

  • this object's length is 1
  • To is a valid simd element type
    Template Parameters
    Tothe scalar type
    Returns
    this object's single element value converted to the result type.

Definition at line 111 of file simd.hpp.

◆ operator++() [1/2]

template<typename Ty , int N>
simd& sycl::_V1::ext::intel::esimd::simd< Ty, N >::operator++ ( )
inline

Prefix increment, increments elements of this object.

Returns
Reference to this object.

Definition at line 136 of file simd.hpp.

Referenced by sycl::_V1::ext::intel::esimd::simd< uint32_t, 16 >::operator++().

◆ operator++() [2/2]

template<typename Ty , int N>
simd sycl::_V1::ext::intel::esimd::simd< Ty, N >::operator++ ( int  )
inline

Postfix increment.

Returns
New simd object, whose element values are incremented values of this object's elements.

Definition at line 144 of file simd.hpp.

◆ operator--() [1/2]

template<typename Ty , int N>
simd& sycl::_V1::ext::intel::esimd::simd< Ty, N >::operator-- ( )
inline

Prefix decrement, decrements elements of this object.

Returns
Reference to this object.

Definition at line 152 of file simd.hpp.

Referenced by sycl::_V1::ext::intel::esimd::simd< uint32_t, 16 >::operator--().

◆ operator--() [2/2]

template<typename Ty , int N>
simd sycl::_V1::ext::intel::esimd::simd< Ty, N >::operator-- ( int  )
inline

Postfix decrement.

Returns
New simd object, whose element values are decremented values of this object's elements.

Definition at line 160 of file simd.hpp.

◆ operator=()

template<typename Ty , int N>
simd& sycl::_V1::ext::intel::esimd::simd< Ty, N >::operator= ( const simd< Ty, N > &  other)
inlinenoexcept

Copy assignment operator.

Definition at line 130 of file simd.hpp.

Member Data Documentation

◆ length

template<typename Ty , int N>
constexpr int sycl::_V1::ext::intel::esimd::simd< Ty, N >::length = N
staticconstexpr

Definition at line 65 of file simd.hpp.


The documentation for this class was generated from the following files: