AmbiqAI / neuralSPOT

NeuralSPOT is Ambiq's AI SDK and Toolkit
https://ambiq.com
BSD 3-Clause "New" or "Revised" License
24 stars 6 forks source link

NSAutoDeploy & NSPerf bugs #160

Open apage224 opened 5 months ago

apage224 commented 5 months ago

On commit 296b185, I am unable to run ns_autodeploy.

From fresh install, I run the following

make PLATFORM=apollo4p_evb
cd tools/
python -m ns_autodeploy \
--tflite-filename model.tflite \
--model-name my model \
--cpu-mode 192 --runs 2 \
--arena-size-scratch-buffer-padding 10 \
--max-arena-size 80 \
--verbosity 4 
  1. If I add --measure-power the script fails as the params for ns_perf don't match ns_autodeploy (missing joulescope and a bunch of others).

  2. If neuralSPOT is not built with NS_MLPROFILE then the minimal example fails due to the following bug in the template and in some of the examples:

#ifdef NS_MLPROFILE
    ns_timer_config_t *tickTimer;
    ns_perf_mac_count_t *mac_estimates; ///< Optional, from tflm_profiler tool
#else
    void *tickTimer;
    void *mac_estimate; ///< Optional, from tflm_profiler tool
#endif

-> mac_estimate should be mac_estimates

As for ns_perf, when I run the following it hangs with the following message dumped INFO: handle_cmd_gpi_req s/gpi/+/!req. I'm on Mac M1 with GUI Joulescope UI 1.0.62, Joulescope driver 1.4.10, and python joulescope==1.1.13 and and pyjoulescope driver is 1.4.10. I do pre-launch Joulescope app and quit (green LED on scope). I also have Joulescope GPIO hooked up to EVB according to docs (PIN22 -> IN0, PIN23 -> IN1, PIN24 -> OUT0, GND -> GND).

make PLATFORM=apollo4p_evb
cd tools/
python -m ns_perf \
--cpu-mode "NS_MAXIMUM_PERF" \
--joulescope \
--tflite-filename model.tflite \
--max-arena-size 100 \
--arena-size-scratch-buffer-padding 20 \
--runs-power 100 \
--model-name modelperf \
--verbosity 4  

If I make local changes to get ns_autodeploy to work it does run completely so I don't think there is any issue with arena size or model architecture.