Skip to content

Commit c6d7ed2

Browse files
authored
Merge branch 'main' into relative-paths-react-demo-ios
2 parents 144c667 + 139be81 commit c6d7ed2

File tree

91 files changed

+2826
-699
lines changed

Some content is hidden

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

91 files changed

+2826
-699
lines changed

.ci/scripts/test_qnn_static_llama.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ $PYTHON_EXECUTABLE -m extension.llm.tokenizer.tokenizer -t tokenizer.model -o to
3434

3535
set +e
3636
# Compile only as weight sharing is not applicable on x86
37-
$PYTHON_EXECUTABLE backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleScript.test_stories_single_llama --model SM8650 --build_folder build-android/ --executorch_root . --artifact_dir . --compile_only
37+
$PYTHON_EXECUTABLE backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleLLMScript.test_llama_stories_110m --model SM8650 --build_folder build-android/ --executorch_root . --artifact_dir . --llama_artifacts . --compile_only
3838
exit_code1=$?
3939

4040
# Checks accuracy with weight sharing disabled since x86 does not support weight sharing.
41-
$PYTHON_EXECUTABLE backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleScript.test_stories_single_llama --model SM8650 --build_folder build-x86/ --executorch_root . --artifact_dir . --enable_x86_64
41+
$PYTHON_EXECUTABLE backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleLLMScript.test_llama_stories_110m --model SM8650 --build_folder build-x86/ --executorch_root . --artifact_dir . --llama_artifacts . --enable_x86_64
4242
exit_code2=$?
4343

4444
# Check the exit codes and print messages

.ci/scripts/unittest-buck2.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
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+
set -eux
8+
9+
# TODO: expand this to //...
10+
buck2 query //runtime/...
11+
12+
# TODO: expand the covered scope of Buck targets.
13+
buck2 build //runtime/core/portable_type/...
14+
buck2 test //runtime/core/portable_type/...

.ci/scripts/unittest-linux-cmake.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
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+
set -eux
8+
9+
# Run pytest with coverage
10+
pytest -n auto --cov=./ --cov-report=xml
11+
# Run gtest
12+
LLVM_PROFDATA=llvm-profdata-12 LLVM_COV=llvm-cov-12 \
13+
test/run_oss_cpp_tests.sh

.ci/scripts/unittest-linux.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
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+
set -eux
8+
9+
BUILD_TOOL=$1
10+
if [[ $BUILD_TOOL =~ ^(cmake|buck2)$ ]]; then
11+
echo "Running unittests for ${BUILD_TOOL} ..."
12+
else
13+
echo "Missing build tool (require buck2 or cmake), exiting..."
14+
exit 1
15+
fi
16+
17+
# The generic Linux job chooses to use base env, not the one setup by the image
18+
eval "$(conda shell.bash hook)"
19+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
20+
conda activate "${CONDA_ENV}"
21+
22+
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate
23+
source .ci/scripts/setup-vulkan-linux-deps.sh
24+
25+
PYTHON_EXECUTABLE=python \
26+
EXECUTORCH_BUILD_PYBIND=ON \
27+
CMAKE_ARGS="-DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
28+
.ci/scripts/setup-linux.sh "$BUILD_TOOL"
29+
30+
# Install llama3_2_vision dependencies.
31+
PYTHON_EXECUTABLE=python ./examples/models/llama3_2_vision/install_requirements.sh
32+
33+
if [[ "$BUILD_TOOL" == "cmake" ]]; then
34+
.ci/scripts/unittest-linux-cmake.sh
35+
elif [[ "$BUILD_TOOL" == "buck2" ]]; then
36+
.ci/scripts/unittest-buck2.sh
37+
else
38+
echo "Unknown build tool $BUILD_TOOL"
39+
exit 1
40+
fi

.ci/scripts/unittest-macos-cmake.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
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+
set -eux
8+
9+
# Run pytest with coverage
10+
${CONDA_RUN} pytest -n auto --cov=./ --cov-report=xml
11+
# Run gtest
12+
LLVM_PROFDATA="xcrun llvm-profdata" LLVM_COV="xcrun llvm-cov" \
13+
${CONDA_RUN} test/run_oss_cpp_tests.sh

