DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > > Class Template Reference

This is a specialization of simd_view class with a single element. More...

#include <sycl/ext/intel/esimd/simd_view.hpp>

Inheritance diagram for sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >:
Collaboration diagram for sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >:

Public Types

using RegionTy = region1d_scalar_t< ViewedElemT >
 
using BaseClass = detail::simd_view_impl< BaseTy, RegionTy >
 
using ShapeTy = typename shape_type< RegionTy >::type
 
using element_type = ViewedElemT
 The element type of this class, which could be different from the element type of the base object type. More...
 
using base_type = BaseTy
 
template<typename ElT , int N>
using get_simd_t = typename BaseClass::template get_simd_t< ElT, N >
 
using value_type = get_simd_t< element_type, length >
 The simd type if reading the object. More...
 
- Public Types inherited from sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, region1d_scalar_t< ViewedElemT > >
using Derived = simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >
 The only type which is supposed to extend this one and be used in user code. More...
 
using element_type = typename ShapeTy::element_type
 Element type of this view, may differ from the element type of the target object. More...
 
using raw_element_type = __raw_t< element_type >
 Corresponding "raw" (storage) type for the element type. More...
 
using value_type = get_simd_t< element_type, length >
 The simd type of the viewed region of the target object. More...
 
using raw_vector_type = vector_type_t< __raw_t< element_type >, length >
 The underlying builtin vector type of the the viewed region. More...
 

Public Member Functions

 simd_view (BaseTy &Base)
 Construct a complete view of a vector. More...
 
 operator element_type () const
 
Derivedoperator-- ()
 Prefix decrement. More...
 
value_type operator-- (int)
 Postfix decrement. More...
 
Derivedoperator++ ()
 Prefix increment. More...
 
value_type operator++ (int)
 Postfix increment. More...
 
simd_view_imploperator= (const simd_view_impl &Other)
 Copy assignment. More...
 
Derivedoperator= (const Derived &Other)
 Assignment from an object of the derived class. More...
 
Derivedoperator= (const value_type &Val)
 Assignment from a value_type object - simd or simd_mask. More...
 
Derivedoperator= (Derived &&Other)
 Assignment from an rvalue object of the derived class. More...
 
simd_view_imploperator= (simd_view_impl &&Other)
 Move assignment operator. Updates the target region viewed by this object. More...
 
template<class T , int N, class SimdT , class = std::enable_if_t<(is_simd_type_v<SimdT> == is_simd_type_v<BaseTy>)&&(length == SimdT::length)>>
Derivedoperator= (const simd_obj_impl< T, N, SimdT > &Other)
 Assignment with element type conversion from a vector object. More...
 
template<class T1 , class = std::enable_if_t<is_valid_simd_elem_type_v<T1>>>
Derivedoperator= (T1 RHS)
 Broadcast assignment of a scalar with conversion. More...
 
- Public Member Functions inherited from sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, region1d_scalar_t< ViewedElemT > >
 simd_view_impl (const simd_view_impl &Other)=default
 Default copy constructor. More...
 
 simd_view_impl (simd_view_impl &&Other)=default
 Default move constructor. More...
 
 operator simd< ToTy, length > () const
 Implicit conversion to a simd object with potentially different element type. More...
 
 operator simd_mask_type< length > () const
 Implicit conversion to a simd_mask object. More...
 
constexpr uint16_t getOffsetX () const
 Get the offset of the first element of the view within the parent object along X dimension. More...
 
constexpr uint16_t getOffsetY () const
 Get the offset of the first element of the view within the parent object along Y dimension. More...
 
value_type read () const
 Reads the viewed region from the target w/o any conversion and returns as an object of the value_type type. More...
 
value_type::raw_vector_type data () const
 
Derivedwrite (const value_type &Val)
 Assigns a new value to the viewed target's region. More...
 
void merge (const value_type &Val, const simd_mask_type< length > &Mask)
 "Merges" the viewed target's region with given value according to a per-element mask. More...
 
void merge (const value_type &Val1, value_type Val2, const simd_mask_type< length > &Mask)
 "Merges" given values according to a per-element mask and writes the result to the viewed target's region. More...
 
auto bit_cast_view ()
 Create a 1-dimensional view of the target region. More...
 
auto bit_cast_view ()
 Create a 2-dimensional view of the target region. More...
 
auto select (uint16_t Offset=0)
 1D region select. More...
 
auto select (uint16_t OffsetY=0, uint16_t OffsetX=0)
 2D region select. More...
 
Derivedoperator^= (const simd_obj_impl< T1, N1, SimdT1 > &RHS)
 
Derivedoperator^= (const simd_view_impl< SimdT1, RegionT1 > &RHS)
 
