12#ifndef EIGEN_PACKET_MATH_RVV10_DECL_H
13#define EIGEN_PACKET_MATH_RVV10_DECL_H
16#include "../../InternalHeaderCheck.h"
20#ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
21#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8
24#ifndef EIGEN_HAS_SINGLE_INSTRUCTION_MADD
25#define EIGEN_HAS_SINGLE_INSTRUCTION_MADD
28#define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 32
30template <
typename Scalar, std::
size_t VectorLength, std::
size_t VectorLMul>
31struct rvv_packet_size_selector {
32 enum { size = VectorLength * VectorLMul / (
sizeof(Scalar) * CHAR_BIT) };
35template <std::
size_t VectorLength, std::
size_t VectorLMul>
36struct rvv_packet_alignment_selector {
39 (VectorLength * VectorLMul) >= 1024
41 : ((VectorLength * VectorLMul) >= 512 ?
Aligned64
46typedef vbool64_t PacketMask64;
47typedef vbool32_t PacketMask32;
48typedef vbool16_t PacketMask16;
49typedef vbool8_t PacketMask8;
50typedef vbool4_t PacketMask4;
52template <
typename Packet>
53struct rvv_half_packet {
57template <
typename Packet>
58using rvv_half_packet_t =
typename rvv_half_packet<Packet>::type;
60template <
typename Scalar,
typename Packet, std::
size_t VectorLMul>
61struct rvv_default_unpacket_traits {
63 typedef rvv_half_packet_t<Packet> half;
64 typedef numext::uint8_t mask_t;
66 size = rvv_packet_size_selector<Scalar, EIGEN_RISCV64_RVV_VL, VectorLMul>::size,
67 alignment = rvv_packet_alignment_selector<EIGEN_RISCV64_RVV_VL, VectorLMul>::alignment,
69 masked_load_available =
false,
70 masked_store_available =
false
76typedef eigen_packet_wrapper<vint16m1_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL))), 18> Packet1Xs;
77typedef eigen_packet_wrapper<vuint16m1_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL))), 19> Packet1Xsu;
79typedef eigen_packet_wrapper<vint16m2_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 2))), 20> Packet2Xs;
80typedef eigen_packet_wrapper<vuint16m2_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 2))), 21>
83typedef eigen_packet_wrapper<vint16m4_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 4))), 22> Packet4Xs;
84typedef eigen_packet_wrapper<vuint16m4_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 4))), 23>
88struct rvv_half_packet<Packet2Xs> {
89 typedef Packet1Xs type;
92struct rvv_half_packet<Packet4Xs> {
93 typedef Packet2Xs type;
97struct unpacket_traits<Packet1Xs> : rvv_default_unpacket_traits<numext::int16_t, Packet1Xs, 1> {};
100struct unpacket_traits<Packet2Xs> : rvv_default_unpacket_traits<numext::int16_t, Packet2Xs, 2> {};
103struct unpacket_traits<Packet4Xs> : rvv_default_unpacket_traits<numext::int16_t, Packet4Xs, 4> {};
106typedef eigen_packet_wrapper<vint32m1_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL))), 0> Packet1Xi;
107typedef eigen_packet_wrapper<vuint32m1_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL))), 1> Packet1Xu;
109typedef eigen_packet_wrapper<vint32m2_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 2))), 2> Packet2Xi;
110typedef eigen_packet_wrapper<vuint32m2_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 2))), 3> Packet2Xu;
112typedef eigen_packet_wrapper<vint32m4_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 4))), 4> Packet4Xi;
113typedef eigen_packet_wrapper<vuint32m4_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 4))), 5> Packet4Xu;
116struct rvv_half_packet<Packet2Xi> {
117 typedef Packet1Xi type;
120struct rvv_half_packet<Packet4Xi> {
121 typedef Packet2Xi type;
125struct unpacket_traits<Packet1Xi> : rvv_default_unpacket_traits<numext::int32_t, Packet1Xi, 1> {};
127struct unpacket_traits<Packet2Xi> : rvv_default_unpacket_traits<numext::int32_t, Packet2Xi, 2> {};
129struct unpacket_traits<Packet4Xi> : rvv_default_unpacket_traits<numext::int32_t, Packet4Xi, 4> {};
133typedef eigen_packet_wrapper<vint64m1_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL))), 9> Packet1Xl;
134typedef eigen_packet_wrapper<vuint64m1_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL))), 10> Packet1Xul;
136typedef eigen_packet_wrapper<vint64m2_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 2))), 11> Packet2Xl;
137typedef eigen_packet_wrapper<vuint64m2_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 2))), 12>
140typedef eigen_packet_wrapper<vint64m4_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 4))), 13> Packet4Xl;
141typedef eigen_packet_wrapper<vuint64m4_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 4))), 14>
145struct rvv_half_packet<Packet2Xl> {
146 typedef Packet1Xl type;
149struct rvv_half_packet<Packet4Xl> {
150 typedef Packet2Xl type;
154struct unpacket_traits<Packet1Xl> : rvv_default_unpacket_traits<numext::int64_t, Packet1Xl, 1> {};
157struct unpacket_traits<Packet2Xl> : rvv_default_unpacket_traits<numext::int64_t, Packet2Xl, 2> {};
160struct unpacket_traits<Packet4Xl> : rvv_default_unpacket_traits<numext::int64_t, Packet4Xl, 4> {};
164typedef eigen_packet_wrapper<vfloat32m1_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL))), 6> Packet1Xf;
165typedef eigen_packet_wrapper<vfloat32m2_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 2))), 7>
167typedef eigen_packet_wrapper<vfloat32m4_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 4))), 8>
171struct rvv_half_packet<Packet2Xf> {
172 typedef Packet1Xf type;
175struct rvv_half_packet<Packet4Xf> {
176 typedef Packet2Xf type;
180struct unpacket_traits<Packet1Xf> : rvv_default_unpacket_traits<float, Packet1Xf, 1> {
181 typedef Packet1Xi integer_packet;
182 typedef PacketMask32 packet_mask;
186struct unpacket_traits<Packet2Xf> : rvv_default_unpacket_traits<float, Packet2Xf, 2> {
187 typedef Packet2Xi integer_packet;
188 typedef PacketMask16 packet_mask;
192struct unpacket_traits<Packet4Xf> : rvv_default_unpacket_traits<float, Packet4Xf, 4> {
193 typedef Packet4Xi integer_packet;
194 typedef PacketMask8 packet_mask;
199typedef eigen_packet_wrapper<vfloat64m1_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL))), 15> Packet1Xd;
200typedef eigen_packet_wrapper<vfloat64m2_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 2))), 16>
202typedef eigen_packet_wrapper<vfloat64m4_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL * 4))), 17>
206struct rvv_half_packet<Packet2Xd> {
207 typedef Packet1Xd type;
210struct rvv_half_packet<Packet4Xd> {
211 typedef Packet2Xd type;
215struct unpacket_traits<Packet1Xd> : rvv_default_unpacket_traits<double, Packet1Xd, 1> {
216 typedef Packet1Xl integer_packet;
217 typedef PacketMask64 packet_mask;
221struct unpacket_traits<Packet2Xd> : rvv_default_unpacket_traits<double, Packet2Xd, 2> {
222 typedef Packet2Xl integer_packet;
223 typedef PacketMask32 packet_mask;
227struct unpacket_traits<Packet4Xd> : rvv_default_unpacket_traits<double, Packet4Xd, 4> {
228 typedef Packet4Xl integer_packet;
229 typedef PacketMask16 packet_mask;
234typedef eigen_packet_wrapper<vint8m1_t __attribute__((riscv_rvv_vector_bits(EIGEN_RISCV64_RVV_VL))), 28> Packet1Xc;
237struct unpacket_traits<Packet1Xc> : rvv_default_unpacket_traits<numext::int8_t, Packet1Xc, 1> {};
241#if EIGEN_RISCV64_DEFAULT_LMUL == 1
242typedef Packet1Xs PacketXs;
243typedef Packet1Xsu PacketXsu;
244typedef Packet1Xi PacketXi;
245typedef Packet1Xu PacketXu;
246typedef Packet1Xl PacketXl;
247typedef Packet1Xul PacketXul;
248typedef Packet1Xf PacketXf;
249typedef Packet1Xd PacketXd;
250#elif EIGEN_RISCV64_DEFAULT_LMUL == 2
251typedef Packet2Xs PacketXs;
252typedef Packet2Xsu PacketXsu;
253typedef Packet2Xi PacketXi;
254typedef Packet2Xu PacketXu;
255typedef Packet2Xl PacketXl;
256typedef Packet2Xul PacketXul;
257typedef Packet2Xf PacketXf;
258typedef Packet2Xd PacketXd;
259#elif EIGEN_RISCV64_DEFAULT_LMUL == 4
260typedef Packet4Xs PacketXs;
261typedef Packet4Xsu PacketXsu;
262typedef Packet4Xi PacketXi;
263typedef Packet4Xu PacketXu;
264typedef Packet4Xl PacketXl;
265typedef Packet4Xul PacketXul;
266typedef Packet4Xf PacketXf;
267typedef Packet4Xd PacketXd;
270template <
typename Scalar,
typename Packet>
271struct rvv_default_packet_traits : default_packet_traits {
273 typedef rvv_half_packet_t<type> half;
276 size = unpacket_traits<Packet>::size,
283template <
typename Scalar,
typename Packet>
284struct rvv_default_float_packet_traits : rvv_default_packet_traits<Scalar, Packet> {
287 HasSin = EIGEN_FAST_MATH,
288 HasCos = EIGEN_FAST_MATH,
289 HasTan = EIGEN_FAST_MATH,
305 HasTanh = EIGEN_FAST_MATH,
306 HasErf = EIGEN_FAST_MATH,
307 HasErfc = EIGEN_FAST_MATH
312struct packet_traits<numext::int16_t> : rvv_default_packet_traits<numext::int16_t, PacketXs> {};
315struct packet_traits<numext::int32_t> : rvv_default_packet_traits<numext::int32_t, PacketXi> {};
318struct packet_traits<numext::int64_t> : rvv_default_packet_traits<numext::int64_t, PacketXl> {};
321struct packet_traits<float> : rvv_default_float_packet_traits<float, PacketXf> {};
324struct packet_traits<double> : rvv_default_float_packet_traits<double, PacketXd> {};
329EIGEN_STRONG_INLINE
void prefetch<numext::int16_t>(
const numext::int16_t* addr) {
330#if EIGEN_HAS_BUILTIN(__builtin_prefetch) || EIGEN_COMP_GNUC
331 __builtin_prefetch(addr);
336EIGEN_STRONG_INLINE
void prefetch<numext::int32_t>(
const numext::int32_t* addr) {
337#if EIGEN_HAS_BUILTIN(__builtin_prefetch) || EIGEN_COMP_GNUC
338 __builtin_prefetch(addr);
343EIGEN_STRONG_INLINE
void prefetch<numext::int64_t>(
const numext::int64_t* addr) {
344#if EIGEN_HAS_BUILTIN(__builtin_prefetch) || EIGEN_COMP_GNUC
345 __builtin_prefetch(addr);
@ Aligned64
Definition Constants.h:240
@ Aligned128
Definition Constants.h:241
@ Aligned32
Definition Constants.h:239
@ Aligned16
Definition Constants.h:238