23 inline namespace _V1 {
24 namespace ext::intel::esimd {
55 template <
typename VT,
typename ET = detail::element_type_t<VT>>
63 template <
typename VT>
static constexpr
unsigned alignment =
alignof(VT);
73 "Alignment value N for overaligned_tag<N> must be a power of two");
74 template <
typename>
static constexpr
unsigned alignment = N;
106 struct dqword_element_aligned_tag {
107 template <
typename VT,
typename ET = detail::element_type_t<VT>>
108 static constexpr
unsigned alignment =
alignof(ET) > 4 ?
alignof(ET) : 4;
111 inline constexpr dqword_element_aligned_tag dqword_element_aligned = {};
115 template <
class T,
int N,
size_t... Is>
116 constexpr vector_type_t<T, N> make_vector_impl(
const T (&&Arr)[N],
117 std::index_sequence<Is...>) {
118 return vector_type_t<T, N>{Arr[Is]...};
121 template <
class T,
int N>
122 constexpr vector_type_t<T, N> make_vector(
const T (&&Arr)[N]) {
123 return make_vector_impl<T, N>(std::move(Arr), std::make_index_sequence<N>{});
126 template <
class T,
int N,
size_t... Is>
127 constexpr
auto make_vector_impl(T Base, T Stride, std::index_sequence<Is...>) {
128 if constexpr (std::is_integral_v<T> && N <= 3) {
130 return vector_type_t<T, N>{(T)(Base + ((T)Is) * Stride)...};
132 using CppT =
typename element_type_traits<T>::EnclosingCppT;
134 CppT StrideCpp = Stride;
135 vector_type_t<CppT, N> VBase = BaseCpp;
136 vector_type_t<CppT, N> VStride = StrideCpp;
137 vector_type_t<CppT, N> VStrideCoef{(CppT)(Is)...};
138 vector_type_t<CppT, N> Result{VBase + VStride * VStrideCoef};
139 return wrapper_type_converter<T>::template to_vector<N>(Result);
143 template <
class T,
int N> constexpr
auto make_vector(T Base, T Stride) {
144 return make_vector_impl<T, N>(Base, Stride, std::make_index_sequence<N>{});
174 template <
typename RawTy,
int N,
class Derived,
class SFINAE>
175 #ifndef __SYCL_DEVICE_ONLY__
178 class [[__sycl_detail__::__uses_aspects__(
188 template <
typename,
typename>
friend class simd_view;
190 template <
typename,
int>
friend class simd;
212 template <
bool UseSet = true>
213 void init_from_array(
const Ty (&&Arr)[N])
noexcept {
216 if constexpr (is_wrapper_elem_type_v<Ty>) {
217 for (
auto I = 0; I < N; ++I) {
218 tmp[I] = bitcast_to_raw_type(Arr[I]);
221 tmp = make_vector(std::move(Arr));
223 if constexpr (UseSet) {
226 M_data = std::move(tmp);
236 Derived &cast_this_to_derived() {
return reinterpret_cast<Derived &
>(*this); }
237 const Derived &cast_this_to_derived()
const {
238 return reinterpret_cast<const Derived &
>(*this);
261 template <
class Ty1,
typename Derived1>
264 set(convert_vector<Ty, element_type_t<Derived1>, N>(other.
data()));
284 M_data = make_vector<Ty, N>(Base, Step);
293 class = std::enable_if_t<detail::is_valid_simd_elem_type_v<T1>>>
296 M_data = bitcast_to_raw_type(detail::convert_scalar<Ty>(Val));
303 template <
int N1,
class = std::enable_if_t<N1 == N>>
306 init_from_array<
false >(std::move(Arr));
321 template <
typename Flags,
322 typename std::enable_if_t<is_simd_flag_type_v<Flags>,
bool> =
true>
336 typename std::enable_if_t<
337 ext::oneapi::experimental::is_property_list_v<PropertyListT>,
341 using NewPropertyListT =
357 typename AccessorT,
typename Flags,
358 typename std::enable_if_t<
359 detail::is_accessor_with_v<AccessorT, accessor_mode_cap::can_read> &&
360 is_simd_flag_type_v<Flags>,
363 #ifdef __ESIMD_FORCE_STATELESS_MEM
370 #ifdef __ESIMD_FORCE_STATELESS_MEM
393 typename std::enable_if_t<
394 detail::is_accessor_with_v<AccessorT, accessor_mode_cap::can_read> &&
395 ext::oneapi::experimental::is_property_list_v<PropertyListT>,
398 #ifdef __ESIMD_FORCE_STATELESS_MEM
405 #ifdef __ESIMD_FORCE_STATELESS_MEM
411 using NewPropertyListT =
413 copy_from(acc, offset, NewPropertyListT{});
419 return cast_this_to_derived();
425 typename = std::enable_if_t<T::length == 1>>
426 operator Ty()
const {
428 return bitcast_to_wrapper_type<Ty>(
data()[0]);
434 #ifndef __SYCL_DEVICE_ONLY__
437 return __esimd_vload<RawTy, N>(&M_data);
452 Derived &
write(
const Derived &Val) {
454 return cast_this_to_derived();
463 void merge(
const Derived &Val,
const simd_mask_type<N> &Mask) {
464 check_wrregion_params<N, N, 0 , N, 1>();
465 set(__esimd_wrregion<RawTy, N, N, 0 /*VS*/, N, 1, N>(
data(), Val.data(), 0,
476 void merge(
const Derived &Val1, Derived Val2,
const simd_mask_type<N> &Mask) {
477 Val2.merge(Val1, Mask);
488 using TopRegionTy = compute_format_type_t<Derived, EltTy>;
490 return RetTy{cast_this_to_derived(), TopRegionTy{0}};
503 template <
typename EltTy,
int Height,
int W
idth>
505 using TopRegionTy = compute_format_type_2d_t<Derived, EltTy, Height, Width>;
507 return RetTy{cast_this_to_derived(), TopRegionTy{0, 0}};
517 template <
int Size,
int Str
ide>
519 select(uint16_t Offset = 0) &[[clang::lifetimebound]] {
520 static_assert(Size > 1 || Stride == 1,
521 "Stride must be 1 in single-element region");
522 region1d_t<Ty, Size, Stride> Reg(Offset);
523 return {cast_this_to_derived(), std::move(Reg)};
533 template <
int Size,
int Str
ide>
534 resize_a_simd_type_t<Derived, Size>
select(uint16_t Offset = 0) && {
535 static_assert(Size > 1 || Stride == 1,
536 "Stride must be 1 in single-element region");
537 Derived &&Val = std::move(cast_this_to_derived());
538 check_rdregion_params<N, Size, 0, Size, Stride>();
539 return __esimd_rdregion<RawTy, N, Size, 0, Size, Stride>(Val.data(),
552 [[clang::lifetimebound]] {
553 return select<1, 1>(i);
562 resize_a_simd_type_t<Derived, Size>
564 vector_type_t<uint16_t, Size> Offsets = Indices.
data() *
sizeof(RawTy);
565 return __esimd_rdindirect<RawTy, N, Size>(
data(), Offsets);
573 Val[Index] = bitcast_to_raw_type(V);
584 const resize_a_simd_type_t<Derived, Size> &Val,
585 const simd_mask_type<Size> &Mask) {
586 vector_type_t<uint16_t, Size> Offsets = Indices.
data() *
sizeof(RawTy);
587 set(__esimd_wrindirect<RawTy, N, Size>(
data(), Val.data(), Offsets,
594 template <
int Rep> resize_a_simd_type_t<Derived, Rep * N>
replicate()
const {
595 return replicate_w<Rep, N>(0);
605 template <
int Rep,
int W>
606 resize_a_simd_type_t<Derived, Rep * W>
replicate_w(uint16_t Offset)
const {
607 return replicate_vs_w_hs<Rep, 0, W, 1>(Offset);
619 template <
int Rep,
int VS,
int W>
621 return replicate_vs_w_hs<Rep, VS, W, 1>(Offset);
672 template <
int Rep,
int VS,
int W,
int HS>
673 resize_a_simd_type_t<Derived, Rep * W>
675 check_rdregion_params<N, Rep * W, VS, W, HS>();
676 return __esimd_rdregion<RawTy, N, Rep * W, VS, W, HS, N>(
677 data(), Offset *
sizeof(RawTy));
683 template <
typename T1 = Ty,
684 typename = std::enable_if_t<std::is_integral_v<T1>>>
686 return __esimd_any<Ty, N>(
data());
692 template <
typename T1 = Ty,
693 typename = std::enable_if_t<std::is_integral_v<T1>>>
695 return __esimd_all<Ty, N>(
data());
701 template <
typename RTy,
class ElemTy = __raw_t<
typename RTy::element_type>>
703 const vector_type_t<ElemTy, RTy::length> &Val) {
705 if constexpr (N *
sizeof(RawTy) ==
RTy::length *
sizeof(ElemTy))
707 set(bitcast<RawTy, ElemTy, RTy::length>(Val));
709 static_assert(!RTy::Is_2D);
711 auto Base = bitcast<ElemTy, RawTy, N>(
data());
712 constexpr
int BN = (N *
sizeof(RawTy)) /
sizeof(ElemTy);
714 constexpr
int M = RTy::Size_x;
715 constexpr
int Stride = RTy::Stride_x;
716 uint16_t Offset = Region.M_offset_x *
sizeof(ElemTy);
717 check_wrregion_params<BN, M, 0, M, Stride>();
719 auto Merged = __esimd_wrregion<ElemTy, BN, M,
720 0, M, Stride>(Base, Val, Offset);
722 set(bitcast<RawTy, ElemTy, BN>(Merged));
728 template <
typename TR,
typename UR,
729 class ElemTy = __raw_t<typename TR::element_type>>
731 const vector_type_t<ElemTy, TR::length> &Val) {
733 using PaTy =
typename shape_type<UR>::type;
734 using BT = __raw_t<typename PaTy::element_type>;
737 if constexpr (PaTy::Size_in_bytes == TR::Size_in_bytes) {
738 writeRegion(Region.second, bitcast<BT, ElemTy, TR::length>(Val));
741 auto Base = readRegion<RawTy, N>(
data(), Region.second);
743 auto Base1 = bitcast<ElemTy, BT, BN>(Base);
744 constexpr
int BN1 = PaTy::Size_in_bytes /
sizeof(ElemTy);
746 if constexpr (!TR::Is_2D) {
748 constexpr
int M = TR::Size_x;
749 constexpr
int Stride = TR::Stride_x;
750 uint16_t Offset = Region.first.M_offset_x *
sizeof(ElemTy);
752 check_wrregion_params<BN1, M, 0, M, Stride>();
754 Base1 = __esimd_wrregion<ElemTy, BN1, M,
755 0, M, Stride>(Base1, Val, Offset);
757 static_assert(std::is_same<ElemTy, BT>::value);
760 constexpr
int VS = PaTy::Size_x * TR::Stride_y;
761 constexpr
int W = TR::Size_x;
762 constexpr
int HS = TR::Stride_x;
763 constexpr
int ParentWidth = PaTy::Size_x;
766 uint16_t Offset =
static_cast<uint16_t
>(
767 (Region.first.M_offset_y * PaTy::Size_x + Region.first.M_offset_x) *
770 check_wrregion_params<BN1, M, VS, W, HS>();
772 Base1 = __esimd_wrregion<ElemTy, BN1, M, VS, W, HS, ParentWidth>(
776 auto Merged1 = bitcast<BT, ElemTy, BN1>(Base1);
793 template <
typename Flags = element_aligned_tag,
int ChunkSize = 32>
794 ESIMD_INLINE std::enable_if_t<is_simd_flag_type_v<Flags>>
809 template <
int ChunkSize = 32,
811 ESIMD_INLINE std::enable_if_t<
812 ext::oneapi::experimental::is_property_list_v<PropertyListT>>
813 copy_from(
const Ty *addr, PropertyListT = {}) SYCL_ESIMD_FUNCTION;
828 ESIMD_INLINE std::enable_if_t<detail::is_device_accessor_with_v<
829 AccessorT, accessor_mode_cap::can_read> &&
830 is_simd_flag_type_v<Flags>>
832 #ifdef __ESIMD_FORCE_STATELESS_MEM
837 Flags) SYCL_ESIMD_FUNCTION;
852 template <
typename AccessorT,
int ChunkSize = 32,
854 ESIMD_INLINE std::enable_if_t<
855 detail::is_device_accessor_with_v<AccessorT,
856 accessor_mode_cap::can_read> &&
857 ext::oneapi::experimental::is_property_list_v<PropertyListT>>
859 #ifdef __ESIMD_FORCE_STATELESS_MEM
864 PropertyListT = {}) SYCL_ESIMD_FUNCTION;
879 ESIMD_INLINE std::enable_if_t<detail::is_local_accessor_with_v<
880 AccessorT, accessor_mode_cap::can_read> &&
881 is_simd_flag_type_v<Flags>,
883 copy_from(AccessorT acc, uint32_t offset, Flags) SYCL_ESIMD_FUNCTION;
898 template <
typename AccessorT,
int ChunkSize = 32,
900 ESIMD_INLINE std::enable_if_t<
901 detail::is_local_accessor_with_v<AccessorT,
902 accessor_mode_cap::can_read> &&
903 ext::oneapi::experimental::is_property_list_v<PropertyListT>,
906 PropertyListT = {}) SYCL_ESIMD_FUNCTION;
914 template <
typename Flags,
int ChunkSize = 32>
915 ESIMD_INLINE std::enable_if_t<is_simd_flag_type_v<Flags>>
916 copy_to(Ty *addr, Flags)
const SYCL_ESIMD_FUNCTION;
925 template <
int ChunkSize = 32,
927 ESIMD_INLINE std::enable_if_t<
928 ext::oneapi::experimental::is_property_list_v<PropertyListT>>
929 copy_to(Ty *addr, PropertyListT = {})
const SYCL_ESIMD_FUNCTION;
940 template <
typename AccessorT,
typename Flags,
int ChunkSize = 32>
941 ESIMD_INLINE std::enable_if_t<detail::is_device_accessor_with_v<
942 AccessorT, accessor_mode_cap::can_write> &&
943 is_simd_flag_type_v<Flags>>
945 #ifdef __ESIMD_FORCE_STATELESS_MEM
950 Flags)
const SYCL_ESIMD_FUNCTION;
962 template <
typename AccessorT,
int ChunkSize = 32,
964 ESIMD_INLINE std::enable_if_t<
965 detail::is_device_accessor_with_v<AccessorT,
966 accessor_mode_cap::can_write> &&
967 ext::oneapi::experimental::is_property_list_v<PropertyListT>>
969 #ifdef __ESIMD_FORCE_STATELESS_MEM
974 PropertyListT = {})
const SYCL_ESIMD_FUNCTION;
985 template <
typename AccessorT,
typename Flags,
int ChunkSize = 32>
986 ESIMD_INLINE std::enable_if_t<detail::is_local_accessor_with_v<
987 AccessorT, accessor_mode_cap::can_write> &&
988 is_simd_flag_type_v<Flags>,
990 copy_to(AccessorT acc, uint32_t offset, Flags)
const SYCL_ESIMD_FUNCTION;
1002 template <
typename AccessorT,
int ChunkSize = 32,
1004 ESIMD_INLINE std::enable_if_t<
1005 detail::is_local_accessor_with_v<AccessorT,
1006 accessor_mode_cap::can_write> &&
1007 ext::oneapi::experimental::is_property_list_v<PropertyListT>,
1010 PropertyListT = {})
const SYCL_ESIMD_FUNCTION;
1017 template <
class T1 = Ty,
class = std::enable_if_t<std::is_
integral_v<T1>>>
1020 detail::vector_unary_op<detail::UnaryOp::bit_not, T1, N>(
data())};
1029 template <
class T1 = Ty,
class = std::enable_if_t<std::is_
integral_v<T1>>>
1034 #define __ESIMD_DEF_SIMD_OBJ_IMPL_OPASSIGN(BINOP, OPASSIGN, COND) \
1040 template <class T1, class SimdT, \
1041 class = std::enable_if_t<(is_simd_type_v<Derived> == \
1042 is_simd_type_v<SimdT>)&&COND>> \
1043 Derived &operator OPASSIGN( \
1044 const __ESIMD_DNS::simd_obj_impl<T1, N, SimdT> &RHS) { \
1045 auto Res = *this BINOP RHS; \
1046 using ResT = decltype(Res); \
1047 set(__ESIMD_DNS::convert_vector<element_type, typename ResT::element_type, \
1048 length>(Res.data())); \
1049 return cast_this_to_derived(); \
1057 template <class SimdT1, class RegionT1, \
1058 class T1 = typename RegionT1::element_type, \
1059 class = std::enable_if_t< \
1060 (is_simd_type_v<Derived> == \
1061 is_simd_type_v<SimdT1>)&&(RegionT1::length == length) && \
1063 Derived &operator OPASSIGN( \
1064 const __ESIMD_NS::simd_view<SimdT1, RegionT1> &RHS) { \
1065 auto Res = *this BINOP RHS.read(); \
1066 using ResT = decltype(Res); \
1067 set(__ESIMD_DNS::convert_vector<element_type, typename ResT::element_type, \
1068 length>(Res.data())); \
1069 return cast_this_to_derived(); \
1075 template <class T1, class = std::enable_if_t<COND>> \
1076 Derived &operator OPASSIGN(T1 RHS) { \
1077 if constexpr (is_simd_type_v<Derived>) { \
1078 using RHSVecT = __ESIMD_DNS::construct_a_simd_type_t<Derived, T1, N>; \
1079 return *this OPASSIGN RHSVecT(RHS); \
1081 return *this OPASSIGN Derived((RawTy)RHS); \
1087 #define __ESIMD_BITWISE_OP_FILTER \
1088 std::is_integral_v<element_type> &&std::is_integral_v<T1>
1101 #undef __ESIMD_BITWISE_OP_FILTER
1105 #define __ESIMD_SHIFT_OP_FILTER \
1106 std::is_integral_v<element_type> &&std::is_integral_v<T1> \
1107 &&__ESIMD_DNS::is_simd_type_v<Derived>
1116 #undef __ESIMD_SHIFT_OP_FILTER
1121 #define __ESIMD_ARITH_OP_FILTER \
1122 __ESIMD_DNS::is_simd_type_v<Derived> &&__ESIMD_DNS::is_vectorizable_v<T1>
1132 #undef __ESIMD_ARITH_OP_FILTER
1133 #undef __ESIMD_DEF_SIMD_OBJ_IMPL_OPASSIGN
1136 __ESIMD_DECLARE_TEST_PROXY_ACCESS
1142 template <
int ChunkSize,
typename Flags,
typename AccessorT,
typename TOffset>
1143 ESIMD_INLINE std::enable_if_t<is_simd_flag_type_v<Flags>>
1144 copy_to_impl(AccessorT acc, TOffset offset)
const SYCL_ESIMD_FUNCTION;
1145 template <
int ChunkSize,
typename PropertyListT,
typename AccessorT,
1147 ESIMD_INLINE std::enable_if_t<
1148 ext::oneapi::experimental::is_property_list_v<PropertyListT>>
1149 copy_to_impl(AccessorT acc, TOffset offset,
1150 PropertyListT = {})
const SYCL_ESIMD_FUNCTION;
1151 template <
int ChunkSize,
typename Flags,
typename AccessorT,
typename TOffset>
1152 ESIMD_INLINE std::enable_if_t<is_simd_flag_type_v<Flags>>
1153 copy_from_impl(AccessorT acc, TOffset offset) SYCL_ESIMD_FUNCTION;
1154 template <
int ChunkSize,
typename PropertyListT,
typename AccessorT,
1156 ESIMD_INLINE std::enable_if_t<
1157 ext::oneapi::experimental::is_property_list_v<PropertyListT>>
1158 copy_from_impl(AccessorT acc, TOffset offset,
1159 PropertyListT = {}) SYCL_ESIMD_FUNCTION;
1163 __ESIMD_DECLARE_TEST_PROXY
1166 #ifndef __SYCL_DEVICE_ONLY__
1169 __esimd_vstore<RawTy, N>(&M_data, Val);
This class is a simd_obj_impl specialization representing a simd mask, which is basically a simd_obj_...
This is a base class for all ESIMD simd classes with real storage (simd, simd_mask_impl).
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.
simd_obj_impl(T1 Val) noexcept
Broadcast constructor.
resize_a_simd_type_t< Derived, Size > iselect(const simd< uint16_t, Size > &Indices)
Indirect select - select and extract multiple elements with given variable indices.
simd_obj_impl(const Ty *ptr, Flags) noexcept
Pointer-based load constructor.
resize_a_simd_type_t< Derived, Rep *N > replicate() const
Replicates contents of this vector a number of times into a new vector.
ESIMD_INLINE std::enable_if_t< detail::is_device_accessor_with_v< AccessorT, accessor_mode_cap::can_read > &&ext::oneapi::experimental::is_property_list_v< PropertyListT > > copy_from(AccessorT acc, uint32_t offset, PropertyListT={}) SYCL_ESIMD_FUNCTION
Copy a contiguous block of data from memory into this simd_obj_impl object.
Derived & operator=(const simd_obj_impl &other) noexcept
Copy assignment operator.
get_vector_element_type< Derived > element_type
Element type of the derived (user) class.
ESIMD_INLINE std::enable_if_t< detail::is_local_accessor_with_v< AccessorT, accessor_mode_cap::can_read > &&is_simd_flag_type_v< Flags >, 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.
raw_vector_type & data_ref()
Derived & write(const Derived &Val)
Replaces the underlying data with the one taken from another object.
Ty operator[](int i) const
Get value of this vector's element.
simd_obj_impl(AccessorT acc, uint32_t offset, PropertyListT={}) noexcept
Accessor-based load constructor.
ESIMD_INLINE std::enable_if_t< detail::is_local_accessor_with_v< AccessorT, accessor_mode_cap::can_write > &&ext::oneapi::experimental::is_property_list_v< PropertyListT >, void > copy_to(AccessorT acc, uint32_t offset, PropertyListT={}) const SYCL_ESIMD_FUNCTION
Copy all vector elements of this object into a contiguous block in memory.
ESIMD_INLINE std::enable_if_t< ext::oneapi::experimental::is_property_list_v< PropertyListT > > copy_from(const Ty *addr, PropertyListT={}) SYCL_ESIMD_FUNCTION
Copy a contiguous block of data from memory into this simd_obj_impl object.
static constexpr int length
The number of elements in this object.
simd_obj_impl(Ty Base, Ty Step) noexcept
Arithmetic progression constructor.
auto bit_cast_view() &
Create a 2-dimensional view of this object.
uint16_t all() const
See if all elements are non-zero.
ESIMD_INLINE std::enable_if_t< detail::is_local_accessor_with_v< AccessorT, accessor_mode_cap::can_write > &&is_simd_flag_type_v< Flags >, 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.
simd_obj_impl(const simd_obj_impl< Ty1, N, Derived1, SFINAE > &other)
Implicit conversion constructor from another simd_obj_impl object.
void iupdate(const simd< uint16_t, Size > &Indices, const resize_a_simd_type_t< Derived, Size > &Val, const simd_mask_type< Size > &Mask)
Indirect update - update multiple elements with given variable indices.
ESIMD_INLINE std::enable_if_t< detail::is_local_accessor_with_v< AccessorT, accessor_mode_cap::can_read > &&ext::oneapi::experimental::is_property_list_v< PropertyListT >, void > copy_from(AccessorT acc, uint32_t offset, PropertyListT={}) SYCL_ESIMD_FUNCTION
Copy a contiguous block of data from memory into this simd_obj_impl object.
simd_obj_impl(const simd_obj_impl &other)
Copy constructor.
void merge(const Derived &Val, const simd_mask_type< N > &Mask)
"Merges" this object's value with another object: replaces part of the underlying data with the one t...
simd_mask_type< N > operator!() const
Unary logical negation operator, available in all subclasses, but only for integral element types (si...
simd_obj_impl(const Ty *ptr, PropertyListT={}) noexcept
Pointer-based load constructor.
simd_obj_impl()=default
Default constructor.
raw_vector_type data() const
void iupdate(ushort Index, Ty V)
Update single element with variable index.
simd_obj_impl(AccessorT acc, uint32_t offset, Flags) noexcept
Accessor-based load constructor.
RawTy raw_element_type
The element type of the raw storage vector.
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.
ESIMD_INLINE std::enable_if_t< is_simd_flag_type_v< Flags > > copy_to(Ty *addr, Flags) const SYCL_ESIMD_FUNCTION
Copy all vector elements of this object into a contiguous block in memory.
simd_obj_impl(const Ty(&&Arr)[N1]) noexcept
Rvalue array-based constructor.
ESIMD_INLINE std::enable_if_t< detail::is_device_accessor_with_v< AccessorT, accessor_mode_cap::can_write > &&is_simd_flag_type_v< Flags > > 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.
void merge(const Derived &Val1, Derived Val2, const simd_mask_type< N > &Mask)
Merges given two objects with a mask and writes resulting data into this object.
ESIMD_INLINE std::enable_if_t< is_simd_flag_type_v< Flags > > copy_from(const Ty *addr, Flags) SYCL_ESIMD_FUNCTION
Copy a contiguous block of data from memory into this simd_obj_impl object.
Derived operator~() const
Per-element bitwise inversion, available in all subclasses, but only for integral element types (simd...
ESIMD_INLINE std::enable_if_t< detail::is_device_accessor_with_v< AccessorT, accessor_mode_cap::can_write > &&ext::oneapi::experimental::is_property_list_v< PropertyListT > > copy_to(AccessorT acc, uint32_t offset, PropertyListT={}) const SYCL_ESIMD_FUNCTION
Copy all vector elements of this object into a contiguous block in memory.
ESIMD_INLINE std::enable_if_t< ext::oneapi::experimental::is_property_list_v< PropertyListT > > copy_to(Ty *addr, PropertyListT={}) const SYCL_ESIMD_FUNCTION
Copy all vector elements of this object into a contiguous block in memory.
auto bit_cast_view() &
Create a 1-dimensional view of this object.
resize_a_simd_type_t< Derived, 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 elem...
resize_a_simd_type_t< Derived, Rep *W > replicate_vs_w_hs(uint16_t Offset) const
This function "replicates" a portion of this object's elements into a new object.
__ESIMD_DECLARE_TEST_PROXY void set(const raw_vector_type &Val)
simd_view< Derived, 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.
simd_obj_impl(const raw_vector_type &Val)
Implicit conversion constructor from a raw vector object.
resize_a_simd_type_t< Derived, Size > select(uint16_t Offset=0) &&
Select and extract a subregion of this object's elements and return it as a new vector object.
simd_view< Derived, region1d_scalar_t< Ty > > operator[](int i)
Return writable view of a single element.
ESIMD_INLINE std::enable_if_t< detail::is_device_accessor_with_v< AccessorT, accessor_mode_cap::can_read > &&is_simd_flag_type_v< Flags > > 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.
vector_type_t< RawTy, N > raw_vector_type
The underlying raw storage vector data type.
uint16_t any() const
See if any element is non-zero.
resize_a_simd_type_t< Derived, Rep *W > replicate_vs_w(uint16_t Offset) const
Shortcut to replicate_vs_w_hs with HS=1 to replicate dense blocks.
Base class for "simd view" types.
This class represents a reference to a sub-region of a base simd object.
The main simd vector class.
#define __esimd_dbg_print(a)
constexpr vector_aligned_tag vector_aligned
static constexpr bool is_simd_flag_type_v
Checks if given type is a simd load/store flag.
constexpr overaligned_tag< N > overaligned
constexpr element_aligned_tag element_aligned
typename add_alignment_property< PropertyListT, Alignment >::type add_alignment_property_t
constexpr ESIMD_INLINE bool isPowerOf2(unsigned int n)
Check if a given 32 bit positive integer is a power of 2 at compile time.
constexpr alignment_key::value_t< K > alignment
properties< std::tuple<> > empty_properties_t
ValueT length(const ValueT *a, const int len)
Calculate the square root of the input array.
#define __ESIMD_SHIFT_OP_FILTER
#define __ESIMD_DEF_SIMD_OBJ_IMPL_OPASSIGN(BINOP, OPASSIGN, COND)
#define __ESIMD_BITWISE_OP_FILTER
#define __ESIMD_ARITH_OP_FILTER
_Abi const simd< _Tp, _Abi > & noexcept
element_aligned_tag type.
static constexpr unsigned alignment
Checks if type is a simd load/store flag.
static constexpr unsigned alignment
static constexpr unsigned alignment