Derivedoperator^= (T1 RHS)
 
Derivedoperator|= (const simd_obj_impl< T1, N1, SimdT1 > &RHS)
 
Derivedoperator|= (const simd_view_impl< SimdT1, RegionT1 > &RHS)
 
Derivedoperator|= (T1 RHS)
 
Derivedoperator&= (const simd_obj_impl< T1, N1, SimdT1 > &RHS)
 
Derivedoperator&= (const simd_view_impl< SimdT1, RegionT1 > &RHS)
 
Derivedoperator&= (T1 RHS)
 
Derivedoperator%= (const simd_obj_impl< T1, N1, SimdT1 > &RHS)
 
Derivedoperator%= (const simd_view_impl< SimdT1, RegionT1 > &RHS)
 
Derivedoperator%= (T1 RHS)
 
Derivedoperator<<= (const simd_obj_impl< T1, N1, SimdT1 > &RHS)
 
Derivedoperator<<= (const simd_view_impl< SimdT1, RegionT1 > &RHS)
 
Derivedoperator<<= (T1 RHS)
 
Derivedoperator>>= (const simd_obj_impl< T1, N1, SimdT1 > &RHS)
 
Derivedoperator>>= (const simd_view_impl< SimdT1, RegionT1 > &RHS)
 
Derivedoperator>>= (T1 RHS)
 
Derivedoperator+= (const simd_obj_impl< T1, N1, SimdT1 > &RHS)
 
Derivedoperator+= (const simd_view_impl< SimdT1, RegionT1 > &RHS)
 
Derivedoperator+= (T1 RHS)
 
Derivedoperator-= (const simd_obj_impl< T1, N1, SimdT1 > &RHS)
 
Derivedoperator-= (const simd_view_impl< SimdT1, RegionT1 > &RHS)
 
Derivedoperator-= (T1 RHS)
 
Derivedoperator*= (const simd_obj_impl< T1, N1, SimdT1 > &RHS)
 
Derivedoperator*= (const simd_view_impl< SimdT1, RegionT1 > &RHS)
 
Derivedoperator*= (T1 RHS)
 
Derivedoperator/= (const simd_obj_impl< T1, N1, SimdT1 > &RHS)
 
Derivedoperator/= (const simd_view_impl< SimdT1, RegionT1 > &RHS)
 
Derivedoperator/= (T1 RHS)
 
auto operator! ()
 Unary logical negeation operator. Applies only to integer element types. More...
 
simd_view_imploperator= (const simd_view_impl &Other)
 Copy assignment. More...
 
Derivedoperator= (const Derived &Other)
 Assignment from an object of the derived class. More...
 
Derivedoperator= (const value_type &Val)
 Assignment from a value_type object - simd or simd_mask. More...
 
Derivedoperator= (Derived &&Other)
 Assignment from an rvalue object of the derived class. More...
 
simd_view_imploperator= (simd_view_impl &&Other)
 Move assignment operator. Updates the target region viewed by this object. More...
 
Derivedoperator= (const simd_obj_impl< T, N, SimdT > &Other)
 Assignment with element type conversion from a vector object. More...
 
Derivedoperator= (T1 RHS)
 Broadcast assignment of a scalar with conversion. More...
 
Derivedoperator++ ()
 Prefix increment. More...
 
value_type operator++ (int)
 Postfix increment. More...
 
Derivedoperator-- ()
 Prefix decrement. More...
 
value_type operator-- (int)
 Postfix decrement. More...
 
auto row (int i)
 Reference a row from a 2D region. More...
 
auto column (int i)
 Reference a column from a 2D region. More...
 
element_type operator[] (int i) const
 Read a single element from the target 1D region. More...
 
auto operator[] (int i)
 Return a writeable view of a single element in the target 1D region. More...
 
get_simd_t< element_type, Rep > replicate ()
 Applies simd_obj_impl::replicate to the target region. More...
 
get_simd_t< element_type, Rep *W > replicate_w (uint16_t OffsetX)
 Shortcut to replicate_vs_w<int Rep, int Vs, int W>(uint16_t) with with Vs = 0. More...
 
get_simd_t< element_type, Rep *W > replicate_w (uint16_t OffsetY, uint16_t OffsetX)
 Shortcut to replicate_vs_w<int Rep, int Vs, int W>(uint16_t, uint16_t) with Vs = 0. More...
 
get_simd_t< element_type, Rep *W > replicate_vs_w (uint16_t OffsetX)
 Shortcut to replicate_vs_w_hs<int Rep, int VS, int W, int Hs>(uint16_t OffsetY, uint16_t OffsetX) with Hs = 1 and OffsetY = 0. More...
 
