Skip to content

Commit 0cac45b

Browse files
authored
Add GitHub Actions workflow for building CPU Aarch64 Linux wheels (#13946)
### Summary Fixes #13044 Release notes: build
1 parent 6d8583d commit 0cac45b

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

.ci/scripts/wheel/pre_build_script.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ set -euxo pipefail
99

1010
# This script is run before building ExecuTorch binaries
1111

12+
if [[ "$(uname -m)" == "aarch64" ]]; then
13+
# On some Linux aarch64 systems, the "atomic" library is not found during linking.
14+
# To work around this, replace "atomic" with the literal ${ATOMIC_LIB} so the
15+
# build system uses the full path to the atomic library.
16+
file="extension/llm/tokenizers/third-party/sentencepiece/src/CMakeLists.txt"
17+
sed 's/list(APPEND SPM_LIBS "atomic")/list(APPEND SPM_LIBS ${ATOMIC_LIB})/' \
18+
"$file" > "${file}.tmp" && mv "${file}.tmp" "$file"
19+
20+
grep -n 'list(APPEND SPM_LIBS ${ATOMIC_LIB})' "$file" && \
21+
echo "the file $file has been modified for atomic to use full path"
22+
fi
23+
1224
# Clone nested submodules for tokenizers - this is a workaround for recursive
1325
# submodule clone failing due to path length limitations on Windows. Eventually,
1426
# we should update the core job in test-infra to enable long paths before
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
import test_base
9+
from examples.models import Backend, Model
10+
11+
if __name__ == "__main__":
12+
# coremltools does not support linux aarch64 yet and install from the source fails on runtime
13+
# https://github.com/apple/coremltools/issues/1254
14+
# https://github.com/apple/coremltools/issues/2195
15+
test_base.run_tests(
16+
model_tests=[
17+
test_base.ModelTest(
18+
model=Model.Mv3,
19+
backend=Backend.XnnpackQuantizationDelegation,
20+
),
21+
]
22+
)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# From https://github.com/pytorch/test-infra/wiki/Using-Nova-Reusable-Build-Workflows
2+
name: Build Aarch64 Linux Wheels
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- .ci/**/*
8+
- .github/workflows/build-wheels-aarch64-linux.yml
9+
- examples/**/*
10+
- pyproject.toml
11+
- setup.py
12+
tags:
13+
- ciflow/binaries/*
14+
push:
15+
branches:
16+
- nightly
17+
- release/*
18+
tags:
19+
# NOTE: Binary build pipelines should only get triggered on release candidate builds
20+
# Release candidate tags look like: v1.11.0-rc1
21+
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
22+
- ciflow/binaries/*
23+
workflow_dispatch:
24+
25+
jobs:
26+
generate-matrix:
27+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
28+
with:
29+
package-type: wheel
30+
os: linux-aarch64
31+
test-infra-repository: pytorch/test-infra
32+
test-infra-ref: main
33+
with-cuda: disabled
34+
with-rocm: disabled
35+
python-versions: '["3.10", "3.11", "3.12"]'
36+
37+
build:
38+
needs: generate-matrix
39+
permissions:
40+
id-token: write
41+
contents: read
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
- repository: pytorch/executorch
47+
pre-script: .ci/scripts/wheel/pre_build_script.sh
48+
post-script: .ci/scripts/wheel/post_build_script.sh
49+
smoke-test-script: .ci/scripts/wheel/test_linux_aarch64.py
50+
package-name: executorch
51+
name: ${{ matrix.repository }}
52+
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
53+
with:
54+
repository: ${{ matrix.repository }}
55+
ref: ""
56+
test-infra-repository: pytorch/test-infra
57+
test-infra-ref: main
58+
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
59+
submodules: recursive
60+
env-var-script: .ci/scripts/wheel/envvar_linux.sh
61+
pre-script: ${{ matrix.pre-script }}
62+
post-script: ${{ matrix.post-script }}
63+
package-name: ${{ matrix.package-name }}
64+
smoke-test-script: ${{ matrix.smoke-test-script }}
65+
trigger-event: ${{ github.event_name }}
66+
architecture: aarch64

backends/apple/coreml/runtime/inmemoryfs/inmemory_filesystem.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
#include "inmemory_filesystem.hpp"
99

10+
#include <algorithm>
1011
#include <assert.h>
1112
#include <fstream>
1213
#include <iostream>
14+
#include <iterator>
1315
#include <sstream>
1416

1517
#if __has_include(<filesystem>)

0 commit comments

Comments
 (0)