The main simd vector class. More...
#include <sycl/ext/intel/esimd/simd.hpp>
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 Types inherited from sycl::_V1::ext::intel::esimd::detail::simd_obj_impl< detail::__raw_t< Ty >, N, simd< Ty, N >, std::enable_if_t< detail::is_valid_simd_elem_type_v< Ty > > > | |
using | element_type = get_vector_element_type< simd< Ty, N > > |
Element type of the derived (user) class. More... | |
using | raw_vector_type = vector_type_t< detail::__raw_t< Ty >, N > |
The underlying raw storage vector data type. More... | |
using | raw_element_type = detail::__raw_t< Ty > |
The element type of the raw storage vector. More... | |
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... | |
simd & | operator= (const simd &other) noexcept |
Copy assignment operator. More... | |
simd & | operator++ () |
Prefix increment, increments elements of this object. More... | |
simd | operator++ (int) |
Postfix increment. More... | |
simd & | operator-- () |
Prefix decrement, decrements elements of this object. More... | |
simd | operator-- (int) |
Postfix decrement. More... | |
Public Member Functions inherited from sycl::_V1::ext::intel::esimd::detail::simd_obj_impl< detail::__raw_t< Ty >, N, simd< Ty, N >, std::enable_if_t< detail::is_valid_simd_elem_type_v< Ty > > > | |
simd_obj_impl ()=default | |
Default constructor. More... | |
simd_obj_impl (const simd_obj_impl &other) | |
Copy constructor. More... | |
simd_obj_impl (const simd_obj_impl< Ty1, N, Derived1, std::enable_if_t< detail::is_valid_simd_elem_type_v< Ty > > > &other) | |
Implicit conversion constructor from another simd_obj_impl object. More... | |
simd_obj_impl (const raw_vector_type &Val) | |
Implicit conversion constructor from a raw vector object. More... | |
simd_obj_impl (Ty Base, Ty Step) noexcept | |
Arithmetic progression constructor. More... | |
simd_obj_impl (T1 Val) noexcept | |
Broadcast constructor. More... | |
simd_obj_impl (const Ty(&&Arr)[N1]) noexcept | |
Rvalue array-based constructor. More... | |
simd_obj_impl (const Ty *ptr, Flags={}) noexcept | |
Pointer-based load constructor. More... | |
simd_obj_impl (AccessorT acc, uint32_t offset, Flags={}) noexcept | |
Accessor-based load constructor. More... | |
simd< Ty, N > & | operator= (const simd_obj_impl &other) noexcept |
Copy assignment operator. More... | |
operator Ty () const | |
Type conversion into a scalar: <simd_obj_impl<RawTy, 1, simd<Ty,1>> to Ty . More... | |
raw_vector_type | data () const |
raw_vector_type & | data_ref () |
simd< Ty, N > | read () const |
simd< Ty, N > & | write (const simd< Ty, N > &Val) |
Replaces the underlying data with the one taken from another object. More... | |
void | merge (const simd< Ty, N > &Val, const simd_mask_type< N > &Mask) |
"Merges" this object's value with another object: replaces part of the underlying data with the one taken from the other object according to a mask. More... | |
void | merge (const simd< Ty, N > &Val1, simd< Ty, N > Val2, const simd_mask_type< N > &Mask) |
Merges given two objects with a mask and writes resulting data into this object. More... | |
auto | bit_cast_view () & |
Create a 1-dimensional view of this object. More... | |
auto | bit_cast_view () & |
Create a 2-dimensional view of this object. More... | |
simd_view< simd< Ty, N >, region1d_t< Ty, Size, Stride > > | select (uint16_t Offset=0) & |
Select elements of this object into a subregion and create a 1D view for for it. More... | |
resize_a_simd_type_t< simd< Ty, N >, Size > | select (uint16_t Offset=0) && |
Select and extract a subregion of this object's elements and return it as a new vector object. More... | |
Ty | operator[] (int i) const |
Get value of this vector's element. More... | |
simd_view< simd< Ty, N >, region1d_scalar_t< Ty > > | operator[] (int i) |
Return writable view of a single element. More... | |
resize_a_simd_type_t< simd< Ty, N >, Size > | iselect (const simd< uint16_t, Size > &Indices) |
Indirect select - select and extract multiple elements with given variable indices. More... | |
void | iupdate (ushort Index, Ty V) |
Update single element with variable index. More... | |
void | iupdate (const simd< uint16_t, Size > &Indices, const resize_a_simd_type_t< simd< Ty, N >, Size > &Val, const simd_mask_type< Size > &Mask) |
Indirect update - update multiple elements with given variable indices. More... | |
resize_a_simd_type_t< simd< Ty, N >, Rep *N > | replicate () const |
Replicates contents of this vector a number of times into a new vector. More... | |
resize_a_simd_type_t< simd< Ty, N >, Rep *W > | replicate_w (uint16_t Offset) const |
Shortcut to replicate_vs_w_hs with VS=0 and HS=1 to replicate a single "dense" (w/o gaps between elements) block Rep times. More... | |
resize_a_simd_type_t< simd< Ty, N >, Rep *W > | replicate_vs_w (uint16_t Offset) const |
Shortcut to replicate_vs_w_hs with HS=1 to replicate dense blocks. More... | |
resize_a_simd_type_t< simd< Ty, N >, Rep *W > | replicate_vs_w_hs (uint16_t Offset) const |
This function "replicates" a portion of this object's elements into a new object. More... | |
uint16_t | any () const |
See if any element is non-zero. More... | |
uint16_t | all () const |
See if all elements are non-zero. More... | |
ESIMD_INLINE void | copy_from (const Ty *addr, Flags={}) SYCL_ESIMD_FUNCTION |
Copy a contiguous block of data from memory into this simd_obj_impl object. More... | |
ESIMD_INLINE EnableIfAccessor< AccessorT, accessor_mode_cap::can_read, void > | copy_from (AccessorT acc, uint32_t offset, Flags={}) SYCL_ESIMD_FUNCTION |
Copy a contiguous block of data from memory into this simd_obj_impl object. More... | |
ESIMD_INLINE std::enable_if_t< detail::is_local_accessor_with_v< AccessorT, accessor_mode_cap::can_read >, void > | copy_from (AccessorT acc, uint32_t offset, Flags={}) SYCL_ESIMD_FUNCTION |
Copy a contiguous block of data from memory into this simd_obj_impl object. More... | |
ESIMD_INLINE void | copy_to (Ty *addr, Flags={}) const SYCL_ESIMD_FUNCTION |
Copy all vector elements of this object into a contiguous block in memory. More... | |
ESIMD_INLINE EnableIfAccessor< AccessorT, accessor_mode_cap::can_write, void > | copy_to (AccessorT acc, uint32_t offset, Flags={}) const SYCL_ESIMD_FUNCTION |
Copy all vector elements of this object into a contiguous block in memory. More... | |
ESIMD_INLINE std::enable_if_t< detail::is_local_accessor_with_v< AccessorT, accessor_mode_cap::can_write >, void > | copy_to (AccessorT acc, uint32_t offset, Flags={}) const SYCL_ESIMD_FUNCTION |
Copy all vector elements of this object into a contiguous block in memory. More... | |
simd< Ty, N > | operator~ () const |
Per-element bitwise inversion, available in all subclasses, but only for integral element types (simd_mask included). More... | |
simd_mask_type< N > | operator! () const |
Unary logical negation operator, available in all subclasses, but only for integral element types (simd_mask included). More... | |
simd< Ty, N > & | operator^= (const __ESIMD_DNS::simd_obj_impl< T1, N, SimdT > &RHS) |
Bitwise-xor compound assignment. More... | |
simd< Ty, N > & | operator^= (const sycl::ext::intel::esimd ::simd_view< SimdT1, RegionT1 > &RHS) |
^= simd_view version. More... | |
simd< Ty, N > & | operator^= (T1 RHS) |
^= scalar version. More... | |
simd< Ty, N > & | operator|= (const __ESIMD_DNS::simd_obj_impl< T1, N, SimdT > &RHS) |
Bitwise-or compound assignment. More... | |
simd< Ty, N > & | operator|= (const sycl::ext::intel::esimd ::simd_view< SimdT1, RegionT1 > &RHS) |
|= simd_view version. More... | |
simd< Ty, N > & | operator|= (T1 RHS) |
|= scalar version. More... | |
simd< Ty, N > & | operator&= (const __ESIMD_DNS::simd_obj_impl< T1, N, SimdT > &RHS) |
Bitwise-and compound assignment. More... | |
simd< Ty, N > & | operator&= (const sycl::ext::intel::esimd ::simd_view< SimdT1, RegionT1 > &RHS) |
&= simd_view version. More... | |
simd< Ty, N > & | operator&= (T1 RHS) |
&= scalar version. More... | |
simd< Ty, N > & | operator%= (const __ESIMD_DNS::simd_obj_impl< T1, N, SimdT > &RHS) |
Modulo operation compound assignment. More... | |
simd< Ty, N > & | operator%= (const sycl::ext::intel::esimd ::simd_view< SimdT1, RegionT1 > &RHS) |
%= simd_view version. More... | |
simd< Ty, N > & | operator%= (T1 RHS) |
%= scalar version. More... | |
simd< Ty, N > & | operator<<= (const __ESIMD_DNS::simd_obj_impl< T1, N, SimdT > &RHS) |
Shift left compound assignment. More... | |
simd< Ty, N > & | operator<<= (const sycl::ext::intel::esimd ::simd_view< SimdT1, RegionT1 > &RHS) |
<<= simd_view version. More... | |
simd< Ty, N > & | operator<<= (T1 RHS) |
<<= scalar version. More... | |
simd< Ty, N > & | operator>>= (const __ESIMD_DNS::simd_obj_impl< T1, N, SimdT > &RHS) |
Logical shift right compound assignment. More... | |
simd< Ty, N > & | operator>>= (const sycl::ext::intel::esimd ::simd_view< SimdT1, RegionT1 > &RHS) |
>>= simd_view version. More... | |
simd< Ty, N > & | operator>>= (T1 RHS) |
>>= scalar version. More... | |
simd< Ty, N > & | operator+= (const __ESIMD_DNS::simd_obj_impl< T1, N, SimdT > &RHS) |
Addition operation compound assignment. More... | |
simd< Ty, N > & | operator+= (const sycl::ext::intel::esimd ::simd_view< SimdT1, RegionT1 > &RHS) |
+= simd_view version. More... | |
simd< Ty, N > & | operator+= (T1 RHS) |
+= scalar version. More... | |
simd< Ty, N > & | operator-= (const __ESIMD_DNS::simd_obj_impl< T1, N, SimdT > &RHS) |
Subtraction operation compound assignment. More... | |
simd< Ty, N > & | operator-= (const sycl::ext::intel::esimd ::simd_view< SimdT1, RegionT1 > &RHS) |
-= simd_view version. More... | |
simd< Ty, N > & | operator-= (T1 RHS) |
-= scalar version. More... | |
simd< Ty, N > & | operator*= (const __ESIMD_DNS::simd_obj_impl< T1, N, SimdT > &RHS) |
Multiplication operation compound assignment. More... | |
simd< Ty, N > & | operator*= (const sycl::ext::intel::esimd ::simd_view< SimdT1, RegionT1 > &RHS) |
*= simd_view version. More... | |
simd< Ty, N > & | operator*= (T1 RHS) |
*= scalar version. More... | |
simd< Ty, N > & | operator/= (const __ESIMD_DNS::simd_obj_impl< T1, N, SimdT > &RHS) |
Division operation compound assignment. More... | |
simd< Ty, N > & | operator/= (const sycl::ext::intel::esimd ::simd_view< SimdT1, RegionT1 > &RHS) |
/= simd_view version. More... | |
simd< Ty, N > & | operator/= (T1 RHS) |
/= scalar version. More... | |
Static Public Attributes | |
static constexpr int | length = N |
Static Public Attributes inherited from sycl::_V1::ext::intel::esimd::detail::simd_obj_impl< detail::__raw_t< Ty >, N, simd< Ty, N >, std::enable_if_t< detail::is_valid_simd_elem_type_v< Ty > > > | |
static constexpr int | length |
The number of elements in this object. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from sycl::_V1::ext::intel::esimd::detail::simd_obj_impl< detail::__raw_t< Ty >, N, simd< Ty, N >, std::enable_if_t< detail::is_valid_simd_elem_type_v< Ty > > > | |
ESIMD_INLINE void | writeRegion (RTy Region, const vector_type_t< ElemTy, RTy::length > &Val) |
Write a simd_obj_impl-vector into a basic region of a simd_obj_impl object. More... | |
ESIMD_INLINE void | writeRegion (std::pair< TR, UR > Region, const vector_type_t< ElemTy, TR::length > &Val) |
Write a simd_obj_impl-vector into a nested region of a simd_obj_impl object. More... | |
__ESIMD_DECLARE_TEST_PROXY void | set (const raw_vector_type &Val) |
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
.
Ty | element type. Can be any C++ integer or floating point type or sycl::half . |
N | the number of elements. |
using sycl::_V1::ext::intel::esimd::simd< Ty, N >::element_type = Ty |
using sycl::_V1::ext::intel::esimd::simd< Ty, N >::raw_element_type = typename base_type::raw_element_type |
using sycl::_V1::ext::intel::esimd::simd< Ty, N >::raw_vector_type = typename base_type::raw_vector_type |
|
inline |
Implicit conversion constructor from another simd object of the same length.
Available when SimdT
is
SimdT | type of the object to convert from |
RHS | object to convert from |
Definition at line 73 of file simd.hpp.
References __esimd_dbg_print.
Referenced by sycl::_V1::ext::intel::esimd::simd< Ty, N >::simd().
|
inline |
|
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.
T1 | broadcast value type |
Val | broadcast value |
Definition at line 95 of file simd.hpp.
References __esimd_dbg_print, and sycl::_V1::ext::intel::esimd::simd< Ty, N >::simd().
|
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 121 of file simd.hpp.
References sycl::_V1::ext::intel::esimd::detail::simd_obj_impl< RawTy, N, Derived, SFINAE >::data().
|
inline |
Converts this object to a scalar.
Available when
To
is a valid simd element type To | the scalar type |
Definition at line 107 of file simd.hpp.
References __esimd_dbg_print, and sycl::_V1::ext::intel::esimd::detail::simd_obj_impl< RawTy, N, Derived, SFINAE >::data().
|
inline |
Prefix increment, increments elements of this object.
Definition at line 132 of file simd.hpp.
Referenced by sycl::_V1::ext::intel::esimd::simd< Ty, N >::operator++().
|
inline |
Postfix increment.
Definition at line 140 of file simd.hpp.
References sycl::_V1::ext::intel::esimd::detail::simd_obj_impl< RawTy, N, Derived, SFINAE >::data(), and sycl::_V1::ext::intel::esimd::simd< Ty, N >::operator++().
|
inline |
Prefix decrement, decrements elements of this object.
Definition at line 148 of file simd.hpp.
Referenced by sycl::_V1::ext::intel::esimd::simd< Ty, N >::operator--().
|
inline |
Postfix decrement.
Definition at line 156 of file simd.hpp.
References sycl::_V1::ext::intel::esimd::detail::simd_obj_impl< RawTy, N, Derived, SFINAE >::data(), and sycl::_V1::ext::intel::esimd::simd< Ty, N >::operator--().
|
inlinenoexcept |
Copy assignment operator.
Definition at line 126 of file simd.hpp.
References sycl::_V1::ext::intel::esimd::detail::simd_obj_impl< RawTy, N, Derived, SFINAE >::operator=().
|
staticconstexpr |