STT-tensorflow/tensorflow/lite/micro/testing/test_xtensa_binary.sh
Advait Jain 399b29f56e Starting to consolidate the xtensa kernels.
First steps towards http://b/173043817

Copied the xtensa_hifimini implementations into the new directory and added an appropriate makefile.

Tested the following commands:

Older build command:
```
make -f tensorflow/lite/micro/tools/make/Makefile -j8 TARGET=xtensa_hifimini TAGS=xtensa_hifimini XTENSA_CORE=<xtensa_core> test_keyword_benchmark
```

Output:
```
InitializeKeywordRunner() took 1388393 ticks (1388 ms)
KeywordRunNIerations(1) took 88408 ticks (88 ms)
KeywordRunNIerations(10) took 883639 ticks (883 ms)
```

Consolidated makefile invocation:
```
make -f tensorflow/lite/micro/tools/make/Makefile -j8 TARGET=xtensa OPTIMIZED_KERNEL_DIR=xtensa TARGET_ARCH=hifimini XTENSA_CORE=mini1m1m_RG test_keyword_benchmark
```

Output:
```
InitializeKeywordRunner() took 1388465 ticks (1388 ms)
KeywordRunNIerations(1) took 88408 ticks (88 ms)
KeywordRunNIerations(10) took 883639 ticks (883 ms)
```

xt-size (note the different location of the two output binaries)

===== older binary ==========
   text	   data	    bss	    dec	    hex	filename
  54864	  48040	  25032	 127936	  1f3c0	tensorflow/lite/micro/tools/make/gen/xtensa_hifimini_xtensa_hifimini/bin/keyword_benchmark

===== newer binary ==========
   text	   data	    bss	    dec	    hex	filename
  54864	  48024	  25032	 127920	  1f3b0	tensorflow/lite/micro/tools/make/gen/xtensa_hifimini/bin/keyword_benchmark
2020-11-11 14:16:13 -08:00

40 lines
1.3 KiB
Bash
Executable File

#!/bin/bash -e
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
#
# Tests an Xtensa binary by parsing the log output.
#
# First argument is the binary location.
#
# Second argument is a regular expression that's required to be in the output
# logs for the test to pass.
declare -r ROOT_DIR=`pwd`
declare -r TEST_TMPDIR=/tmp/test_xtensa_binary/
declare -r MICRO_LOG_PATH=${TEST_TMPDIR}/$1
declare -r MICRO_LOG_FILENAME=${MICRO_LOG_PATH}/logs.txt
mkdir -p ${MICRO_LOG_PATH}
xt-run $1 2>&1 | tee ${MICRO_LOG_FILENAME}
if grep -q "$2" ${MICRO_LOG_FILENAME}
then
echo "$1: PASS"
exit 0
else
echo "$1: FAIL - '$2' not found in logs."
exit 1
fi