Skip to content

Commit 19a78bf

Browse files
authored
Merge branch 'main' into refactor-bitwise-logical-tests
2 parents 02037b7 + 90f0843 commit 19a78bf

31 files changed

+75
-55
lines changed

.ci/scripts/unittest-macos.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ export TMP_DIR=$(mktemp -d)
1919
export PATH="${TMP_DIR}:$PATH"
2020
trap 'rm -rfv ${TMP_DIR}' EXIT
2121

22-
if [[ "$BUILD_TOOL" == "cmake" ]]; then
23-
# Setup MacOS dependencies as there is no Docker support on MacOS atm
24-
PYTHON_EXECUTABLE=python \
25-
EXECUTORCH_BUILD_PYBIND=ON \
26-
CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
27-
${CONDA_RUN} --no-capture-output \
28-
.ci/scripts/setup-macos.sh "$@"
22+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
23+
PYTHON_EXECUTABLE=python \
24+
EXECUTORCH_BUILD_PYBIND=ON \
25+
CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
26+
${CONDA_RUN} --no-capture-output \
27+
.ci/scripts/setup-macos.sh "$@"
2928

29+
if [[ "$BUILD_TOOL" == "cmake" ]]; then
3030
# Install llama3_2_vision dependencies.
3131
PYTHON_EXECUTABLE=python \
3232
${CONDA_RUN} --no-capture-output \

.github/workflows/_android.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
# Build LLM Demo for Android
3636
export BUILD_AAR_DIR=aar-out
3737
mkdir -p $BUILD_AAR_DIR
38-
bash build/build_android_library.sh ${ARTIFACTS_DIR_NAME}
38+
bash scripts/build_android_library.sh ${ARTIFACTS_DIR_NAME}
3939
bash .ci/scripts/build_android_instrumentation.sh ${ARTIFACTS_DIR_NAME}
4040
4141
mkdir -p examples/demo-apps/android/LlamaDemo/app/libs
@@ -120,7 +120,7 @@ jobs:
120120
with:
121121
api-level: ${{ env.API_LEVEL }}
122122
arch: x86_64
123-
script: ./build/run_android_emulator.sh
123+
script: ./scripts/run_android_emulator.sh
124124
# NB: This is to boot the emulator faster following the instructions on
125125
# https://github.com/ReactiveCircus/android-emulator-runner. The max number
126126
# of cores we can set is 6, any higher number will be reduced to 6.

.github/workflows/android-perf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ jobs:
363363
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
364364
365365
mkdir -p aar-out
366-
PYTHON_EXECUTABLE=python ANDROID_ABIS="arm64-v8a" BUILD_AAR_DIR=aar-out EXECUTORCH_BUILD_QNN=ON QNN_SDK_ROOT=/tmp/qnn/2.28.0.241029 bash build/build_android_library.sh
366+
PYTHON_EXECUTABLE=python ANDROID_ABIS="arm64-v8a" BUILD_AAR_DIR=aar-out EXECUTORCH_BUILD_QNN=ON QNN_SDK_ROOT=/tmp/qnn/2.28.0.241029 bash scripts/build_android_library.sh
367367
mkdir -p extension/benchmark/android/benchmark/app/libs
368368
cp aar-out/executorch.aar extension/benchmark/android/benchmark/app/libs
369369
pushd extension/benchmark/android/benchmark

.github/workflows/android-release-artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
# Build AAR Package
5656
mkdir aar-out
5757
export BUILD_AAR_DIR=aar-out
58-
bash build/build_android_library.sh
58+
bash scripts/build_android_library.sh
5959
mkdir -p "${ARTIFACTS_DIR_NAME}"
6060
cp aar-out/executorch.aar "${ARTIFACTS_DIR_NAME}/executorch.aar"
6161

