poulpy/poulpy-backend/src/cpu_spqlios/spqlios-arithmetic/spqlios/cplx/cplx_fft_private.h
poulpy-backend/src/cpu_spqlios/spqlios-arithmetic/spqlios/cplx/cplx_fft_private.hRaw
1#ifndef SPQLIOS_CPLX_FFT_PRIVATE_H
2#define SPQLIOS_CPLX_FFT_PRIVATE_H
3
4#include "cplx_fft.h"
5
6typedef struct cplx_twiddle_precomp CPLX_FFTVEC_TWIDDLE_PRECOMP;
7typedef struct cplx_bitwiddle_precomp CPLX_FFTVEC_BITWIDDLE_PRECOMP;
8
9typedef void (*IFFT_FUNCTION)(const CPLX_IFFT_PRECOMP*, void*);
10typedef void (*FFT_FUNCTION)(const CPLX_FFT_PRECOMP*, void*);
11// conversions
12typedef void (*FROM_ZNX32_FUNCTION)(const CPLX_FROM_ZNX32_PRECOMP*, void*, const int32_t*);
13typedef void (*TO_ZNX32_FUNCTION)(const CPLX_FROM_ZNX32_PRECOMP*, int32_t*, const void*);
14typedef void (*FROM_TNX32_FUNCTION)(const CPLX_FROM_TNX32_PRECOMP*, void*, const int32_t*);
15typedef void (*TO_TNX32_FUNCTION)(const CPLX_TO_TNX32_PRECOMP*, int32_t*, const void*);
16typedef void (*FROM_RNX64_FUNCTION)(const CPLX_FROM_RNX64_PRECOMP* precomp, void* r, const double* x);
17typedef void (*TO_RNX64_FUNCTION)(const CPLX_TO_RNX64_PRECOMP* precomp, double* r, const void* x);
18typedef void (*ROUND_TO_RNX64_FUNCTION)(const CPLX_ROUND_TO_RNX64_PRECOMP* precomp, double* r, const void* x);
19// fftvec operations
20typedef void (*FFTVEC_MUL_FUNCTION)(const CPLX_FFTVEC_MUL_PRECOMP*, void*, const void*, const void*);
21typedef void (*FFTVEC_ADDMUL_FUNCTION)(const CPLX_FFTVEC_ADDMUL_PRECOMP*, void*, const void*, const void*);
22
23typedef void (*FFTVEC_TWIDDLE_FUNCTION)(const CPLX_FFTVEC_TWIDDLE_PRECOMP*, void*, const void*, const void*);
24typedef void (*FFTVEC_BITWIDDLE_FUNCTION)(const CPLX_FFTVEC_BITWIDDLE_PRECOMP*, void*, uint64_t, const void*);
25
26struct cplx_ifft_precomp {
27 IFFT_FUNCTION function;
28 int64_t m;
29 uint64_t buf_size;
30 double* powomegas;
31 void* aligned_buffers;
32};
33
34struct cplx_fft_precomp {
35 FFT_FUNCTION function;
36 int64_t m;
37 uint64_t buf_size;
38 double* powomegas;
39 void* aligned_buffers;
40};
41
42struct cplx_from_znx32_precomp {
43 FROM_ZNX32_FUNCTION function;
44 int64_t m;
45};
46
47struct cplx_to_znx32_precomp {
48 TO_ZNX32_FUNCTION function;
49 int64_t m;
50 double divisor;
51};
52
53struct cplx_from_tnx32_precomp {
54 FROM_TNX32_FUNCTION function;
55 int64_t m;
56};
57
58struct cplx_to_tnx32_precomp {
59 TO_TNX32_FUNCTION function;
60 int64_t m;
61 double divisor;
62};
63
64struct cplx_from_rnx64_precomp {
65 FROM_RNX64_FUNCTION function;
66 int64_t m;
67};
68
69struct cplx_to_rnx64_precomp {
70 TO_RNX64_FUNCTION function;
71 int64_t m;
72 double divisor;
73};
74
75struct cplx_round_to_rnx64_precomp {
76 ROUND_TO_RNX64_FUNCTION function;
77 int64_t m;
78 double divisor;
79 uint32_t log2bound;
80};
81
82typedef struct cplx_mul_precomp {
83 FFTVEC_MUL_FUNCTION function;
84 int64_t m;
85} CPLX_FFTVEC_MUL_PRECOMP;
86
87typedef struct cplx_addmul_precomp {
88 FFTVEC_ADDMUL_FUNCTION function;
89 int64_t m;
90} CPLX_FFTVEC_ADDMUL_PRECOMP;
91
92struct cplx_twiddle_precomp {
93 FFTVEC_TWIDDLE_FUNCTION function;
94 int64_t m;
95};
96
97struct cplx_bitwiddle_precomp {
98 FFTVEC_BITWIDDLE_FUNCTION function;
99 int64_t m;
100};
101
102EXPORT void cplx_fftvec_twiddle_fma(const CPLX_FFTVEC_TWIDDLE_PRECOMP* tables, void* a, void* b, const void* om);
103EXPORT void cplx_fftvec_twiddle_avx512(const CPLX_FFTVEC_TWIDDLE_PRECOMP* tables, void* a, void* b, const void* om);
104EXPORT void cplx_fftvec_bitwiddle_fma(const CPLX_FFTVEC_BITWIDDLE_PRECOMP* tables, void* a, uint64_t slice,
105 const void* om);
106EXPORT void cplx_fftvec_bitwiddle_avx512(const CPLX_FFTVEC_BITWIDDLE_PRECOMP* tables, void* a, uint64_t slice,
107 const void* om);
108
109#endif // SPQLIOS_CPLX_FFT_PRIVATE_H