Skip to content

Commit 610eb4f

Browse files
zingofacebook-github-bot
authored andcommitted
Enable Arm unit test when running pull jobs (#3371)
Summary: Trigger and run backend arm tests as par of github ci Pull Request resolved: #3371 Reviewed By: manuelcandales Differential Revision: D57618564 Pulled By: digantdesai fbshipit-source-id: 195f61e323338e451833255ad52a73e3e16a3da6
1 parent 01ae21d commit 610eb4f

File tree

3 files changed

+49
-15
lines changed

3 files changed

+49
-15
lines changed

.ci/scripts/utils.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
# Copyright (c) Meta Platforms, Inc. and affiliates.
33
# All rights reserved.
4+
# Copyright 2024 Arm Limited and/or its affiliates.
45
#
56
# This source code is licensed under the BSD-style license found in the
67
# LICENSE file in the root directory of this source tree.
@@ -89,6 +90,17 @@ install_flatc_from_source() {
8990
popd || return
9091
}
9192

93+
install_arm() {
94+
# NB: This function could be used to install Arm dependencies
95+
# Setup arm example environment (including TOSA tools)
96+
git config --global user.email "[email protected]"
97+
git config --global user.name "Github Executorch"
98+
bash examples/arm/setup.sh --i-agree-to-the-contained-eula
99+
100+
# Test tosa_reference flow
101+
source examples/arm/ethos-u-scratch/setup_path.sh
102+
}
103+
92104
build_executorch_runner_buck2() {
93105
# Build executorch runtime with retry as this step is flaky on macos CI
94106
retry buck2 build //examples/portable/executor_runner:executor_runner

.github/workflows/pull.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,38 @@ jobs:
307307
uses: ./.github/workflows/_unittest.yml
308308
with:
309309
docker-image: executorch-ubuntu-22.04-clang12
310+
311+
unittest-arm:
312+
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
313+
strategy:
314+
matrix:
315+
include:
316+
- build-tool: buck2
317+
with:
318+
runner: linux.2xlarge
319+
docker-image: executorch-ubuntu-22.04-arm-sdk
320+
submodules: 'true'
321+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
322+
timeout: 90
323+
script: |
324+
set -eux
325+
326+
# The generic Linux job chooses to use base env, not the one setup by the image
327+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
328+
conda activate "${CONDA_ENV}"
329+
330+
BUILD_TOOL=${{ matrix.build-tool }}
331+
332+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
333+
PYTHON_EXECUTABLE=python \
334+
EXECUTORCH_BUILD_PYBIND=ON \
335+
EXECUTORCH_BUILD_ARM_BAREMETAL=ON \
336+
.ci/scripts/setup-linux.sh "${BUILD_TOOL}"
337+
338+
source .ci/scripts/utils.sh
339+
# Install Arm dependencies
340+
install_arm
341+
342+
# Run pytest with coverage
343+
pytest -c /dev/null -v -n auto --cov=./ --cov-report=xml backends/arm/test
344+

.github/workflows/trunk.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,13 @@ jobs:
142142
install_flatc_from_source
143143
install_executorch
144144
145-
# Setup arm example environment (including TOSA tools)
146-
git config --global user.email "[email protected]"
147-
git config --global user.name "Github Executorch"
148-
bash examples/arm/setup.sh --i-agree-to-the-contained-eula
145+
install_arm
149146
150147
# Increase number of files user can monitor to bypass buck failures.
151148
# Hopefully this is high enough for this setup.
152149
sudo sysctl fs.inotify.max_user_watches=1048576 # 1024 * 1024
153150
154151
# Test ethos-u delegate examples with run.sh
155-
source examples/arm/ethos-u-scratch/setup_path.sh
156152
PYTHON_EXECUTABLE=python bash examples/arm/run.sh examples/arm/ethos-u-scratch/ buck2
157153
158154
test-arm-reference-delegation:
@@ -172,20 +168,11 @@ jobs:
172168
install_flatc_from_source
173169
install_executorch
174170
175-
# Setup arm example environment (including TOSA tools)
176-
git config --global user.email "[email protected]"
177-
git config --global user.name "Github Executorch"
178-
bash examples/arm/setup.sh --i-agree-to-the-contained-eula
171+
install_arm
179172
180173
# Test tosa_reference flow
181-
source examples/arm/ethos-u-scratch/setup_path.sh
182174
PYTHON_EXECUTABLE=python bash backends/arm/test/run_tosa_reference.sh
183175
184-
# Run Arm specific unit-tests
185-
# Run pytest only on specified folders. These test should migrate into
186-
# the _unittest.yml once that test env is fixed
187-
pytest -c /dev/null -v -n auto --cov=./ --cov-report=xml backends/arm/test/ops/ backends/arm/test/models
188-
189176
test-coreml-delegate:
190177
name: test-coreml-delegate
191178
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main

0 commit comments

Comments
 (0)