gromero opened a new pull request #7449:
URL: https://github.com/apache/tvm/pull/7449
Hi,
Could the following simple change be reviewed please?
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.
Output example follows:
```
gromero@gromero0:~/git/tvm/tutorials/micro$ python3 ./micro_tflite.py
File /home/gromero/.tvm_test_data/data/sine_model.tflite exists, skip.
Model Version: 3
<snip>
Including boilerplate (Zephyr base):
/home/gromero/zephyrproject/zephyr/cmake/app/boilerplate.cmake
Including boilerplate (Zephyr base):
/home/gromero/zephyrproject/zephyr/cmake/app/boilerplate.cmake
Including boilerplate (Zephyr base):
/home/gromero/zephyrproject/zephyr/cmake/app/boilerplate.cmake
Including boilerplate (Zephyr base):
/home/gromero/zephyrproject/zephyr/cmake/app/boilerplate.cmake
Including boilerplate (Zephyr base):
/home/gromero/zephyrproject/zephyr/cmake/app/boilerplate.cmake
Including boilerplate (Zephyr base):
/home/gromero/zephyrproject/zephyr/cmake/app/boilerplate.cmake
Including boilerplate (Zephyr base):
/home/gromero/zephyrproject/zephyr/cmake/app/boilerplate.cmake
==================
Memory region Used Size Region Size %age Used
FLASH: 35748 B 1 MB 3.41%
DTCM: 0 GB 64 KB 0.00%
SRAM: 146160 B 256 KB 55.76%
IDT_LIST: 232 B 2 KB 11.33%
make[2]: Leaving directory '/tmp/tmpcb9im44g/build/runtime'
Open On-Chip Debugger 0.10.0+dev-01341-g580d06d9d-dirty (2020-06-25-12:07)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
066CFF485153826687133653
Info : The selected transport took over low-level target control. The
results might differ compared to plain JTAG/SWD
Info : clock speed 2000 kHz
Info : STLINK V2J25M14 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.238421
Warn : Silicon bug: single stepping may enter pending exception handler!
Info : stm32f7x.cpu: hardware has 8 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
TargetName Type Endian TapName State
-- ------------------ ---------- ------ ------------------ ------------
0* stm32f7x.cpu hla_target little stm32f7x.cpu running
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08001e20 msp: 0x200331a8
Info : device id = 0x10016449
Info : flash size = 1024 kbytes
auto erase enabled
wrote 65536 bytes from file /tmp/tmpcb9im44g/build/runtime/zephyr/zephyr.hex
in 2.129213s (30.058 KiB/s)
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08001e20 msp: 0x200331b0
verified 35748 bytes in 0.489722s (71.286 KiB/s)
shutdown command invoked
result is: [[0.4443792]]
```
Thanks & best regards,
Gustavo
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]