.ci/scripts/unittest-macos.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
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+
set -eux
8+
9+
BUILD_TOOL=$1
10+
if [[ $BUILD_TOOL =~ ^(cmake|buck2)$ ]]; then
11+
echo "Running unittests for ${BUILD_TOOL} ..."
12+
else
13+
echo "Missing build tool (require buck2 or cmake), exiting..."
14+
exit 1
15+
fi
16+
17+
bash .ci/scripts/setup-conda.sh
18+
eval "$(conda shell.bash hook)"
19+
20+
# Create temp directory for sccache shims
21+
export TMP_DIR=$(mktemp -d)
22+
export PATH="${TMP_DIR}:$PATH"
23+
trap 'rm -rfv ${TMP_DIR}' EXIT
24+
25+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
26+
PYTHON_EXECUTABLE=python \
27+
EXECUTORCH_BUILD_PYBIND=ON \
28+
CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
29+
${CONDA_RUN} --no-capture-output \
30+
.ci/scripts/setup-macos.sh cmake
31+
32+
# Install llama3_2_vision dependencies.
33+
PYTHON_EXECUTABLE=python ./examples/models/llama3_2_vision/install_requirements.sh
34+
35+
if [[ "$BUILD_TOOL" == "cmake" ]]; then
36+
.ci/scripts/unittest-macos-cmake.sh
37+
elif [[ "$BUILD_TOOL" == "buck2" ]]; then
38+
.ci/scripts/unittest-buck2.sh
39+
else
40+
echo "Unknown build tool $BUILD_TOOL"
41+
exit 1
42+
fi

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ body:
2121
A clear and concise description of what the bug is.
2222
2323
```python
24-
# Sample code to reproduce the problem
24+
# Sample code to reproduce the problem. If applicable, also include your model export command.
2525
```
2626
2727
```

.github/workflows/_unittest.yml

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
required: true
88
type: string
99
description: Name of the docker image to use.
10+
build-tool:
11+
required: true
12+
type: string
13+
description: Build tool to use, cmake or buck2.
1014
python-version:
1115
required: false
1216
type: string
@@ -26,28 +30,7 @@ jobs:
2630
timeout: 90
2731
script: |
2832
set -eux
29-
30-
# The generic Linux job chooses to use base env, not the one setup by the image
31-
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
32-
conda activate "${CONDA_ENV}"
33-
34-
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate
35-
source .ci/scripts/setup-vulkan-linux-deps.sh
36-
37-
# Setup MacOS dependencies as there is no Docker support on MacOS atm
38-
PYTHON_EXECUTABLE=python \
39-
EXECUTORCH_BUILD_PYBIND=ON \
40-
CMAKE_ARGS="-DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
41-
.ci/scripts/setup-linux.sh cmake
42-
43-
# Install llama3_2_vision dependencies.
44-
PYTHON_EXECUTABLE=python ./examples/models/llama3_2_vision/install_requirements.sh
45-
46-
# Run pytest with coverage
47-
pytest -n auto --cov=./ --cov-report=xml
48-
# Run gtest
49-
LLVM_PROFDATA=llvm-profdata-12 LLVM_COV=llvm-cov-12 \
50-
test/run_oss_cpp_tests.sh
33+
.ci/scripts/unittest-linux.sh "${{ inputs.build-tool }}"
5134
5235
macos:
5336
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
@@ -58,27 +41,4 @@ jobs:
5841
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
5942
script: |
6043
set -eux
61-
62-
bash .ci/scripts/setup-conda.sh
63-
64-
# Create temp directory for sccache shims
65-
export TMP_DIR=$(mktemp -d)
66-
export PATH="${TMP_DIR}:$PATH"
67-
trap 'rm -rfv ${TMP_DIR}' EXIT
68-
69-
# Setup MacOS dependencies as there is no Docker support on MacOS atm
70-
PYTHON_EXECUTABLE=python \
71-
EXECUTORCH_BUILD_PYBIND=ON \
72-
CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
73-
${CONDA_RUN} --no-capture-output \
74-
.ci/scripts/setup-macos.sh cmake
75-
76-
# Install llama3_2_vision dependencies.
77-
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
78-
./examples/models/llama3_2_vision/install_requirements.sh
79-
80-
# Run pytest with coverage
81-
${CONDA_RUN} pytest -n auto --cov=./ --cov-report=xml
82-
# Run gtest
83-
LLVM_PROFDATA="xcrun llvm-profdata" LLVM_COV="xcrun llvm-cov" \
84-
${CONDA_RUN} test/run_oss_cpp_tests.sh
44+
.ci/scripts/unittest-macos.sh "${{ inputs.build-tool }}"

.github/workflows/pull.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,16 @@ jobs:
367367
id-token: write
368368
contents: read
369369
with:
370+
build-tool: cmake
371+
docker-image: executorch-ubuntu-22.04-clang12
372+
373+
unittest-buck:
374+
uses: ./.github/workflows/_unittest.yml
375+
permissions:
376+
id-token: write
377+
contents: read
378+
with:
379+
build-tool: buck2
370380
docker-image: executorch-ubuntu-22.04-clang12
371381

372382
unittest-arm:

.github/workflows/trunk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ jobs:
159159
sudo sysctl fs.inotify.max_user_watches=1048576 # 1024 * 1024
160160
161161
# Test ethos-u delegate examples with run.sh
162-
backends/arm/test/test_arm_baremetal.sh test_run_ethosu_fvp
162+
backends/arm/test/test_arm_baremetal.sh test_full_ethosu_fvp
163163
164164
165165
test-arm-reference-delegation:

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ if(EXECUTORCH_BUILD_EXTENSION_TRAINING)
258258
set(EXECUTORCH_BUILD_EXTENSION_MODULE ON)
259259
endif()
260260

261+
if(EXECUTORCH_BUILD_EXTENSION_MODULE)
262+
set(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON)
263+
set(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON)
264+
endif()
265+
261266
if(EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT)
262267
set(EXECUTORCH_BUILD_EXTENSION_TENSOR ON)
263268
set(EXECUTORCH_BUILD_KERNELS_CUSTOM ON)

CODEOWNERS

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# IMPORTANT:
2+
# This file is ONLY used to subscribe for notifications for PRs
3+
# related to a specific file path. Approvals from people in this
4+
# file are not required for merges.
5+
6+
/backends/apple @shoumikhin @cccclai
7+
/backends/apple/mps @cccclai @DenisVieriu97
8+
/backends/arm @digantdesai
9+
/backends/cadence @tarun292
10+
/backends/example @iseeyuan @JacobSzwejbka @larryliu0820
11+
/backends/mediatek @cccclai @neuropilot-captain
12+
/backends/qualcomm @cccclai @chunit-quic @haowhsu-quic @shewu-quic @winskuo-quic
13+
/backends/test @cccclai
14+
/backends/transforms @kimishpatel
15+
/backends/vulkan @SS-JIA
16+
/backends/xnnpack @digantdesai @mcr229
17+
18+
/build @GregoryComer @dbort @kirklandsign
19+
20+
/codegen @larryliu0820 @lucylq
21+
22+
/devtools @tarun292 @Gasoonjia
23+
24+
/docs @mergennachin
25+
26+
/examples/apple @shoumikhin
27+
/examples/apple/coreml @cccclai @metascroy @cymbalrush @YifanShenSZ
28+
/examples/arm @digantdesai
29+
/examples/cadence @tarun292
30+
/examples/demo-apps @shoumikhin @kirklandsign
31+
/examples/devtools @tarun292
32+
/examples/llm_manual @larryliu0820
33+
/examples/llm_pte_finetuning @JacobSzwejbka
34+
/examples/mediatek @cccclai
35+
/examples/models @lucylq
36+
/examples/portable @larryliu0820 @manuelcandales
37+
/examples/qualcomm @cccclai
38+
/examples/selective_build @lucylq @larryliu0820 @JacobSzwejbka
39+
/examples/xnnpack @digantdesai @mcr229
40+
41+
/exir/backend @cccclai @kimishpatel @JacobSzwejbka @tarun292
42+
/exir @JacobSzwejbka @tarun292 @larryliu0820
43+
44+
45+
/extension/android @kirklandsign
46+
/extension/android_test @kirklandsign
47+
/extension/apple @shoumikhin
48+
/extension/aten_util @JacobSzwejbka
49+
/extension/benchmark @tarun292
50+
/extension/data_loader @JacobSzwejbka @lucylq @dbort
51+
/extension/evalue_util @GregoryComer @dbort
52+
/extension/export_util @kimishpatel
53+
/extension/flat_tensor @lucylq
54+
/extension/gguf_util @larryliu0820
55+
/extension/kernel_util @kimishpatel @manuelcandales
56+
/extension/llm @jackzhxng @iseeyuan @larryliu0820
57+
/extension/memory_allocator @JacobSzwejbka @dbort
58+
/extension/module @shoumikhin
59+
/extension/parallel @kimishpatel
60+
/extension/pybindings @JacobSzwejbka @larryliu0820
61+
/extension/pytree @JacobSzwejbka
62+
/extension/runner_util @dbort
63+
/extension/tensor @shoumikhin
64+
/extension/testing_util @dbort
65+
/extension/threadpool @kimishpatel
66+
/extension/training @JacobSzwejbka
67+
68+
/kernels @manuelcandales
69+
70+
/profiler @tarun292 @Gasoonjia
71+
72+
/runtime @dbort @JacobSzwejbka @lucylq
73+
/runtime/backend @cccclai
74+
75+
/schema @dbort @JacobSzwejbka @lucylq
76+
77+
/scripts @GregoryComer
78+
79+
/shim @larryliu0820 @GregoryComer
80+
81+
/third-party @GregoryComer
82+
83+
/test @larryliu0820 @kirklandsign
84+
85+
/util @tarun292

backends/arm/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ To run the unit test suite with Corstone3x0 FVP simulator support use
5555
backends/arm/test/test_arm_baremetal.sh test_pytest_ethosu_fvp
5656
```
5757

