-
Notifications
You must be signed in to change notification settings - Fork 2
Implementing accumulate functionality and updating comments + README #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1674,4 +1674,19 @@ void pffft_convolve_internal (FFT_Setup* setup, const float* a, const float* b, | |
| reinterpret_cast<float*> (&vab[1])[0] = abi0 + ai0 * bi0 * scaling; | ||
| } | ||
| } | ||
|
|
||
| void fft_accumulate_internal (FFT_Setup* setup, const float* a, const float* b, float* ab, int N) | ||
| { | ||
| assert (N % SIMD_SZ == 0); | ||
| const auto Ncvec = N / (int) SIMD_SZ; | ||
| auto* va = (const float32x4_t*) a; | ||
| auto* vb = (const float32x4_t*) b; | ||
| auto* vab = (float32x4_t*) ab; | ||
|
|
||
| for (int i = 0; i < Ncvec; i += 2) | ||
|
||
| { | ||
| vab[i] = vaddq_f32 (va[i], vb[i]); | ||
| vab[i + 1] = vaddq_f32 (va[i + 1], vb[i + 1]); | ||
| } | ||
| } | ||
| } // namespace chowdsp::fft::neon | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1689,4 +1689,19 @@ void pffft_convolve_internal (FFT_Setup* setup, const float* a, const float* b, | |||||||||||||||
| reinterpret_cast<float*> (&vab[1])[0] = abi0 + ai0 * bi0 * scaling; | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| void fft_accumulate_internal (FFT_Setup* setup, const float* a, const float* b, float* ab, int N) | ||||||||||||||||
| { | ||||||||||||||||
| assert (N % SIMD_SZ == 0); | ||||||||||||||||
| const auto Ncvec = N / (int) SIMD_SZ; | ||||||||||||||||
| auto* va = (const __m128*) a; | ||||||||||||||||
| auto* vb = (const __m128*) b; | ||||||||||||||||
| auto* vab = (__m128*) ab; | ||||||||||||||||
|
|
||||||||||||||||
| for (int i = 0; i < Ncvec; i += 2) | ||||||||||||||||
| { | ||||||||||||||||
| vab[i] = _mm_add_ps (va[i], vb[i]); | ||||||||||||||||
| vab[i + 1] = _mm_add_ps (va[i + 1], vb[i + 1]); | ||||||||||||||||
|
Comment on lines
+1701
to
+1704
|
||||||||||||||||
| for (int i = 0; i < Ncvec; i += 2) | |
| { | |
| vab[i] = _mm_add_ps (va[i], vb[i]); | |
| vab[i + 1] = _mm_add_ps (va[i + 1], vb[i + 1]); | |
| for (int i = 0; i < Ncvec; ++i) | |
| { | |
| vab[i] = _mm_add_ps (va[i], vb[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Processing two SIMD vectors per iteration assumes that Ncvec (N/SIMD_SZ) is even, which is not enforced by the current assertion. This could lead to out-of-bound access when Ncvec is odd; consider iterating over each vector or assert an even count.