Skip to content

Commit 115cdfa

Browse files
authored
Merge branch 'main' into partitioner
2 parents bee7ff6 + c778063 commit 115cdfa

File tree

226 files changed

+8506
-1876
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+8506
-1876
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5616fa4a68718ead203314a3467f7dd9547153ae
1+
9b498d3bb28b8e3411ce464dd2755c5b96d92c8f

.ci/docker/common/install_conda.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1313
install_miniconda() {
1414
BASE_URL="https://repo.anaconda.com/miniconda"
1515
CONDA_FILE="Miniconda3-py${PYTHON_VERSION//./}_${MINICONDA_VERSION}-Linux-x86_64.sh"
16-
if [[ $(uname -m) == "aarch64" ]]; then
16+
if [[ $(uname -m) == "aarch64" ]]; then
1717
CONDA_FILE="Miniconda3-py${PYTHON_VERSION//./}_${MINICONDA_VERSION}-Linux-aarch64.sh"
1818
fi
1919

@@ -71,4 +71,8 @@ fix_conda_ubuntu_libstdcxx() {
7171
install_miniconda
7272
install_python
7373
install_pip_dependencies
74-
fix_conda_ubuntu_libstdcxx
74+
# Hack breaks the job on aarch64 but is still necessary everywhere
75+
# else.
76+
if [ "$(uname -m)" != "aarch64" ]; then
77+
fix_conda_ubuntu_libstdcxx
78+
fi

.ci/docker/conda-env-ci.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake=3.26.4
1+
cmake=3.31.2
22
ninja=1.10.2
33
libuv
44
llvm-openmp

.ci/scripts/check_c10_sync.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ pushd pytorch
1212
git checkout "$pytorch_pin"
1313
popd
1414
"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/c10 pytorch/c10
15+
"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/torch/standalone pytorch/torch/standalone

.ci/scripts/setup-arm-baremetal-tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# Setup arm example environment (including TOSA tools)
99
git config --global user.email "github_executorch@arm.com"
1010
git config --global user.name "Github Executorch"
11-
bash examples/arm/setup.sh --i-agree-to-the-contained-eula
11+
bash examples/arm/setup.sh --i-agree-to-the-contained-eula ${@:-}

.github/workflows/apple.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
id: set_version
4040
shell: bash
4141
run: |
42-
VERSION="0.7.0.$(TZ='PST8PDT' date +%Y%m%d)"
42+
VERSION="0.8.0.$(TZ='PST8PDT' date +%Y%m%d)"
4343
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
4444
4545
build-demo-ios:

.github/workflows/build-presets.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,45 @@ jobs:
3434
${CONDA_RUN} cmake --preset ${{ matrix.preset }}
3535
${CONDA_RUN} cmake --build cmake-out -j$(( $(sysctl -n hw.ncpu) - 1 ))
3636
37+
zephyr:
38+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
preset: [zephyr]
43+
with:
44+
job-name: build
45+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
46+
runner: linux.2xlarge
47+
docker-image: executorch-ubuntu-22.04-arm-sdk
48+
submodules: recursive
49+
timeout: 90
50+
script: |
51+
set -eux
52+
# The generic Linux job chooses to use base env, not the one setup by the image
53+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
54+
conda activate "${CONDA_ENV}"
55+
56+
./install_requirements.sh > /dev/null
57+
58+
# Download toolchain
59+
toolchain_url="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.17.2/toolchain_linux-x86_64_arm-zephyr-eabi.tar.xz"
60+
toolchain_dir="arm-zephyr-eabi"
61+
curl --output "${toolchain_dir}.tar.xz" -L "${toolchain_url}"
62+
63+
# Verify download
64+
echo "93128be0235cf5cf5f1ee561aa6eac5f ${toolchain_dir}.tar.xz" > arm-zephyr-eabi.md5
65+
md5sum -c --strict arm-zephyr-eabi.md5
66+
67+
# Extract and install to PATH
68+
tar xf "${toolchain_dir}.tar.xz"
69+
rm -f "${toolchain_dir}.tar.xz"
70+
toolchain_bin_path="$(cd ${toolchain_dir}/bin && pwd)"
71+
export PATH=$PATH:${toolchain_bin_path}
72+
73+
# Build Arm Zephyr Preset
74+
cmake --preset ${{ matrix.preset }}
75+
cmake --build cmake-out -j$(( $(nproc) - 1 ))
3776
linux:
3877
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
3978
strategy:

.github/workflows/trunk.yml

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ jobs:
223223
permissions:
224224
id-token: write
225225
contents: read
226+
strategy:
227+
matrix:
228+
os: [bare_metal, zephyr-preset]
229+
fail-fast: false
226230
with:
227231
runner: linux.2xlarge
228232
docker-image: executorch-ubuntu-22.04-arm-sdk
@@ -234,35 +238,62 @@ jobs:
234238
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
235239
conda activate "${CONDA_ENV}"
236240
241+
cxx_flags="-fno-exceptions -fno-rtti -Wall -Werror -Wno-int-in-bool-context -DET_HAVE_PREAD=0"
242+
setup_script_args=""
243+
if [[ ${{ matrix.os}} == "bare_metal" ]]; then
244+
toolchain_prefix=arm-none-eabi-
245+
threshold="103268" # ~100KiB
246+
toolchain_cmake=examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
247+
elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then
248+
setup_script_args="--target-toolchain zephyr"
249+
toolchain_prefix=arm-zephyr-eabi-
250+
threshold="133120" # should be ~125KB, set threshold to 130KB
251+
toolchain_cmake=examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake
252+
else
253+
echo "Fail unsupport OS selection ${{ matrix.os }}"
254+
exit 1
255+
fi
256+
237257
source .ci/scripts/utils.sh
238258
install_executorch "--use-pt-pinned-commit"
239-
.ci/scripts/setup-arm-baremetal-tools.sh
259+
.ci/scripts/setup-arm-baremetal-tools.sh ${setup_script_args}
240260
source examples/arm/ethos-u-scratch/setup_path.sh
241261
242-
# User baremetal toolchain
243-
arm-none-eabi-c++ --version
244-
toolchain_cmake=examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
262+
# User toolchain
263+
${toolchain_prefix}c++ --version
264+
265+
# Setup cmake target to desired toolchain
245266
toolchain_cmake=$(realpath ${toolchain_cmake})
246267
247-
# Build and test size test
248-
bash test/build_size_test.sh "-DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DEXECUTORCH_BUILD_ARM_BAREMETAL=ON"
268+
# Build and run size test
269+
if [[ ${{ matrix.os}} == "bare_metal" ]]; then
270+
bash test/build_size_test.sh "-DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DEXECUTORCH_BUILD_ARM_BAREMETAL=ON"
271+
elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then
272+
CXXFLAGS=${cxx_flags} cmake --preset zephyr -DCMAKE_BUILD_TYPE=Release -DEXECUTORCH_OPTIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out .
273+
cmake --build cmake-out -j9 --target install --config Release
274+
CXXFLAGS=${cxx_flags} cmake -DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out/test test
275+
cmake --build cmake-out/test -j9 --config Release
276+
else
277+
echo "Fail unsupport OS selection ${{ matrix.os }}"
278+
exit 1
279+
fi
280+
249281
elf="cmake-out/test/size_test"
250282
251283
# Dump basic info
252284
ls -al ${elf}
253-
arm-none-eabi-size ${elf}
285+
${toolchain_prefix}size ${elf}
254286
255-
# Dump symbols
287+
# Dump symbol
256288
python .github/scripts/run_nm.py -e ${elf}
257-
python .github/scripts/run_nm.py -e ${elf} -f "executorch" -p "arm-none-eabi-"
258-
python .github/scripts/run_nm.py -e ${elf} -f "executorch_text" -p "arm-none-eabi-"
289+
python .github/scripts/run_nm.py -e ${elf} -f "executorch" -p "${toolchain_prefix}"
290+
python .github/scripts/run_nm.py -e ${elf} -f "executorch_text" -p "${toolchain_prefix}"
259291
260292
# Add basic guard - TODO: refine this!
261-
arm-none-eabi-strip ${elf}
293+
${toolchain_prefix}strip ${elf}
262294
output=$(ls -la ${elf})
263295
arr=($output)
264296
size=${arr[4]}
265-
threshold="103268" # ~100KiB
266297
echo "size: $size, threshold: $threshold"
267298
if [[ "$size" -le "$threshold" ]]; then
268299
echo "Success $size <= $threshold"
@@ -271,6 +302,36 @@ jobs:
271302
exit 1
272303
fi
273304
305+
nxp-build-test:
306+
name: nxp-build-test
307+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
308+
permissions:
309+
id-token: write
310+
contents: read
311+
with:
312+
runner: linux.2xlarge
313+
docker-image: executorch-ubuntu-22.04-arm-sdk
314+
submodules: 'recursive'
315+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
316+
timeout: 90
317+
script: |
318+
# The generic Linux job chooses to use base env, not the one setup by the image
319+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
320+
conda activate "${CONDA_ENV}"
321+
322+
# Build
323+
cmake -DEXECUTORCH_BUILD_NXP_NEUTRON=ON -Bcmake-out .
324+
cmake --build cmake-out --target executorch_delegate_neutron --config Release
325+
326+
# Build check for the neutron backend library
327+
lib_neutron="cmake-out/backends/nxp/libexecutorch_delegate_neutron.a"
328+
if [ -f $lib_neutron ]; then
329+
echo "Neutron backend library built."
330+
else
331+
echo "Neutron backend library not found!"
332+
exit 1
333+
fi
334+
274335
test-coreml-delegate:
275336
name: test-coreml-delegate
276337
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main

.lintrunner.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ exclude_patterns = [
7676
'examples/demo-apps/apple_ios/**',
7777
'examples/demo-apps/react-native/rnllama/ios/**',
7878
'extension/apple/**',
79+
'extension/llm/apple/**',
7980
# File contains @generated
8081
'extension/llm/custom_ops/spinquant/fast_hadamard_transform_special.h',
8182
'extension/llm/custom_ops/spinquant/test/fast_hadamard_transform_special_unstrided_cpu.h',

CMakeLists.txt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,12 @@ install(
449449
FILES_MATCHING
450450
PATTERN "*.h"
451451
)
452+
install(
453+
DIRECTORY runtime/executor/
454+
DESTINATION include/executorch/runtime/executor
455+
FILES_MATCHING
456+
PATTERN "*.h"
457+
)
452458
install(
453459
DIRECTORY runtime/kernel/
454460
DESTINATION include/executorch/runtime/kernel
@@ -496,6 +502,10 @@ if(EXECUTORCH_BUILD_CADENCE)
496502
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/cadence)
497503
endif()
498504

505+
if(EXECUTORCH_BUILD_NXP_NEUTRON)
506+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/nxp)
507+
endif()
508+
499509
if(EXECUTORCH_BUILD_COREML)
500510
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/apple/coreml)
501511
endif()
@@ -542,6 +552,12 @@ endif()
542552

543553
if(EXECUTORCH_BUILD_EXTENSION_MODULE)
544554
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/module)
555+
install(
556+
DIRECTORY extension/module/
557+
DESTINATION include/executorch/extension/module
558+
FILES_MATCHING
559+
PATTERN "*.h"
560+
)
545561
endif()
546562

547563
if(EXECUTORCH_BUILD_EXTENSION_LLM)
@@ -705,12 +721,8 @@ if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
705721
endif()
706722

707723
add_executable(executor_runner ${_executor_runner__srcs})
708-
if(CMAKE_BUILD_TYPE STREQUAL "Release")
709-
if(APPLE)
710-
target_link_options(executor_runner PRIVATE "LINKER:-dead_strip")
711-
else()
712-
target_link_options(executor_runner PRIVATE "LINKER:--gc-sections")
713-
endif()
724+
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
725+
target_link_options_gc_sections(executor_runner)
714726
endif()
715727
target_link_libraries(executor_runner ${_executor_runner_libs})
716728
target_compile_options(executor_runner PUBLIC ${_common_compile_options})

0 commit comments

Comments
 (0)