Skip to content

Commit

Permalink
Merge pull request #120 from anarkiwi/pre
Browse files Browse the repository at this point in the history
Implement pre FFT tuning, which eliminates FFT offload latency from retuning delay.
  • Loading branch information
rashley-iqt authored Sep 20, 2023
2 parents e0ce212 + 73db5d1 commit 2bcc3ab
Show file tree
Hide file tree
Showing 23 changed files with 1,605 additions and 173 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fetch-depth: 0
- name: clang-format
run: |
sudo apt-get update -yq && sudo apt-get install -yq clang-format python3-pip && pip3 install cmake_format && bin/run_c_format.sh $(pwd) lib include/gnuradio/iqtlabs
sudo apt-get update -yq && sudo apt-get install -yq clang-format python3-pip && pip3 install cmake_format && bin/run_c_format.sh $(pwd) lib include/gnuradio/iqtlabs grc
test-latest:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ libsigmf/
flatbuffers/
json/
VkFFT/
SPIRV-Tools/

test_flow_graphs/test/
14 changes: 9 additions & 5 deletions grc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
#

install(
FILES iqtlabs_tuneable_test_source.block.yml iqtlabs_retune_fft.block.yml
iqtlabs_write_freq_samples.block.yml iqtlabs_image_inference.block.yml
FILES iqtlabs_tuneable_test_source.block.yml
iqtlabs_retune_fft.block.yml
iqtlabs_write_freq_samples.block.yml
iqtlabs_image_inference.block.yml
iqtlabs_vector_to_json.block.yml
iqtlabs_vector_roll.block.yml
iqtlabs_vkfft_short.block.yml DESTINATION share/gnuradio/grc/blocks)
iqtlabs_vector_roll.block.yml
iqtlabs_retune_pre_fft.block.yml
DESTINATION share/gnuradio/grc/blocks)
if(Vulkan_FOUND)
install(FILES iqtlabs_vkfft.block.yml DESTINATION share/gnuradio/grc/blocks)
install(FILES iqtlabs_vkfft.block.yml iqtlabs_vkfft_short.block.yml
DESTINATION share/gnuradio/grc/blocks)
endif()
19 changes: 15 additions & 4 deletions grc/iqtlabs_retune_fft.block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ documentation: |-
input:
vector of floats, representing FFT bucket values,
tagged with center frequency.
cmd:
connection from retune_pre_fft to control tuning (optional).
output:
JSON scan summaries, one per line, containing "bucket" keys
(with frequency: mean values), and "config" keys
(representing block config).
tune:
connect to radio command port, generally "cmd".
tune:
connect to radio command port, generally "cmd".
json:
output buckets as zstd compressed JSON object (optional).
parameters:
tag: expected PMT tag containing center frequency
Expand All @@ -43,6 +47,7 @@ documentation: |-
"2.2e9-2.4e9,5.1e9-5.9e9".
description: a string description to be included with each update.
rotate_secs: if > 0, use a new epoch timestamped directory every N seconds.
pre_fft: if True, tuning is controlled by the retune_pre_fft block.
example JSON output:
{ "ts": <epoch time>, "sweep start": <epoch time>,
Expand All @@ -59,7 +64,7 @@ templates:
iqtlabs.retune_fft(${tag}, ${vlen}, ${nfft}, ${samp_rate}, ${freq_start},
${freq_end}, ${tune_step_hz}, ${tune_step_fft}, ${skip_tune_step_fft},
${fft_min}, ${fft_max}, ${sdir}, ${write_step_fft}, ${bucket_range},
${tuning_ranges}, ${description}, ${rotate_secs})
${tuning_ranges}, ${description}, ${rotate_secs}, ${pre_fft})
cpp_templates:
includes: ['#include <gnuradio/iqtlabs/retune_fft.h>']
Expand All @@ -68,7 +73,8 @@ cpp_templates:
this->${id} = gr::iqtlabs::retune_fft::make(${tag}, ${vlen}, ${nfft},
${samp_rate}, ${freq_start}, ${freq_end}, ${tune_step_hz}, ${tune_step_fft},
${skip_tune_step_fft}, ${fft_min}, ${fft_max}, ${sdir}, ${write_step_fft},
${bucket_range}, ${tuning_ranges}, ${description}, ${rotate_secs});
${bucket_range}, ${tuning_ranges}, ${description}, ${rotate_secs},
${pre_fft});
link: ['libgnuradio-iqtlabs.so']

asserts:
Expand Down Expand Up @@ -121,6 +127,8 @@ inputs:
domain: stream
dtype: float
vlen: ${ vlen }
- label: cmd
domain: message

outputs:
- label: output
Expand All @@ -129,5 +137,8 @@ outputs:
vlen: 1
- label: tune
domain: message
- label: json
domain: message


file_format: 1
62 changes: 62 additions & 0 deletions grc/iqtlabs_retune_pre_fft.block.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
id: iqtlabs_retune_pre_fft
label: retune_pre_fft
category: '[iqtlabs]'
flags: [python, cpp]

templates:
imports: from gnuradio import iqtlabs
make: >
iqtlabs.retune_pre_fft(
${nfft}, ${fft_batch_size},
${tag}, ${freq_start}, ${freq_end},
${tune_step_hz}, ${tune_step_fft}, ${skip_tune_step_fft},
${tuning_ranges})
cpp_templates:
includes: ['#include <gnuradio/iqtlabs/retune_pre_fft.h>']
declarations: 'gr::iqtlabs::retune_pre_fft::sptr ${id};'
make: >
this->${id} = gr::iqtlabs::retune_pre_fft::make(
${nfft}, ${fft_batch_size},
${tag}, {freq_start}, ${freq_end},
${tune_step_hz}, ${tune_step_fft}, ${skip_tune_step_fft},
${tuning_ranges});
link: ['libgnuradio-iqtlabs.so']

parameters:
- id: nfft
dtype: int
- id: fft_batch_size
dtype: int
- id: tag
dtype: string
default: 'rx_freq'
- id: freq_start
dtype: raw
- id: freq_end
dtype: raw
- id: tune_step_hz
dtype: int
- id: tune_step_fft
dtype: int
- id: skip_tune_step_fft
dtype: int
- id: tuning_ranges
dtype: string

inputs:
- label: input
domain: stream
dtype: complex
vlen: 1

outputs:
- label: input
domain: stream
dtype: complex
vlen: ${ nfft * fft_batch_size }
- label: tune
domain: message

file_format: 1
1 change: 1 addition & 0 deletions include/gnuradio/iqtlabs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ install(
FILES api.h
tuneable_test_source.h
retune_fft.h
retune_pre_fft.h
write_freq_samples.h
image_inference.h
vector_to_json.h
Expand Down
3 changes: 2 additions & 1 deletion include/gnuradio/iqtlabs/retune_fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ class IQTLABS_API retune_fft : virtual public gr::block {
uint64_t skip_tune_step_fft, double fft_min, double fft_max,
const std::string &sdir, uint64_t write_step_fft,
double bucket_range, const std::string &tuning_ranges,
const std::string &description, uint64_t rotate_secs);
const std::string &description, uint64_t rotate_secs,
bool pre_fft);
};

} // namespace iqtlabs
Expand Down
Loading

0 comments on commit 2bcc3ab

Please sign in to comment.