Create kbenchmark in tools directory (#5333)
author윤지영/On-Device Lab(SR)/Staff Engineer/삼성전자 <jy910.yun@samsung.com>
Mon, 3 Jun 2019 08:22:03 +0000 (17:22 +0900)
committer이춘석/On-Device Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Mon, 3 Jun 2019 08:22:03 +0000 (17:22 +0900)
This patch creates kbenchmark directory.
It is an initial commit for kbenchmark.

Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
cmake/CfgOptionFlags.cmake
tools/kbenchmark/CMakeLists.txt [new file with mode: 0644]
tools/kbenchmark/README.md [new file with mode: 0644]

index 1a77068..5d2efb2 100644 (file)
@@ -35,6 +35,7 @@ option(BUILD_TFLITE_TEST "Build tensorflow lite test" OFF)
 option(BUILD_TFLITE_CLASSIFY_APP "Build tflite_classify app" OFF)
 option(BUILD_UBEN "Build micro-benchmark (uben) suite" OFF)
 option(BUILD_TFLITE_LOADER "Build tensorflow lite file loader" ON)
+option(BUILD_KBENCHMARK "Build kernel benchmark tool" OFF)
 #
 # Download configuration
 #
diff --git a/tools/kbenchmark/CMakeLists.txt b/tools/kbenchmark/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3207000
--- /dev/null
@@ -0,0 +1,9 @@
+if(NOT BUILD_KBENCHMARK)
+  return()
+endif(NOT BUILD_KBENCHMARK)
+
+nnfw_find_package(Nonius QUIET)
+
+if(NOT Nonius_FOUND)
+  return()
+endif(NOT Nonius_FOUND)
diff --git a/tools/kbenchmark/README.md b/tools/kbenchmark/README.md
new file mode 100644 (file)
index 0000000..0a684a8
--- /dev/null
@@ -0,0 +1,54 @@
+# kbenchmark
+
+## Purpose
+
+Most people can use several neural network kernel libraries to inference AI models on Linux system. Each kernel library is implemented in a number of ways, which can give different performance to different configurations. This benchmark tool can help you measure the system's performance with each configuration, and identify possible issues on your system.
+
+## Prerequisites
+
+### Relevant libraries
+This script is based on [libnonius](https://github.com/libnonius/nonius) micro-benchmarking framework. This micro-benchmarking framework will be downloaded automatically if you set the `BUILD_KBENCHMARK` configuration to on and build nnfw. If you want to download manually, please use the following path.
+* [Download Nonius header files](https://github.com/libnonius/nonius/releases)
+
+### Configuration file
+This tool works depending on a configuration file generated from [summarize_tflite.sh](nnfw/blob/master/tools/tflkit/summarize_tflite.sh). You can make a configuration file using the following commands.
+```
+nnfw$ cd tools/tflkit
+nnfw/tools/tflkit$ ./summarize_tflite.sh [tflite model file] -c -p [file prefix]
+```
+Or
+```
+nnfw$ cd tools/tflitefile_tool
+nnfw/tools/tflitefile_tool$ python model_parser.py [tflite model file] -c -p [file prefix]
+```
+
+The generated configuration file will have the following format:
+```
+tools/tflitefile_tool$ cat inceptionv3_slim_Main_model_CONV_2D.config | head -n 25
+# CONV_2D, Total count: 95
+
+[0]
+input: [1, 299, 299, 3]
+input_type: FLOAT32
+weights: [32, 3, 3, 3]
+weights_type: FLOAT32
+bias: [32]
+bias_type: FLOAT32
+output_counts: 1
+output0: [1, 149, 149, 32]
+output0_type: FLOAT32
+stride_w: 2
+stride_h: 2
+dilation_w: 1
+dilation_h: 1
+padding: VALID
+fused_act: RELU
+
+[1]
+input: [1, 149, 149, 32]
+input_type: FLOAT32
+weights: [32, 3, 3, 32]
+weights_type: FLOAT32
+bias: [32]
+```
+