get_simd_t< element_type, Rep *W > replicate_vs_w (uint16_t OffsetY, uint16_t OffsetX)
 Shortcut to replicate_vs_w_hs<int Rep, int VS, int W, int Hs>(uint16_t OffsetY, uint16_t OffsetX) with Hs = 1. More...
 
get_simd_t< element_type, Rep *W > replicate_vs_w_hs (uint16_t OffsetX)
 Applies simd_obj_impl::replicate_vs_w_hs<int Rep, int VS, int W, int HS> to the target region. More...
 
get_simd_t< element_type, Rep *W > replicate_vs_w_hs (uint16_t OffsetY, uint16_t OffsetX)
 Applies simd_obj_impl::replicate_vs_w_hs<int Rep, int VS, int W, int HS> to the target region. More...
 
uint16_t any ()
 Applies simd_obj_impl::any operation to the target region. More...
 
uint16_t all ()
 Applies simd_obj_impl::all operation to the target region. More...
 

Static Public Attributes

static constexpr int length = ShapeTy::Size_x * ShapeTy::Size_y
 

Friends

template<typename , int , class , class >
class detail::simd_obj_impl
 
template<typename , typename >
class detail::simd_view_impl
 

Additional Inherited Members

- Static Public Member Functions inherited from sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, region1d_scalar_t< ViewedElemT > >
static constexpr bool is1D ()
 Tells whether this view is 1-dimensional. More...
 
static constexpr bool is2D ()
 Tells whether this view is 2-dimensional. More...
 
static constexpr int getSizeX ()
 Get number of elements in the view along X dimension. More...
 
static constexpr int getStrideX ()
 Get element stride of the view along X dimension. More...
 
static constexpr int getSizeY ()
 Get number of elements in the view along Y dimension. More...
 
static constexpr int getStrideY ()
 Get element stride of the view along Y dimension. More...
 

Detailed Description

template<typename BaseTy, class ViewedElemT>
class sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >

This is a specialization of simd_view class with a single element.

Objects of such a class are created in the following situation: simd<int, 4> v = 1; auto v1 = v[0]; We allow implicit conversion to underlying type, e.g.: simd<int, 4> v = 1; int i = v[0]; Also, relational operators with such objects return a scalar bool value instead of a mask, to allow: bool b = v[0] > v[1] && v[2] < 42;

Definition at line 132 of file simd_view.hpp.

Member Typedef Documentation

◆ base_type

template<typename BaseTy , class ViewedElemT >
using sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >::base_type = BaseTy

Definition at line 147 of file simd_view.hpp.

◆ BaseClass

template<typename BaseTy , class ViewedElemT >
using sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >::BaseClass = detail::simd_view_impl<BaseTy, RegionTy>

Definition at line 139 of file simd_view.hpp.

◆ element_type

template<typename BaseTy , class ViewedElemT >
using sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >::element_type = ViewedElemT

The element type of this class, which could be different from the element type of the base object type.

Definition at line 146 of file simd_view.hpp.

◆ get_simd_t

template<typename BaseTy , class ViewedElemT >
template<typename ElT , int N>
using sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >::get_simd_t = typename BaseClass::template get_simd_t<ElT, N>

Definition at line 149 of file simd_view.hpp.

◆ RegionTy

template<typename BaseTy , class ViewedElemT >
using sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >::RegionTy = region1d_scalar_t<ViewedElemT>

Definition at line 138 of file simd_view.hpp.

◆ ShapeTy

template<typename BaseTy , class ViewedElemT >
using sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >::ShapeTy = typename shape_type<RegionTy>::type

Definition at line 140 of file simd_view.hpp.

◆ value_type

template<typename BaseTy , class ViewedElemT >
using sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >::value_type = get_simd_t<element_type, length>

The simd type if reading the object.

Definition at line 151 of file simd_view.hpp.

Constructor & Destructor Documentation

◆ simd_view()

template<typename BaseTy , class ViewedElemT >
sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >::simd_view ( BaseTy &  Base)
inline

Construct a complete view of a vector.

Definition at line 159 of file simd_view.hpp.

Member Function Documentation

◆ operator element_type()

template<typename BaseTy , class ViewedElemT >
sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >::operator element_type ( ) const
inline

Definition at line 161 of file simd_view.hpp.

◆ operator++() [1/2]

template<typename BaseTy , class ViewedElemT >
Derived& sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, RegionTy >::operator++
inline

Prefix increment.

Updates the target region viewed by this object.

Returns
This object cast to the derived class.

Definition at line 447 of file simd_view_impl.hpp.

◆ operator++() [2/2]

template<typename BaseTy , class ViewedElemT >
value_type sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, RegionTy >::operator++
inline

Postfix increment.

