Skip to content

Compiler Optimization Levels

In this study, we aim to find out the impact of varying compiler optimization levels (O3, Of, and Os) on the performance of TFLM models.

We use FC and CNN models deployed on the NUCLEO-L4R5ZI board for our experiments.


Model Type:

Models

FC parameters and MACs FC parameters and MACs
FC parameters and MACs
CNN parameters and MACs CNN parameters and MACs
CNN parameters and MACs

Error

FC - NUCLEO-L4R5ZI FC - NUCLEO-L4R5ZI
FC - NUCLEO-L4R5ZI
CNN - NUCLEO-L4R5ZI CNN - NUCLEO-L4R5ZI
CNN - NUCLEO-L4R5ZI

Execution Time

FC - NUCLEO-L4R5ZI FC - NUCLEO-L4R5ZI
FC - NUCLEO-L4R5ZI
CNN - NUCLEO-L4R5ZI CNN - NUCLEO-L4R5ZI
CNN - NUCLEO-L4R5ZI

Flash Size

FC - NUCLEO-L4R5ZI FC - NUCLEO-L4R5ZI
FC - NUCLEO-L4R5ZI
CNN - NUCLEO-L4R5ZI CNN - NUCLEO-L4R5ZI
CNN - NUCLEO-L4R5ZI

RAM Usage

FC - NUCLEO-L4R5ZI FC - NUCLEO-L4R5ZI
FC - NUCLEO-L4R5ZI
CNN - NUCLEO-L4R5ZI CNN - NUCLEO-L4R5ZI
CNN - NUCLEO-L4R5ZI

Summary

  • Model Correctness: The optimization levels do not change the correctness of the models.

  • Execution Time: The O3 and Of are the same and faster than Os.

  • Flash Size: The flash size of Os is slightly better than O3 and Of.

  • RAM Usage: The required RAM of all optimization levels is almost the same.

  • Conclusion: The O3 and Of optimization levels are similar and better than Os in terms of execution time. If the flash size is a concern, Os might be slightly better than O3 and Of.