|
1 | 1 | #include "fft128.cuh" |
| 2 | +#include "polynomial/dispatch.cuh" |
2 | 3 |
|
3 | 4 | void cuda_fourier_transform_forward_as_integer_f128_async( |
4 | 5 | void *stream, uint32_t gpu_index, void *re0, void *re1, void *im0, |
5 | 6 | void *im1, void const *standard, const uint32_t N, |
6 | 7 | const uint32_t number_of_samples) { |
7 | | - switch (N) { |
8 | | - case 64: |
9 | | - host_fourier_transform_forward_as_integer_f128<AmortizedDegree<64>>( |
10 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
11 | | - (double *)re1, (double *)im0, (double *)im1, |
12 | | - (__uint128_t const *)standard, N, number_of_samples); |
13 | | - break; |
14 | | - case 128: |
15 | | - host_fourier_transform_forward_as_integer_f128<AmortizedDegree<128>>( |
16 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
17 | | - (double *)re1, (double *)im0, (double *)im1, |
18 | | - (__uint128_t const *)standard, N, number_of_samples); |
19 | | - break; |
20 | | - case 256: |
21 | | - host_fourier_transform_forward_as_integer_f128<AmortizedDegree<256>>( |
22 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
23 | | - (double *)re1, (double *)im0, (double *)im1, |
24 | | - (__uint128_t const *)standard, N, number_of_samples); |
25 | | - break; |
26 | | - case 512: |
27 | | - host_fourier_transform_forward_as_integer_f128<AmortizedDegree<512>>( |
28 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
29 | | - (double *)re1, (double *)im0, (double *)im1, |
30 | | - (__uint128_t const *)standard, N, number_of_samples); |
31 | | - break; |
32 | | - case 1024: |
33 | | - host_fourier_transform_forward_as_integer_f128<AmortizedDegree<1024>>( |
34 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
35 | | - (double *)re1, (double *)im0, (double *)im1, |
36 | | - (__uint128_t const *)standard, N, number_of_samples); |
37 | | - break; |
38 | | - case 2048: |
39 | | - host_fourier_transform_forward_as_integer_f128<AmortizedDegree<2048>>( |
40 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
41 | | - (double *)re1, (double *)im0, (double *)im1, |
42 | | - (__uint128_t const *)standard, N, number_of_samples); |
43 | | - break; |
44 | | - case 4096: |
45 | | - host_fourier_transform_forward_as_integer_f128<AmortizedDegree<4096>>( |
46 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
47 | | - (double *)re1, (double *)im0, (double *)im1, |
48 | | - (__uint128_t const *)standard, N, number_of_samples); |
49 | | - break; |
50 | | - default: |
51 | | - PANIC("Cuda error (f128 fft): unsupported polynomial size. Supported " |
52 | | - "N's are powers of two" |
53 | | - " in the interval [64..4096].") |
54 | | - } |
| 8 | + DISPATCH_POLY_SIZE(N, AmortizedDegreePolicyFFT128, |
| 9 | + host_fourier_transform_forward_as_integer_f128<Params>( |
| 10 | + static_cast<cudaStream_t>(stream), gpu_index, |
| 11 | + (double *)re0, (double *)re1, (double *)im0, |
| 12 | + (double *)im1, (__uint128_t const *)standard, N, |
| 13 | + number_of_samples)); |
55 | 14 | } |
56 | 15 |
|
57 | 16 | void cuda_fourier_transform_forward_as_torus_f128_async( |
58 | 17 | void *stream, uint32_t gpu_index, void *re0, void *re1, void *im0, |
59 | 18 | void *im1, void const *standard, const uint32_t N, |
60 | 19 | const uint32_t number_of_samples) { |
61 | | - switch (N) { |
62 | | - case 64: |
63 | | - host_fourier_transform_forward_as_torus_f128<AmortizedDegree<64>>( |
64 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
65 | | - (double *)re1, (double *)im0, (double *)im1, |
66 | | - (__uint128_t const *)standard, N, number_of_samples); |
67 | | - break; |
68 | | - case 128: |
69 | | - host_fourier_transform_forward_as_torus_f128<AmortizedDegree<128>>( |
70 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
71 | | - (double *)re1, (double *)im0, (double *)im1, |
72 | | - (__uint128_t const *)standard, N, number_of_samples); |
73 | | - break; |
74 | | - case 256: |
75 | | - host_fourier_transform_forward_as_torus_f128<AmortizedDegree<256>>( |
76 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
77 | | - (double *)re1, (double *)im0, (double *)im1, |
78 | | - (__uint128_t const *)standard, N, number_of_samples); |
79 | | - break; |
80 | | - case 512: |
81 | | - host_fourier_transform_forward_as_torus_f128<AmortizedDegree<512>>( |
82 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
83 | | - (double *)re1, (double *)im0, (double *)im1, |
84 | | - (__uint128_t const *)standard, N, number_of_samples); |
85 | | - break; |
86 | | - case 1024: |
87 | | - host_fourier_transform_forward_as_torus_f128<AmortizedDegree<1024>>( |
88 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
89 | | - (double *)re1, (double *)im0, (double *)im1, |
90 | | - (__uint128_t const *)standard, N, number_of_samples); |
91 | | - break; |
92 | | - case 2048: |
93 | | - host_fourier_transform_forward_as_torus_f128<AmortizedDegree<2048>>( |
94 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
95 | | - (double *)re1, (double *)im0, (double *)im1, |
96 | | - (__uint128_t const *)standard, N, number_of_samples); |
97 | | - break; |
98 | | - case 4096: |
99 | | - host_fourier_transform_forward_as_torus_f128<AmortizedDegree<4096>>( |
100 | | - static_cast<cudaStream_t>(stream), gpu_index, (double *)re0, |
101 | | - (double *)re1, (double *)im0, (double *)im1, |
102 | | - (__uint128_t const *)standard, N, number_of_samples); |
103 | | - break; |
104 | | - default: |
105 | | - PANIC("Cuda error (f128 fft): unsupported polynomial size. Supported " |
106 | | - "N's are powers of two" |
107 | | - " in the interval [64..4096].") |
108 | | - } |
| 20 | + DISPATCH_POLY_SIZE(N, AmortizedDegreePolicyFFT128, |
| 21 | + host_fourier_transform_forward_as_torus_f128<Params>( |
| 22 | + static_cast<cudaStream_t>(stream), gpu_index, |
| 23 | + (double *)re0, (double *)re1, (double *)im0, |
| 24 | + (double *)im1, (__uint128_t const *)standard, N, |
| 25 | + number_of_samples)); |
109 | 26 | } |
110 | 27 |
|
111 | 28 | void cuda_fourier_transform_backward_as_torus_f128_async( |
112 | 29 | void *stream, uint32_t gpu_index, void *standard, void const *re0, |
113 | 30 | void const *re1, void const *im0, void const *im1, const uint32_t N, |
114 | 31 | const uint32_t number_of_samples) { |
115 | | - switch (N) { |
116 | | - case 64: |
117 | | - host_fourier_transform_backward_as_torus_f128<AmortizedDegree<64>>( |
118 | | - static_cast<cudaStream_t>(stream), gpu_index, (__uint128_t *)standard, |
119 | | - (double const *)re0, (double const *)re1, (double const *)im0, |
120 | | - (double const *)im1, N, number_of_samples); |
121 | | - break; |
122 | | - case 128: |
123 | | - host_fourier_transform_backward_as_torus_f128<AmortizedDegree<128>>( |
124 | | - static_cast<cudaStream_t>(stream), gpu_index, (__uint128_t *)standard, |
125 | | - (double const *)re0, (double const *)re1, (double const *)im0, |
126 | | - (double const *)im1, N, number_of_samples); |
127 | | - break; |
128 | | - case 256: |
129 | | - host_fourier_transform_backward_as_torus_f128<AmortizedDegree<256>>( |
130 | | - static_cast<cudaStream_t>(stream), gpu_index, (__uint128_t *)standard, |
131 | | - (double const *)re0, (double const *)re1, (double const *)im0, |
132 | | - (double const *)im1, N, number_of_samples); |
133 | | - break; |
134 | | - case 512: |
135 | | - host_fourier_transform_backward_as_torus_f128<AmortizedDegree<512>>( |
136 | | - static_cast<cudaStream_t>(stream), gpu_index, (__uint128_t *)standard, |
137 | | - (double const *)re0, (double const *)re1, (double const *)im0, |
138 | | - (double const *)im1, N, number_of_samples); |
139 | | - break; |
140 | | - case 1024: |
141 | | - host_fourier_transform_backward_as_torus_f128<AmortizedDegree<1024>>( |
142 | | - static_cast<cudaStream_t>(stream), gpu_index, (__uint128_t *)standard, |
143 | | - (double const *)re0, (double const *)re1, (double const *)im0, |
144 | | - (double const *)im1, N, number_of_samples); |
145 | | - break; |
146 | | - case 2048: |
147 | | - host_fourier_transform_backward_as_torus_f128<AmortizedDegree<2048>>( |
148 | | - static_cast<cudaStream_t>(stream), gpu_index, (__uint128_t *)standard, |
149 | | - (double const *)re0, (double const *)re1, (double const *)im0, |
150 | | - (double const *)im1, N, number_of_samples); |
151 | | - break; |
152 | | - case 4096: |
153 | | - host_fourier_transform_backward_as_torus_f128<AmortizedDegree<4096>>( |
154 | | - static_cast<cudaStream_t>(stream), gpu_index, (__uint128_t *)standard, |
155 | | - (double const *)re0, (double const *)re1, (double const *)im0, |
156 | | - (double const *)im1, N, number_of_samples); |
157 | | - break; |
158 | | - default: |
159 | | - PANIC("Cuda error (f128 ifft): unsupported polynomial size. Supported " |
160 | | - "N's are powers of two" |
161 | | - " in the interval [64..4096].") |
162 | | - } |
| 32 | + DISPATCH_POLY_SIZE(N, AmortizedDegreePolicyFFT128, |
| 33 | + host_fourier_transform_backward_as_torus_f128<Params>( |
| 34 | + static_cast<cudaStream_t>(stream), gpu_index, |
| 35 | + (__uint128_t *)standard, (double const *)re0, |
| 36 | + (double const *)re1, (double const *)im0, |
| 37 | + (double const *)im1, N, number_of_samples)); |
163 | 38 | } |
0 commit comments