DPC++ Runtime
Runtime libraries for oneAPI DPC++
cl::sycl::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 cl::sycl::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 = sycl::detail::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++ ()
 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 cl::sycl::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 31 of file types.hpp.

Member Typedef Documentation

◆ element_type

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

Definition at line 61 of file simd.hpp.

◆ raw_element_type

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

Definition at line 62 of file simd.hpp.

◆ raw_vector_type

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

Definition at line 63 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)>>
cl::sycl::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 76 of file simd.hpp.

References __esimd_dbg_print.

◆ 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>>>
cl::sycl::ext::intel::esimd::simd< Ty, N >::simd ( const sycl::ext::oneapi::experimental::simd< Ty, N1 > &  v)
inline

Definition at line 88 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>>>
cl::sycl::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 98 of file simd.hpp.

References __esimd_dbg_print.

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>>>
cl::sycl::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 124 of file simd.hpp.

◆ operator To()

template<typename Ty , int N>
template<class To , class T = simd, class = sycl::detail::enable_if_t< (T::length == 1) && detail::is_valid_simd_elem_type_v<To>>>
cl::sycl::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 110 of file simd.hpp.

References __esimd_dbg_print.

◆ operator++() [1/2]

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

Prefix increment, increments elements of this object.

Returns
Reference to this object.

Definition at line 130 of file simd.hpp.

◆ operator++() [2/2]

template<typename Ty , int N>
simd cl::sycl::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 138 of file simd.hpp.

◆ operator--() [1/2]

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

Prefix decrement, decrements elements of this object.

Returns
Reference to this object.

Definition at line 146 of file simd.hpp.

◆ operator--() [2/2]

template<typename Ty , int N>
simd cl::sycl::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 154 of file simd.hpp.

Member Data Documentation

◆ length

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

Definition at line 64 of file simd.hpp.


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