tfmicro icon indicating copy to clipboard operation
tfmicro copied to clipboard

build in release mode

Open jacobrosenthal opened this issue 5 years ago • 2 comments

I saw a ticket come through on tflite worrying about assert debug costs if you dont use the release build and I thought... hrmm. Are we building with those flags? https://github.com/tensorflow/tensorflow/pull/44863#issuecomment-729346493

Doesnt seem like it, so adding these two defines https://github.com/tensorflow/tensorflow/blob/acd6f26bbaa2f747b88bfd480c6d607b4836b9ef/tensorflow/lite/micro/tools/make/Makefile#L200

drops 18812 bytes I havent checked the cycle count, but that would be interesting

$ cargo +nightly size --release --example magic_wand --features="tf"
    Finished release [optimized + debuginfo] target(s) in 52.70s
   text    data     bss     dec     hex filename
 125884     172      16  126072   1ec78 magic_wand
$ cargo +nightly size --release --example magic_wand --features="tf"
    Finished release [optimized + debuginfo] target(s) in 0.31s
   text    data     bss     dec     hex filename
 107072     172      16  107260   1a2fc magic_wand

jacobrosenthal avatar Nov 18 '20 04:11 jacobrosenthal

Hi Jacob,

Your project looks great! Thanks for working on this.

FYI These two flags are for release builds, with them you won't be able to catch DCHECK failures and see other debug log information if needed. This means that you don't get any console output upon failures, for example when the arena is too small for the model. It might make sense to be able to overwrite them when needed.

wangtz avatar Nov 23 '20 10:11 wangtz

Greetings thanks for stopping by @wangtz Please keep us and c linking workflow in mind in upstream :)

Im just a consumer, @richardeoin and @Recognition2 have the commits.

I dont think we utilize or export the DCHECK stuff so shouldnt be a problem, but we can also match on std::env::var("PROFILE") for debug and release to enable conditionally instead.

jacobrosenthal avatar Nov 23 '20 17:11 jacobrosenthal