Skip to content

Commit

Permalink
Merge pull request #146 from anarkiwi/diag
Browse files Browse the repository at this point in the history
fix not enough FFT copies are done when shift = 1
  • Loading branch information
anarkiwi authored Nov 23, 2023
2 parents d693b5c + 89d37a0 commit cb869d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/libvkfft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ VkFFTResult _transferDataToCPU(char *cpu_arr) {
return VKFFT_ERROR_MALLOC_FAILED;
if (_shift) {
const size_t halfFftBufferSize = fftBufferSize / 2;
for (int i = 0; i < vkConfiguration.numberBatches; ++i) {
for (int i = 0; i < vkConfiguration.numberBatches;
++i, cpu_arr += fftBufferSize, data += fftBufferSize) {
memcpy(cpu_arr + halfFftBufferSize, data, halfFftBufferSize);
memcpy(cpu_arr, data + halfFftBufferSize, halfFftBufferSize);
cpu_arr += fftBufferSize;
}
} else {
memcpy(cpu_arr, data, stagingBufferSize);
Expand Down
4 changes: 2 additions & 2 deletions lib/vkfft_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ int vkfft_impl::work(int noutput_items, gr_vector_const_void_star &input_items,
const gr_complex *const in =
reinterpret_cast<const gr_complex *const>(input_items[0]);
gr_complex *const out = reinterpret_cast<gr_complex *const>(output_items[0]);
size_t buffer_index = 0;

for (int i = 0; i < noutput_items; ++i) {
const int buffer_index = i * vlen_;
for (int i = 0; i < noutput_items; ++i, buffer_index += vlen_) {
vkfft_offload((char *)&in[buffer_index], (char *)&out[buffer_index]);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/vkfft_short_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ int vkfft_short_impl::work(int noutput_items,
reinterpret_cast<const std::int16_t *const>(input_items[0]);
gr_complex *const out = reinterpret_cast<gr_complex *const>(output_items[0]);
auto *buffer = input_buffer_.get();
size_t buffer_index = 0;

for (int i = 0; i < noutput_items; ++i) {
const int buffer_index = i * vlen_ * 2;
for (int i = 0; i < noutput_items; ++i, buffer_index += vlen_ * 2) {
_converter->conv(&in[buffer_index], &buffer[0], vlen_);
vkfft_offload((char *)&buffer[0], (char *)&out[buffer_index]);
}
Expand Down

0 comments on commit cb869d9

Please sign in to comment.