Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Commit 510f318

Browse files
authored
Size benchmark details
1 parent 7cb88dd commit 510f318

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

rfcs/20200712-tfrt-kernel-fallback.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ No new dependencies.
585585
586586
* We have a Kernel Fallback prototype
587587
* Prototype support for two kernels: `AddN` and `Conv3D`
588-
* Current binary size estimates (based on Android arm64 build): 1MB for framework and 100k per kernel per type.
588+
* Current binary size estimates (based on Android arm64 build): 900k for framework and 200k per kernel per type (see [Appendix 3](#appendix-3-benchmarking-size)).
589589
590590
#### Planned work
591591
@@ -800,3 +800,37 @@ However, it does introduce a ~7% median, ~19% mean penalty for [basic_ops_benchm
800800
801801
Therefore, we expect that using inheritance would not add a noticeable overhead in most real world models. At the same time, inheritance can simplify code structure and debugging.
802802
803+
804+
## Appendix 3: Benchmarking size
805+
806+
To benchmark size, we created a git branch that contains Kernel Fallback prototype:
807+
https://github.com/annarev/tensorflow/tree/kernel_fallback/tensorflow/core/tfrt_fallback/kernel (Note we had to make some other changes: [branch comparison](https://github.com/annarev/tensorflow/compare/master...annarev:kernel_fallback)).
808+
809+
Android settings used when running `./configure`:
810+
811+
* NDK: r18b
812+
* NDK API level: 19
813+
* Android build tools version: 30.0.1
814+
* Android SDK API level: 28
815+
816+
We check size of a dependency by adding it to [//tensorflow/lite/java:libtensorflowlite_jni.so](https://github.com/annarev/tensorflow/blob/kernel_fallback/tensorflow/lite/java/BUILD#L415) target and running
817+
```
818+
bazel build -c opt tensorflow/lite/java/libtensorflowlite_jni.so --config=android_arm64 --define=disable_rtti_and_exceptions=true --define disable_eigen_mkldnn_contraction_kernel=true --define=TENSORFLOW_PROTOS=lite
819+
820+
ls -lh bazel-bin/tensorflow/lite/java/libtensorflowlite_jni.so
821+
```
822+
823+
Findings are presented in the table below:
824+
825+
| Deps | Size |
826+
| :--------------------------------------------------------- | :--- |
827+
| Existing TF Lite | 2.3M |
828+
| Existing TF Lite + Kernel Fallback framework | 3.2M |
829+
| Existing TF Lite + Kernel Fallback framework + 2 kernels\* | 3.6M |
830+
831+
\* Kernels used for benchmarking: AddN registered for int32, Conv3d registered for int32.
832+
833+
Therefore, we estimate the following current size measurements:
834+
835+
* Kernel Fallback framework: 900k
836+
* Per-kernel per-type: 200k

0 commit comments

Comments
 (0)