Skip to content

Commit 2535a25

Browse files
kirklandsignfacebook-github-bot
authored andcommitted
Arm build and runner CI (#1111)
Summary: Add the setup part to docker image to make the run faster. Pull Request resolved: #1111 Reviewed By: huydhn Differential Revision: D50866420 Pulled By: kirklandsign fbshipit-source-id: 6c2e6ff7ffe245df950519dd258204661e2fed56
1 parent bd2462e commit 2535a25

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

.ci/docker/build.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ case "${IMAGE_NAME}" in
2626
executorch-ubuntu-22.04-linter)
2727
LINTRUNNER=yes
2828
;;
29+
executorch-ubuntu-22.04-arm-sdk)
30+
ARM_SDK=yes
31+
;;
2932
*)
3033
echo "Invalid image name ${IMAGE_NAME}"
3134
exit 1
@@ -41,6 +44,9 @@ BUILD_DOCS=1
4144
# Copy requirements-lintrunner.txt from root to here
4245
cp ../../requirements-lintrunner.txt ./
4346

47+
# Copy arm setup script from root to here
48+
cp -r ../../examples/arm/ ./arm
49+
4450
docker build \
4551
--no-cache \
4652
--progress=plain \
@@ -52,8 +58,9 @@ docker build \
5258
--build-arg "TORCHAUDIO_VERSION=${TORCHAUDIO_VERSION}.${NIGHTLY}" \
5359
--build-arg "TORCHVISION_VERSION=${TORCHVISION_VERSION}.${NIGHTLY}" \
5460
--build-arg "BUCK2_VERSION=${BUCK2_VERSION}" \
55-
--build-arg "LINTRUNNER=${LINTRUNNER}" \
61+
--build-arg "LINTRUNNER=${LINTRUNNER:-}" \
5662
--build-arg "BUILD_DOCS=${BUILD_DOCS}" \
63+
--build-arg "ARM_SDK=${ARM_SDK:-}" \
5764
-f "${OS}"/Dockerfile \
5865
"$@" \
5966
.

.ci/docker/ubuntu/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,10 @@ COPY ./requirements-lintrunner.txt requirements-lintrunner.txt
5151
RUN if [ -n "${LINTRUNNER}" ]; then bash ./install_linter.sh; fi
5252
RUN rm install_linter.sh utils.sh requirements-lintrunner.txt
5353

54+
ARG ARM_SDK
55+
COPY --chown=ci-user:ci-user ./arm /opt/arm
56+
# Set up ARM SDK if needed
57+
RUN if [ -n "${ARM_SDK}" ]; then git config --global user.email "[email protected]"; git config --global user.name "OSS CI"; bash /opt/arm/setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user:ci-user /opt/arm-sdk; fi
58+
5459
USER ci-user
5560
CMD ["bash"]

.github/workflows/docker-builds.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
include:
2828
- docker-image-name: executorch-ubuntu-22.04-clang12
2929
- docker-image-name: executorch-ubuntu-22.04-linter
30+
- docker-image-name: executorch-ubuntu-22.04-arm-sdk
3031
env:
3132
DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/executorch/${{ matrix.docker-image-name }}
3233
steps:

.github/workflows/trunk.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,24 @@ jobs:
131131
# Test selective build
132132
PYTHON_EXECUTABLE=python bash examples/portable/scripts/test_demo_backend_delegation.sh "${BUILD_TOOL}"
133133
134+
test-arm-backend-delegation:
135+
name: test-arm-backend-delegation
136+
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
137+
with:
138+
runner: linux.2xlarge
139+
docker-image: executorch-ubuntu-22.04-arm-sdk
140+
submodules: 'true'
141+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
142+
script: |
143+
# The generic Linux job chooses to use base env, not the one setup by the image
144+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
145+
conda activate "${CONDA_ENV}"
146+
147+
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh cmake
148+
# Test selective build
149+
source /opt/arm-sdk/setup_path.sh
150+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh /opt/arm-sdk buck2
151+
134152
test-coreml-delegate:
135153
name: test-coreml-delegate
136154
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main

backends/arm/arm_backend.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,7 @@ def vela_compile(tosa_fb):
196196
# Add a block for scratch, inputs and outputs; scratch shape is a 1 element
197197
# array giving us size in bytes so extract this and add a block of 0's.
198198
# Currently we preallocated this on the host to provide SRAM for computation.
199-
if len(data["scratch_shape"][0]) != 1:
200-
raise RuntimeError("Expected scratch to be single array")
201-
block_length = data["scratch_shape"][0].item()
199+
block_length = int(data["scratch_shape"][0])
202200
bin_blocks["scratch_data"] = b"\x00" * block_length
203201

204202
# Capture inputs and outputs

0 commit comments

Comments
 (0)