@@ -71,9 +71,9 @@ pub fn generate_twiddles(dist: usize) -> (Vec<f64>, Vec<f64>) {
71
71
}
72
72
73
73
pub ( crate ) fn generate_twiddles_simd ( dist : usize ) -> ( Vec < f64 > , Vec < f64 > ) {
74
- const CHUNK_SIZE : usize = 8 ; // TODO: make this a const generic?
75
- assert ! ( dist >= CHUNK_SIZE * 2 ) ;
76
- assert_eq ! ( dist % CHUNK_SIZE , 0 ) ;
74
+ const SIMD_WIDTH : usize = 8 ; // TODO: make this a const generic?
75
+ assert ! ( dist >= SIMD_WIDTH * 2 ) ;
76
+ assert_eq ! ( dist % SIMD_WIDTH , 0 ) ;
77
77
let mut twiddles_re = vec ! [ 0.0 ; dist] ;
78
78
let mut twiddles_im = vec ! [ 0.0 ; dist] ;
79
79
twiddles_re[ 0 ] = 1.0 ;
@@ -97,7 +97,7 @@ pub(crate) fn generate_twiddles_simd(dist: usize) -> (Vec<f64>, Vec<f64>) {
97
97
} ;
98
98
99
99
let apply_symmetry_im = |input : & [ Float ] , output : & mut [ Float ] | {
100
- let mut buf: [ Float ; CHUNK_SIZE ] = [ Float :: default ( ) ; 8 ] ;
100
+ let mut buf: [ Float ; SIMD_WIDTH ] = [ Float :: default ( ) ; SIMD_WIDTH ] ;
101
101
buf. copy_from_slice ( input) ;
102
102
buf. reverse ( ) ;
103
103
output. copy_from_slice ( & buf) ;
@@ -110,16 +110,16 @@ pub(crate) fn generate_twiddles_simd(dist: usize) -> (Vec<f64>, Vec<f64>) {
110
110
assert ! ( first_half_im. len( ) == second_half_im. len( ) + 1 ) ;
111
111
112
112
first_half_re
113
- . chunks_exact_mut ( CHUNK_SIZE )
114
- . zip ( first_half_im. chunks_exact_mut ( CHUNK_SIZE ) )
113
+ . chunks_exact_mut ( SIMD_WIDTH )
114
+ . zip ( first_half_im. chunks_exact_mut ( SIMD_WIDTH ) )
115
115
. zip (
116
- second_half_re[ CHUNK_SIZE - 1 ..]
117
- . chunks_exact_mut ( CHUNK_SIZE )
116
+ second_half_re[ SIMD_WIDTH - 1 ..]
117
+ . chunks_exact_mut ( SIMD_WIDTH )
118
118
. rev ( ) ,
119
119
)
120
120
. zip (
121
- second_half_im[ CHUNK_SIZE - 1 ..]
122
- . chunks_exact_mut ( CHUNK_SIZE )
121
+ second_half_im[ SIMD_WIDTH - 1 ..]
122
+ . chunks_exact_mut ( SIMD_WIDTH )
123
123
. rev ( ) ,
124
124
)
125
125
. for_each (
@@ -141,9 +141,9 @@ pub(crate) fn generate_twiddles_simd(dist: usize) -> (Vec<f64>, Vec<f64>) {
141
141
) ;
142
142
143
143
// Fill in the middle that the SIMD loop didn't
144
- twiddles_re[ dist / 2 - CHUNK_SIZE + 1 ..] [ ..( CHUNK_SIZE * 2 ) - 1 ]
144
+ twiddles_re[ dist / 2 - SIMD_WIDTH + 1 ..] [ ..( SIMD_WIDTH * 2 ) - 1 ]
145
145
. iter_mut ( )
146
- . zip ( twiddles_im[ dist / 2 - CHUNK_SIZE + 1 ..] [ ..( CHUNK_SIZE * 2 ) - 1 ] . iter_mut ( ) )
146
+ . zip ( twiddles_im[ dist / 2 - SIMD_WIDTH + 1 ..] [ ..( SIMD_WIDTH * 2 ) - 1 ] . iter_mut ( ) )
147
147
. for_each ( |( re, im) | {
148
148
( * re, * im) = next_twiddle ( ) ;
149
149
} ) ;
0 commit comments