Returns
New vector object, whose element values are incremented values of the target region elements.

Definition at line 455 of file simd_view_impl.hpp.

◆ operator--() [1/2]

template<typename BaseTy , class ViewedElemT >
Derived& sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, RegionTy >::operator--
inline

Prefix decrement.

Updates the target region viewed by this object.

Returns
This object cast to the derived class.

Definition at line 463 of file simd_view_impl.hpp.

◆ operator--() [2/2]

template<typename BaseTy , class ViewedElemT >
value_type sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, RegionTy >::operator--
inline

Postfix decrement.

Returns
New vector object, whose element values are decremented values of the target region elements.

Definition at line 471 of file simd_view_impl.hpp.

◆ operator=() [1/7]

template<typename BaseTy , class ViewedElemT >
Derived& sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, RegionTy >::operator=
inline

Assignment from an object of the derived class.

Updates the target region viewed by this object.

Parameters
OtherThe source object.
Returns
This object cast to the derived class.

Definition at line 395 of file simd_view_impl.hpp.

◆ operator=() [2/7]

template<typename BaseTy , class ViewedElemT >
template<class T , int N, class SimdT , class = std::enable_if_t<(is_simd_type_v<SimdT> == is_simd_type_v<BaseTy>)&&(length == SimdT::length)>>
Derived& sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, RegionTy >::operator= ( class T  ,
int  N,
class SimdT  ,
class  = std::enable_if_t<(is_simd_type_v<SimdT> ==                                      is_simd_type_v<BaseTy>)&&(length ==                                                                SimdT::length)> 
)
inline

Assignment with element type conversion from a vector object.

Updates the target region viewed by this object. Available only when the length (number of elements) of the source object matches the length of the target region.

Template Parameters
TThe source vector element type. Auto-deduced.
NThe source vector length. Auto-deduced.
Parameters
OtherThe source vector.
Returns
This object cast to the derived class.

Definition at line 430 of file simd_view_impl.hpp.

◆ operator=() [3/7]

template<typename BaseTy , class ViewedElemT >
simd_view_impl& sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, RegionTy >::operator=
inline

Copy assignment.

Updates the target region viewed by this object.

Parameters
OtherThe source object.

Definition at line 387 of file simd_view_impl.hpp.

◆ operator=() [4/7]

template<typename BaseTy , class ViewedElemT >
Derived& sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, RegionTy >::operator=
inline

Assignment from a value_type object - simd or simd_mask.

Updates the target region viewed by this object.

Parameters
ValThe source object.
Returns
This object cast to the derived class.

Definition at line 401 of file simd_view_impl.hpp.

◆ operator=() [5/7]

template<typename BaseTy , class ViewedElemT >
Derived& sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, RegionTy >::operator=
inline

Assignment from an rvalue object of the derived class.

Updates the target region viewed by this object.

Parameters
OtherThe source rvalue object.
Returns
This object cast to the derived class.

Definition at line 407 of file simd_view_impl.hpp.

◆ operator=() [6/7]

template<typename BaseTy , class ViewedElemT >
simd_view_impl& sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, RegionTy >::operator=
inline

Move assignment operator. Updates the target region viewed by this object.

Definition at line 413 of file simd_view_impl.hpp.

◆ operator=() [7/7]

template<typename BaseTy , class ViewedElemT >
template<class T1 , class = std::enable_if_t<is_valid_simd_elem_type_v<T1>>>
Derived& sycl::_V1::ext::intel::esimd::detail::simd_view_impl< BaseTy, RegionTy >::operator= ( class T1  ,
class  = std::enable_if_t<is_valid_simd_elem_type_v<T1>> 
)
inline

Broadcast assignment of a scalar with conversion.

Updates the target region viewed by this object.

Template Parameters
T1The type of the scalar.
Parameters
RHSThe scalar.
Returns
This object cast to the derived class.

Definition at line 441 of file simd_view_impl.hpp.

Friends And Related Function Documentation

◆ detail::simd_obj_impl

template<typename BaseTy , class ViewedElemT >
template<typename , int , class , class >
friend class detail::simd_obj_impl
friend

Definition at line 134 of file simd_view.hpp.

◆ detail::simd_view_impl

template<typename BaseTy , class ViewedElemT >
template<typename , typename >
friend class detail::simd_view_impl
friend

Definition at line 135 of file simd_view.hpp.

Member Data Documentation

◆ length

template<typename BaseTy , class ViewedElemT >
constexpr int sycl::_V1::ext::intel::esimd::simd_view< BaseTy, region1d_scalar_t< ViewedElemT > >::length = ShapeTy::Size_x * ShapeTy::Size_y
staticconstexpr

Definition at line 141 of file simd_view.hpp.


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