-
Notifications
You must be signed in to change notification settings - Fork 74.9k
Closed
Labels
comp:microRelated to TensorFlow Lite MicrocontrollersRelated to TensorFlow Lite Microcontrollerstype:bugBugBug
Description
@tensorflow/micro
In #46242 (comment), I was suggesting that the linker was not correctly dropping unused symbols.
In fact, what was very likely happening was that I did not do a make clean between switching to BUILD_TYPE=release. And since the TFLM makefile currently uses the same directory for all BUILD_TYPE, only the modified files were being rebuilt with the smaller release build.
We can reproduce this with the following sequence of commands:
First check what the binary size is for the release build.
make -f tensorflow/lite/micro/tools/make/Makefile clean
make -f tensorflow/lite/micro/tools/make/Makefile -j8 TARGET=xtensa OPTIMIZED_KERNEL_DIR=xtensa TARGET_ARCH=hifimini XTENSA_CORE=mini1m1m_RG keyword_benchmark BUILD_TYPE=release
xt-size tensorflow/lite/micro/tools/make/gen/xtensa_hifimini/bin/keyword_benchmark
text data bss dec hex filename
46080 40204 24952 111236 1b284 tensorflow/lite/micro/tools/make/gen/xtensa_hifimini/bin/keyword_benchmark
Next have some intermediate non-release objects and then do a release build:
make -f tensorflow/lite/micro/tools/make/Makefile clean
# build non-release
make -f tensorflow/lite/micro/tools/make/Makefile -j8 TARGET=xtensa OPTIMIZED_KERNEL_DIR=xtensa TARGET_ARCH=hifimini XTENSA_CORE=mini1m1m_RG keyword_benchmark
touch tensorflow/lite/micro/kernels/xtensa/fully_connected.cc
#build for release
make -f tensorflow/lite/micro/tools/make/Makefile -j8 TARGET=xtensa OPTIMIZED_KERNEL_DIR=xtensa TARGET_ARCH=hifimini XTENSA_CORE=mini1m1m_RG keyword_benchmark BUILD_TYPE=release
xt-size tensorflow/lite/micro/tools/make/gen/xtensa_hifimini/bin/keyword_benchmark
text data bss dec hex filename
54736 48168 25032 127936 1f3c0 tensorflow/lite/micro/tools/make/gen/xtensa_hifimini/bin/keyword_benchmark
What we really should be doing is to change the output directory based on the build type.
Metadata
Metadata
Assignees
Labels
comp:microRelated to TensorFlow Lite MicrocontrollersRelated to TensorFlow Lite Microcontrollerstype:bugBugBug