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