Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[µTVM] Print .elf statistics for a model runtime built with Zephyr (a…
…pache#7449) * [µTVM] Print .elf statistics for a model runtime built with Zephyr Currently there isn't any statistics about the used resources by a model runtime built with Zephyr, making it difficult to have any idea about, for instance, the amount of memory taken by the operations necessary to run the model. Since Zephyr's SDK already exposes the statistics about various memory regions on linking by passing '--print-memory-usage' to the linker, it's possible to use it to have an idea about the amount of memory used by the model and how much memory is left on the device. That commit adds a simple method to extract the memory region information out of the build output and then uses it to show memory usage statistics for various memory regions when Zephyr finishes building the image to be flashed to the target device. Signed-off-by: Gustavo Romero <[email protected]> * v2: Fixes accordingly to Andrew review - Catch StopIteration in case of a weird output or no additional lines after the last memory region - Use of _LOG.info() instead of plain print() for better control over the output by the main script - Set log level in micro_tflite.py script as an example on how to get the new memory usage statistics and also because currently that's the main script used to test microTVM + Zephyr's SDK - Improve statistics header Signed-off-by: Gustavo Romero <[email protected]> * Fix build It seems build system is using Python < 3.7, so 'text' argument is not present as an alias for 'universal_newlines'. To satisfy it use old 'universal_newlines' argument which is available prior to Python 3.7. * Fix build Avoid exception anti-pattern when catching StopIteration * Retrigger CI
- Loading branch information