Skip to content

Commit 23d626d

Browse files
authored
ci(Make): add test jobs for compression (#2988)
Add GitHub CI jobs that run `make test`, etc. with compression enabled. Add as new jobs, as opposed to additional steps within the existing jobs, so they can run in parallel, and so they begin with a fresh, un-built working directory. BUG=part of #2636
1 parent 2f1f185 commit 23d626d

File tree

5 files changed

+167
-0
lines changed

5 files changed

+167
-0
lines changed

.github/workflows/ci.yml

+21
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,27 @@ jobs:
341341
cd ../
342342
tflite-micro/tensorflow/lite/micro/tools/ci_build/test_x86_default.sh tflite-micro/
343343
344+
x86_default_with_compression:
345+
runs-on: ubuntu-latest
346+
347+
name: Makefile x86 with Compression (presubmit)
348+
steps:
349+
- uses: actions/setup-python@v4
350+
with:
351+
python-version: '3.10'
352+
- uses: actions/checkout@v3
353+
with:
354+
ref: ${{ inputs.trigger-sha }}
355+
- name: Install dependencies
356+
run: |
357+
pip3 install Pillow
358+
pip3 install numpy
359+
- name: Test
360+
run: |
361+
tensorflow/lite/micro/tools/ci_build/test_makefile.sh
362+
cd ../
363+
tflite-micro/tensorflow/lite/micro/tools/ci_build/test_x86_default_with_compression.sh tflite-micro/
364+
344365
x86_out_of_tree:
345366
runs-on: ubuntu-latest
346367

.github/workflows/xtensa_presubmit.yml

+30
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ jobs:
5151
/bin/bash -c \
5252
"cd /opt && tflite-micro/tensorflow/lite/micro/tools/ci_build/test_xtensa_hifi5.sh tflite-micro/"
5353
54+
hifi5_unit_tests_with_compression:
55+
runs-on: ubuntu-latest
56+
57+
name: Hifi5 Unit Tests with Compression (presubmit)
58+
steps:
59+
- uses: actions/checkout@v2
60+
with:
61+
ref: ${{ inputs.trigger-sha }}
62+
- run: |
63+
rm -rf .git
64+
echo ${{ secrets.tflm-bot-token }} | docker login ghcr.io -u tflm-bot --password-stdin
65+
docker run --env XTENSA_TOOLS_VERSION=RI-2022.9-linux --rm -v `pwd`:/opt/tflite-micro ghcr.io/tflm-bot/xtensa_xplorer_hifi5:0.2 \
66+
/bin/bash -c \
67+
"cd /opt && tflite-micro/tensorflow/lite/micro/tools/ci_build/test_xtensa_hifi5_with_compression.sh tflite-micro/"
68+
5469
hifi_3z_unit_tests:
5570
runs-on: ubuntu-latest
5671

@@ -65,3 +80,18 @@ jobs:
6580
docker run --env XTENSA_TOOLS_VERSION=RI-2020.4-linux --rm -v `pwd`:/opt/tflite-micro ghcr.io/tflm-bot/xtensa_xplorer_13:0.3 \
6681
/bin/bash -c \
6782
"cd /opt && tflite-micro/tensorflow/lite/micro/tools/ci_build/test_xtensa_hifi3z.sh EXTERNAL tflite-micro/"
83+
84+
hifi_3z_unit_tests_with_compression:
85+
runs-on: ubuntu-latest
86+
87+
name: Hifi3z Unit Tests with Compression (presubmit)
88+
steps:
89+
- uses: actions/checkout@v2
90+
with:
91+
ref: ${{ inputs.trigger-sha }}
92+
- run: |
93+
rm -rf .git
94+
echo ${{ secrets.tflm-bot-token }} | docker login ghcr.io -u tflm-bot --password-stdin
95+
docker run --env XTENSA_TOOLS_VERSION=RI-2020.4-linux --rm -v `pwd`:/opt/tflite-micro ghcr.io/tflm-bot/xtensa_xplorer_13:0.3 \
96+
/bin/bash -c \
97+
"cd /opt && tflite-micro/tensorflow/lite/micro/tools/ci_build/test_xtensa_hifi3z_with_compression.sh EXTERNAL tflite-micro/"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2024 The TensorFlow Authors. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ==============================================================================
16+
#
17+
# Called with following arguments:
18+
# 1 - (optional) TENSORFLOW_ROOT: path to root of the TFLM tree (relative to directory from where the script is called).
19+
# 2 - (optional) EXTERNAL_DIR: Path to the external directory that contains external code
20+
21+
# CI test with compression enabled for x86
22+
23+
set -e
24+
set -x
25+
26+
export TENSORFLOW_ROOT=${1}
27+
export EXTERNAL_DIR=${2}
28+
export USE_TFLM_COMPRESSION=yes
29+
export GENERIC_BENCHMARK_MODEL_PATH=${TENSORFLOW_ROOT}tensorflow/lite/micro/models/person_detect.tflite
30+
MAKEFILE=${TENSORFLOW_ROOT}tensorflow/lite/micro/tools/make/Makefile
31+
32+
make -f ${MAKEFILE} third_party_downloads # TODO(b/143715361): first to allow parallel builds.
33+
make -f ${MAKEFILE} -j$(nproc) build
34+
make -f ${MAKEFILE} -j$(nproc) test
35+
make -f ${MAKEFILE} -j$(nproc) integration_tests
36+
make -f ${MAKEFILE} -j$(nproc) run_tflm_benchmark
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2024 The TensorFlow Authors. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ==============================================================================
16+
# Called with following arguments:
17+
# 1 - EXTERNAL or INTERNAL to signal how to run the script
18+
# 2 - (optional) TENSORFLOW_ROOT: path to root of the TFLM tree (relative to directory from where the script is called).
19+
# 3 - (optional) EXTERNAL_DIR: Path to the external directory that contains external code
20+
21+
# CI test with compression enabled for hifi3z
22+
23+
set -e
24+
set -x
25+
pwd
26+
27+
export TENSORFLOW_ROOT=${2}
28+
export EXTERNAL_DIR=${3}
29+
export TARGET=xtensa
30+
export TARGET_ARCH=hifi3
31+
export OPTIMIZED_KERNEL_DIR=xtensa
32+
export XTENSA_CORE=HIFI_190304_swupgrade
33+
export GENERIC_BENCHMARK_MODEL_PATH=${TENSORFLOW_ROOT}tensorflow/lite/micro/models/person_detect.tflite
34+
export USE_TFLM_COMPRESSION=yes
35+
MAKEFILE=${TENSORFLOW_ROOT}tensorflow/lite/micro/tools/make/Makefile
36+
37+
make -f ${MAKEFILE} third_party_downloads # TODO(b/143904317): first to allow parallel builds
38+
make -f ${MAKEFILE} -j$(nproc) build
39+
make -f ${MAKEFILE} -j$(nproc) test
40+
make -f ${MAKEFILE} -j$(nproc) run_tflm_benchmark
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2024 The TensorFlow Authors. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ==============================================================================
16+
# Called with following arguments:
17+
# 1 - EXTERNAL or INTERNAL to signal how to run the script
18+
# 2 - (optional) TENSORFLOW_ROOT: path to root of the TFLM tree (relative to directory from where the script is called).
19+
# 3 - (optional) EXTERNAL_DIR: Path to the external directory that contains external code
20+
21+
# CI test with compression enabled for hifi5
22+
23+
set -e
24+
set -x
25+
pwd
26+
27+
export TENSORFLOW_ROOT=${2}
28+
export EXTERNAL_DIR=${3}
29+
export TARGET=xtensa
30+
export TARGET_ARCH=hifi5
31+
export OPTIMIZED_KERNEL_DIR=xtensa
32+
export XTENSA_CORE=PRD_H5_RDO_07_01_2022
33+
export GENERIC_BENCHMARK_MODEL_PATH=${TENSORFLOW_ROOT}tensorflow/lite/micro/models/person_detect.tflite
34+
export USE_TFLM_COMPRESSION=yes
35+
MAKEFILE=${TENSORFLOW_ROOT}tensorflow/lite/micro/tools/make/Makefile
36+
37+
make -f ${MAKEFILE} third_party_downloads # TODO(b/143904317): first to allow parallel builds
38+
make -f ${MAKEFILE} -j$(nproc) build
39+
make -f ${MAKEFILE} -j$(nproc) test
40+
make -f ${MAKEFILE} -j$(nproc) run_tflm_benchmark

0 commit comments

Comments
 (0)