Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .ci/scripts/wheel/pre_build_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ set -euxo pipefail

# This script is run before building ExecuTorch binaries

if [[ "$(uname -m)" == "aarch64" ]]; then
# On some Linux aarch64 systems, the "atomic" library is not found during linking.
# To work around this, replace "atomic" with the literal ${ATOMIC_LIB} so the
# build system uses the full path to the atomic library.
file="extension/llm/tokenizers/third-party/sentencepiece/src/CMakeLists.txt"
sed 's/list(APPEND SPM_LIBS "atomic")/list(APPEND SPM_LIBS ${ATOMIC_LIB})/' \
"$file" > "${file}.tmp" && mv "${file}.tmp" "$file"

grep -n 'list(APPEND SPM_LIBS ${ATOMIC_LIB})' "$file" && \
echo "the file $file has been modified for atomic to use full path"
fi

# Clone nested submodules for tokenizers - this is a workaround for recursive
# submodule clone failing due to path length limitations on Windows. Eventually,
# we should update the core job in test-infra to enable long paths before
Expand Down
22 changes: 22 additions & 0 deletions .ci/scripts/wheel/test_linux_aarch64.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

import test_base
from examples.models import Backend, Model

if __name__ == "__main__":
# coremltools does not support linux aarch64 yet and install from the source fails on runtime
# https://github.com/apple/coremltools/issues/1254
# https://github.com/apple/coremltools/issues/2195
test_base.run_tests(
model_tests=[
test_base.ModelTest(
model=Model.Mv3,
backend=Backend.XnnpackQuantizationDelegation,
),
]
)
66 changes: 66 additions & 0 deletions .github/workflows/build-wheels-aarch64-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# From https://github.com/pytorch/test-infra/wiki/Using-Nova-Reusable-Build-Workflows
name: Build Aarch64 Linux Wheels

on:
pull_request:
paths:
- .ci/**/*
- .github/workflows/build-wheels-aarch64-linux.yml
- examples/**/*
- pyproject.toml
- setup.py
tags:
- ciflow/binaries/*
push:
branches:
- nightly
- release/*
tags:
# NOTE: Binary build pipelines should only get triggered on release candidate builds
# Release candidate tags look like: v1.11.0-rc1
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
- ciflow/binaries/*
workflow_dispatch:

jobs:
generate-matrix:
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
os: linux-aarch64
test-infra-repository: pytorch/test-infra
test-infra-ref: main
with-cuda: disabled
with-rocm: disabled
python-versions: '["3.10", "3.11", "3.12"]'

build:
needs: generate-matrix
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
include:
- repository: pytorch/executorch
pre-script: .ci/scripts/wheel/pre_build_script.sh
post-script: .ci/scripts/wheel/post_build_script.sh
smoke-test-script: .ci/scripts/wheel/test_linux_aarch64.py
package-name: executorch
name: ${{ matrix.repository }}
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
with:
repository: ${{ matrix.repository }}
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
submodules: recursive
env-var-script: .ci/scripts/wheel/envvar_linux.sh
pre-script: ${{ matrix.pre-script }}
post-script: ${{ matrix.post-script }}
package-name: ${{ matrix.package-name }}
smoke-test-script: ${{ matrix.smoke-test-script }}
trigger-event: ${{ github.event_name }}
architecture: aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

#include "inmemory_filesystem.hpp"

#include <algorithm>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <iterator>
#include <sstream>

#if __has_include(<filesystem>)
Expand Down
Loading