58-
You can test to run some models with the run.sh flow
58+
You can test to run some models with the full fvp test flow
5959

6060
```
61-
backends/arm/test/test_arm_baremetal.sh test_run_ethosu_fvp
61+
backends/arm/test/test_arm_baremetal.sh test_full_ethosu_fvp
6262
```
6363

6464
## Unit tests

backends/arm/_passes/arm_pass_manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from executorch.backends.arm._passes.convert_squeezes_to_view import ( # type: ignore[import-not-found]
2828
ConvertSqueezesToViewPass,
2929
)
30+
from executorch.backends.arm._passes.convert_to_clamp import ConvertToClampPass
3031
from executorch.backends.arm._passes.decompose_batchnorm_pass import (
3132
DecomposeBatchNormPass,
3233
)
@@ -104,6 +105,7 @@ def _tosa_080_BI_pipeline(self, exported_program: ExportedProgram) -> GraphModul
104105
self.add_pass(DecomposeLinearPass())
105106
self.add_pass(ConvertMeanDimToAveragePoolPass())
106107
self.add_pass(ConvertFullLikeToFullPass())
108+
self.add_pass(ConvertToClampPass())
107109

108110
self.add_pass(ReplaceScalarWithTensorArgPass())
109111
self.add_pass(AnnotateDecomposedMatmulPass())
@@ -144,6 +146,8 @@ def _tosa_080_MI_pipeline(self, exported_program: ExportedProgram) -> GraphModul
144146
self.add_pass(DecomposeDivPass())
145147
self.add_pass(DecomposeSoftmaxesPass())
146148
self.add_pass(ConvertFullLikeToFullPass())
149+
self.add_pass(ConvertToClampPass())
150+
147151
self.add_pass(AnnotateDecomposedMatmulPass())
148152
self.add_pass(QuantizeOperatorArguments())
149153
self.add_pass(FoldAndAnnotateQParamsPass()) # type: ignore[call-arg]

0 commit comments

Comments
 (0)