Skip to content

Commit dae7d81

Browse files
committed
[trunk.yml] Add cortex-m binary size test
Just getting started. We will build on top of this.
1 parent b765133 commit dae7d81

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/trunk.yml

+54
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,60 @@ jobs:
224224
# Run arm unit tests using the simulator
225225
backends/arm/test/test_arm_baremetal.sh test_pytest_ethosu_fvp
226226
227+
test-arm-cortex-m-size-test:
228+
name: test-arm-cortex-m-size-test
229+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
230+
permissions:
231+
id-token: write
232+
contents: read
233+
with:
234+
runner: linux.2xlarge
235+
docker-image: executorch-ubuntu-22.04-arm-sdk
236+
submodules: 'true'
237+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
238+
timeout: 90
239+
script: |
240+
# The generic Linux job chooses to use base env, not the one setup by the image
241+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
242+
conda activate "${CONDA_ENV}"
243+
244+
source .ci/scripts/utils.sh
245+
install_executorch "--use-pt-pinned-commit"
246+
.ci/scripts/setup-arm-baremetal-tools.sh
247+
source examples/arm/ethos-u-scratch/setup_path.sh
248+
249+
# User baremetal toolchain
250+
arm-none-eabi-c++ --version
251+
toolchain_cmake=examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
252+
toolchain_cmake=$(realpath ${toolchain_cmake})
253+
254+
# Build and test size test
255+
bash test/build_size_test.sh "-DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DEXECUTORCH_BUILD_ARM_BAREMETAL=ON"
256+
elf="cmake-out/test/size_test"
257+
258+
# Dump basic info
259+
ls -al ${elf}
260+
arm-none-eabi-size ${elf}
261+
262+
# Dump symbols
263+
python .github/scripts/run_nm.py ${elf}
264+
python .github/scripts/run_nm.py ${elf} "executorch"
265+
python .github/scripts/run_nm.py ${elf} "executorch_text"
266+
267+
# Add basic guard - TODO: refine this!
268+
strip ${elf}
269+
output=$(ls -la ${elf})
270+
arr=($output)
271+
size=${arr[4]}
272+
threshold="51200" # 50KiB
273+
echo "size: $size, threshold: $threshold"
274+
if [[ "$size" -le "$threshold" ]]; then
275+
echo "Success $size <= $threshold"
276+
else
277+
echo "Fail $size > $threshold"
278+
exit 1
279+
fi
280+
227281
test-coreml-delegate:
228282
name: test-coreml-delegate
229283
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main

0 commit comments

Comments
 (0)