Edge impulse suggestions for compile options? (ARM targets)

Hello, does Edge Impulse have suggestions what compile options to use for ARM targets edge-impulse-sdk and tflite-model folder files?

I know it is quite hardware and use-case specific thing (Os optimizes for space and O2 speeds up), but I would appreciate some experienced tips and general guidelines for typical cases
A. best inference speed
B. best space savings

For example for the best speed: are these CMSIS DSP suggestions perfect for edge impulse model folder, or is there more speed gains to be had with some additional flags?
ARM-software/CMSIS-DSP: CMSIS-DSP embedded compute library for Cortex-M and Cortex-A

-O3 -ffast-math

Thank you!

Hi, @tuoman !
I guess no one was answering, because the question is a bit too broad. Indeed it is impossible to give you recommendations that would apply for all targets. In general, the guidelines for optimizations that you can find in compiler docs, e.g. Optimize Options (Using the GNU Compiler Collection (GCC)) apply to edge impulse as well, except for targets that have quirks. For example I remember that for OpenMW, the tflite libraries are built separately with -O2 and -Os will make everything else, slower.
Also,

  • in general -03 might NOT be faster or safe in certain scenarios. O2 seems to be more preferred.
  • here is some tests that were run a while ago for one firmware with 96x96 imagenet on Cortex M4
    arm-gcc with -O3 (how you get it out from studio) takes 530ms
    armclang with -Ofast takes 433ms
    armclang with -O1, O2 and O3 also takes 433ms

I think the best solution is experimentation really.

1 Like