.github/workflows/apple-perf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ jobs:
387387
388388
echo "::group::Build ExecuTorch iOS frameworks"
389389
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
390-
build/build_apple_frameworks.sh --Release --Debug --coreml --custom --mps --optimized --portable --quantized --xnnpack
390+
scripts/build_apple_frameworks.sh --Release --Debug --coreml --custom --mps --optimized --portable --quantized --xnnpack
391391
echo "::endgroup::"
392392
393393
# NB: Although exported models can be copied to this directory and bundled together with the
@@ -396,7 +396,7 @@ jobs:
396396
# create the directory here to pass the build
397397
mkdir -p extension/benchmark/apple/Benchmark/Models
398398
${CONDA_RUN} --no-capture-output \
399-
build/build_apple_llm_demo.sh ${ARTIFACTS_DIR_NAME}
399+
scripts/build_apple_llm_demo.sh ${ARTIFACTS_DIR_NAME}
400400
401401
upload-benchmark-app:
402402
needs: build-benchmark-app

.github/workflows/apple.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ on:
1111
- .github/workflows/apple.yml
1212
- install_executorch.sh
1313
- backends/apple/**
14-
- build/build_apple_frameworks.sh
15-
- build/build_apple_llm_demo.sh
16-
- build/create_frameworks.sh
14+
- scripts/build_apple_frameworks.sh
15+
- scripts/build_apple_llm_demo.sh
16+
- scripts/create_frameworks.sh
1717
- .ci/scripts/test_ios_ci.sh
1818
- examples/demo-apps/apple_ios/**
1919
- extension/apple/**
@@ -172,7 +172,7 @@ jobs:
172172
173173
# Build iOS Frameworks
174174
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
175-
build/build_apple_frameworks.sh --Release --Debug --coreml --custom --mps --optimized --portable --quantized --xnnpack
175+
scripts/build_apple_frameworks.sh --Release --Debug --coreml --custom --mps --optimized --portable --quantized --xnnpack
176176
177177
# Bundle iOS Frameworks
178178
for FRAMEWORK in "${FRAMEWORKS[@]}"; do (
@@ -313,11 +313,11 @@ jobs:
313313
314314
echo "::group::Build ExecuTorch iOS frameworks"
315315
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
316-
build/build_apple_frameworks.sh --Release --Debug --coreml --custom --mps --optimized --portable --quantized --xnnpack
316+
scripts/build_apple_frameworks.sh --Release --Debug --coreml --custom --mps --optimized --portable --quantized --xnnpack
317317
echo "::endgroup::"
318318
319319
echo "::group::Build ExecuTorch benchmark app"
320320
mkdir -p extension/benchmark/apple/Benchmark/Models
321321
${CONDA_RUN} --no-capture-output \
322-
build/build_apple_llm_demo.sh "${ARTIFACTS_DIR_NAME}"
322+
scripts/build_apple_llm_demo.sh "${ARTIFACTS_DIR_NAME}"
323323
echo "::endgroup::"

.github/workflows/pull.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,36 @@ jobs:
290290
# run e2e (export, tokenizer and runner)
291291
PYTHON_EXECUTABLE=python bash .ci/scripts/test_llava.sh
292292
293+
test-moshi-linux:
294+
name: test-moshi-linux
295+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
296+
permissions:
297+
id-token: write
298+
contents: read
299+
strategy:
300+
fail-fast: false
301+
with:
302+
runner: linux.2xlarge
303+
docker-image: executorch-ubuntu-22.04-clang12
304+
submodules: 'true'
305+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
306+
timeout: 90
307+
script: |
308+
# The generic Linux job chooses to use base env, not the one setup by the image
309+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
310+
conda activate "${CONDA_ENV}"
311+
312+
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool "cmake"
313+
314+
# install Mimi requirements
315+
bash examples/models/moshi/mimi/install_requirements.sh
316+
317+
# reinstall executorch
318+
bash ./install_executorch.sh
319+
320+
# run python unittest
321+
python -m unittest examples.models.moshi.mimi.test_mimi
322+
293323
test-quantized-aot-lib-linux:
294324
name: test-quantized-aot-lib-linux
295325
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ __pycache__/
1111
arm_test/
1212
buck-out/
1313
buck2-bin/
14+
build/
1415
cmake-android-out/
1516
cmake-ios-out/
1617
cmake-out*

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ We welcome contributions. To get started review the [guidelines](CONTRIBUTING.md
6767
```
6868
executorch
6969
├── backends # Backend delegate implementations.
70-
├── build # Utilities for managing the build system.
7170
├── codegen # Tooling to autogenerate bindings between kernels and the runtime.
7271
├── configurations
7372
├── docs # Static docs tooling.
@@ -81,8 +80,7 @@ executorch
8180
| ├── operator # Operator node manipulation utilities.
8281
| ├── passes # Built-in compiler passes.
8382
| ├── program # Export artifacts.
84-
| ├── serde # Graph module
85-
serialization/deserialization.
83+
| ├── serde # Graph module serialization/deserialization.
8684
| ├── verification # IR verification.
8785
├── extension # Extensions built on top of the runtime.
8886
| ├── android # ExecuTorch wrappers for Android apps.
@@ -97,8 +95,7 @@ serialization/deserialization.
9795
| ├── parallel # C++ threadpool integration.
9896
| ├── pybindings # Python API for executorch runtime.
9997
| ├── pytree # C++ and Python flattening and unflattening lib for pytrees.
100-
| ├── runner_util # Helpers for writing C++ PTE-execution
101-
tools.
98+
| ├── runner_util # Helpers for writing C++ PTE-execution tools.
10299
| ├── testing_util # Helpers for writing C++ tests.
103100
| ├── training # Experimental libraries for on-device training
104101
├── kernels # 1st party kernel implementations.
@@ -114,9 +111,9 @@ tools.
114111
| ├── executor # Model loading, initialization, and execution.
115112
| ├── kernel # Kernel registration and management.
116113
| ├── platform # Layer between architecture specific code and portable C++.
117-
├── schema # ExecuTorch PTE file format flatbuffer
118-
schemas.
119-
├── scripts # Utility scripts for size management, dependency management, etc.
114+
├── schema # ExecuTorch PTE file format flatbuffer schemas.
115+
├── scripts # Utility scripts for building libs, size management, dependency management, etc.
116+
├── tools # Development tool management.
120117
├── devtools # Model profiling, debugging, and introspection.
121118
├── shim # Compatibility layer between OSS and Internal builds
122119
├── test # Broad scoped end-to-end tests.

backends/apple/coreml/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ xcode-select --install
5050

5151
```bash
5252
cd executorch
53-
./build/build_apple_frameworks.sh --coreml
53+
./scripts/build_apple_frameworks.sh --coreml
5454
```
5555
5. Open the project in Xcode, and drag `executorch.xcframework` and `coreml_backend.xcframework` frameworks generated from Step 2 to Frameworks.
5656

backends/apple/mps/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ python3 -m sdk.inspector.inspector_cli --etdump_path etdump.etdp --etrecord_path
130130
***Step 1***. Create the ExecuTorch core and MPS delegate frameworks to link on iOS
131131
```bash
132132
cd executorch
133-
./build/build_apple_frameworks.sh --mps
133+
./scripts/build_apple_frameworks.sh --mps
134134
```
135135

136136
`mps_delegate.xcframework` will be in `cmake-out` folder, along with `executorch.xcframework` and `portable_delegate.xcframework`:

build/__init__.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/source/backends-mps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ python3 -m sdk.inspector.inspector_cli --etdump_path etdump.etdp --etrecord_path
130130
***Step 1***. Create the ExecuTorch core and MPS delegate frameworks to link on iOS
131131
```bash
132132
cd executorch
133-
./build/build_apple_frameworks.sh --mps
133+
./scripts/build_apple_frameworks.sh --mps
134134
```
135135

136136
`mps_delegate.xcframework` will be in `cmake-out` folder, along with `executorch.xcframework` and `portable_delegate.xcframework`:

docs/source/using-executorch-android.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Now you can compile your app with the ExecuTorch Android library.
8888

8989
## Building from Source
9090

91-
`build/build_android_library.sh` is a helper script to build the Java library (into .jar), native library (into .so), and the packaged AAR file. It can also build
91+
`scripts/build_android_library.sh` is a helper script to build the Java library (into .jar), native library (into .so), and the packaged AAR file. It can also build
9292
demo apps to showcase the AAR is integrated into a user app correctly.
9393

9494
You need Android [SDK](https://developer.android.com/studio) and [NDK](https://developer.android.com/ndk/downloads) to use it.
@@ -100,7 +100,7 @@ You need to set `ANDROID_HOME` to Android SDK home and `ANDROID_NDK` to the corr
100100
```
101101
export ANDROID_HOME=/path/to/sdk
102102
export ANDROID_NDK=/path/to/ndk
103-
sh build/build_android_library.sh
103+
sh scripts/build_android_library.sh
104104
```
105105

106106
### Optional environment variables
@@ -113,7 +113,7 @@ Set environment variable `ANDROID_ABIS` to either `arm64-v8a` or `x86_64` if you
113113
export ANDROID_ABIS=arm64-v8a
114114
# or
115115
# export ANDROID_ABIS=x86_64
116-
sh build/build_android_library.sh
116+
sh scripts/build_android_library.sh
117117
```
118118

119119
#### EXECUTORCH_CMAKE_BUILD_TYPE

docs/source/using-executorch-building-from-source.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ xcode-select --install
250250
2. Build the frameworks:
251251

252252
```bash
253-
./build/build_apple_frameworks.sh
253+
./scripts/build_apple_frameworks.sh
254254
```
255255

256256
Run the above command with `--help` flag to learn more on how to build additional backends

docs/source/using-executorch-ios.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ sudo /Applications/CMake.app/Contents/bin/cmake-gui --install
129129
6. Use the provided script to build .xcframeworks:
130130

131131
```bash
132-
./build/build_apple_frameworks.sh --help
132+
./scripts/build_apple_frameworks.sh --help
133133
```
134134

135135
For example, the following command will build the ExecuTorch Runtime along with all available kernels and backends for the Apple platform in both Release and Debug modes:
136136

137137
```bash
138-
./build/build_apple_frameworks.sh --Release --Debug --coreml --mps --xnnpack --custom --optimized --portable --quantized
138+
./scripts/build_apple_frameworks.sh --Release --Debug --coreml --mps --xnnpack --custom --optimized --portable --quantized
139139
```
140140

141141
After the build finishes successfully, the resulting frameworks can be found in the `cmake-out` directory.

examples/demo-apps/android/ExecuTorchDemo/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ popd
8686

8787
# Build the AAR. It will include XNNPACK backend by default.
8888
export BUILD_AAR_DIR=$(realpath examples/demo-apps/android/ExecuTorchDemo/app/libs)
89-
sh build/build_android_library.sh
89+
sh scripts/build_android_library.sh
9090
```
9191

9292
#### Qualcomm Hexagon NPU
@@ -107,7 +107,7 @@ popd
107107

108108
# Build the AAR. It will include XNNPACK backend by default.
109109
export BUILD_AAR_DIR=$(realpath examples/demo-apps/android/ExecuTorchDemo/app/libs)
110-
sh build/build_android_library.sh
110+
sh scripts/build_android_library.sh
111111
```
112112

113113
This is very similar to XNNPACK setup, but users now needs to define `QNN_SDK_ROOT` so that

examples/demo-apps/android/LlamaDemo/docs/delegates/mediatek_README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ The Mediatek runner (`examples/mediatek/executor_runner/mtk_llama_runner.cpp`) c
123123

124124
Next we need to build and compile the MediaTek backend and MediaTek Llama runner. By setting `NEURON_BUFFER_ALLOCATOR_LIB`, the script will build the MediaTek backend.
125125
```
126-
sh build/build_android_library.sh
126+
sh scripts/build_android_library.sh
127127
```
128128

129129
**Output**: This will generate an .aar file that is already imported into the expected directory for the Android app. It will live in `examples/demo-apps/android/Llamademo/app/libs`.

examples/demo-apps/android/LlamaDemo/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export BUILD_AAR_DIR
1212

1313
BASEDIR=$(dirname "$0")
1414
mkdir -p "$BASEDIR"/app/libs
15-
bash "$BASEDIR"/../../../../build/build_android_library.sh
15+
bash "$BASEDIR"/../../../../scripts/build_android_library.sh
1616

1717
cp "$BUILD_AAR_DIR/executorch.aar" "$BASEDIR"/app/libs/executorch.aar

examples/demo-apps/apple_ios/LLaMA/docs/delegates/xnnpack_README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ curl -LO "https://github.com/facebook/buck2/releases/download/$BUCK2_RELEASE_DAT
149149
zstd -cdq "$BUCK2_ARCHIVE" > "$BUCK2" && chmod +x "$BUCK2"
150150
rm "$BUCK2_ARCHIVE"
151151
152-
./build/build_apple_frameworks.sh --buck2="$(realpath $BUCK2)" --coreml --custom --mps --optimized --portable --quantized --xnnpack
152+
./scripts/build_apple_frameworks.sh --buck2="$(realpath $BUCK2)" --coreml --custom --mps --optimized --portable --quantized --xnnpack
153153
```
154154

155155
After the build finishes successfully, the resulting frameworks can be found in the `cmake-out` directory. Copy them to your project and link them against your targets.

examples/models/moshi/mimi/install_requirements.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
set -x
99

1010
pip install -U moshi
11-
pip install bitsandbytes
11+
pip install bitsandbytes soundfile
1212
# Run llama2/install requirements for torchao deps
1313
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
14-
15-
bash "$SCRIPT_DIR"/../llama/install_requirements.sh
14+
bash "$SCRIPT_DIR"/../../llama/install_requirements.sh

examples/models/moshi/mimi/test_mimi.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import os
33
import random
44
import unittest
5-
import urllib
65

76
import numpy as np
87
import requests

extension/benchmark/android/benchmark/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Minibench is usedful for giving reference performance data when developers integ
1515
You will need executorch AAR for Java and JNI dependencies.
1616
```
1717
export ANDROID_NDK=<path_to_android_ndk>
18-
sh build/build_android_library.sh
18+
sh scripts/build_android_library.sh
1919
```
2020
and copy the AAR to `app/libs`.
2121
```

scripts/__init__.py

Whitespace-only changes.
File renamed without changes.

build/build_apple_frameworks.sh renamed to scripts/build_apple_frameworks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ echo "Exporting headers"
217217

218218
mkdir -p "$HEADERS_PATH"
219219

220-
"$SOURCE_ROOT_DIR"/build/print_exported_headers.py --buck2=$(realpath "$BUCK2") --targets \
220+
"$SOURCE_ROOT_DIR"/scripts/print_exported_headers.py --buck2=$(realpath "$BUCK2") --targets \
221221
//extension/module: \
222222
//extension/tensor: \
223223
| rsync -av --files-from=- "$SOURCE_ROOT_DIR" "$HEADERS_PATH/executorch"
@@ -272,7 +272,7 @@ for mode in "${MODES[@]}"; do
272272
append_framework_flag "$PORTABLE" "$FRAMEWORK_KERNELS_PORTABLE" "$mode"
273273
append_framework_flag "$QUANTIZED" "$FRAMEWORK_KERNELS_QUANTIZED" "$mode"
274274

275-
"$SOURCE_ROOT_DIR"/build/create_frameworks.sh "${FRAMEWORK_FLAGS[@]}"
275+
"$SOURCE_ROOT_DIR"/scripts/create_frameworks.sh "${FRAMEWORK_FLAGS[@]}"
276276
done
277277

278278
echo "Cleaning up"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

build/test_ios.sh renamed to scripts/test_ios.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ curl https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt \
9090

9191
say "Building Frameworks"
9292

93-
./build/build_apple_frameworks.sh --coreml --custom --mps --optimized --portable --quantized --xnnpack
93+
./scripts/build_apple_frameworks.sh --coreml --custom --mps --optimized --portable --quantized --xnnpack
9494
mv cmake-out "$APP_PATH/Frameworks"
9595

9696
say "Creating Simulator"

0 commit comments

Comments
 (0)