Skip to content

Commit 50e4783

Browse files
authored
Merge branch 'main' into pr_model_improve
2 parents 071636e + feead18 commit 50e4783

File tree

318 files changed

+4360
-3210
lines changed

Some content is hidden

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

318 files changed

+4360
-3210
lines changed

.ci/scripts/build_android_instrumentation.sh

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

.ci/scripts/test_ios_ci.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
set -e
99

10-
APP_PATH="examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo"
10+
APP_PATH="executorch-examples/apple/ExecuTorchDemo/ExecuTorchDemo"
1111
MODEL_NAME="mv3"
1212
SIMULATOR_NAME="executorch"
1313

@@ -34,6 +34,10 @@ say() {
3434
echo -e "\033[1m\n\t** $1 **\n\033[0m"
3535
}
3636

37+
say "Cloning the Demo App"
38+
39+
git clone --depth 1 https://github.com/pytorch-labs/executorch-examples.git
40+
3741
say "Installing CoreML Backend Requirements"
3842

3943
./backends/apple/coreml/scripts/install_requirements.sh

.github/workflows/_android.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
runner: linux.2xlarge
1616
docker-image: executorch-ubuntu-22.04-clang12-android
17-
submodules: 'true'
17+
submodules: 'recursive'
1818
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
1919
timeout: 90
2020
upload-artifact: android-apps
@@ -36,8 +36,9 @@ jobs:
3636
cp ${BUILD_AAR_DIR}/executorch.aar $ARTIFACTS_DIR_NAME
3737
3838
mkdir -p ${ARTIFACTS_DIR_NAME}/library_test_dir
39-
bash .ci/scripts/build_android_instrumentation.sh
40-
cp ${BUILD_AAR_DIR}/executorch_android/build/outputs/apk/androidTest/debug/executorch_android-debug-androidTest.apk "${ARTIFACTS_DIR_NAME}/library_test_dir"
39+
bash extension/android/executorch_android/android_test_setup.sh
40+
(cd extension/android; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:assembleAndroidTest)
41+
cp extension/android/executorch_android/build/outputs/apk/androidTest/debug/executorch_android-debug-androidTest.apk "${ARTIFACTS_DIR_NAME}/library_test_dir"
4142
4243
mkdir -p ${ARTIFACTS_DIR_NAME}/fp32-xnnpack-custom
4344
bash examples/models/llama/install_requirements.sh

.github/workflows/android-perf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ jobs:
345345
with:
346346
runner: linux.2xlarge
347347
docker-image: executorch-ubuntu-22.04-clang12-android
348-
submodules: 'true'
348+
submodules: 'recursive'
349349
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
350350
timeout: 90
351351
upload-artifact: android-apps

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
description: Version name to be uploaded for AAR release
88
required: false
99
type: string
10+
upload_to_maven:
11+
description: Upload the AAR to maven staging repository
12+
required: false
13+
type: boolean
1014

1115
concurrency:
1216
group: ${{ github.workflow }}-${{ github.ref }}
@@ -31,14 +35,17 @@ jobs:
3135
build-aar:
3236
name: build-aar
3337
needs: check-if-aar-exists
34-
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
38+
if: ${{ !github.event.pull_request.head.repo.fork }}
39+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.7
40+
secrets: inherit
3541
permissions:
3642
id-token: write
3743
contents: read
3844
with:
45+
secrets-env: EXECUTORCH_MAVEN_SIGNING_KEYID EXECUTORCH_MAVEN_SIGNING_PASSWORD EXECUTORCH_MAVEN_CENTRAL_PASSWORD EXECUTORCH_MAVEN_CENTRAL_USERNAME EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS
3946
runner: linux.2xlarge
4047
docker-image: executorch-ubuntu-22.04-clang12-android
41-
submodules: 'true'
48+
submodules: 'recursive'
4249
ref: ${{ github.sha }}
4350
timeout: 90
4451
upload-artifact: android-apps
@@ -52,6 +59,16 @@ jobs:
5259
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool buck2
5360
export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
5461
62+
mkdir -p ~/.gradle
63+
touch ~/.gradle/gradle.properties
64+
echo "signing.keyId=${SECRET_EXECUTORCH_MAVEN_SIGNING_KEYID}" >> ~/.gradle/gradle.properties
65+
echo "signing.password=${SECRET_EXECUTORCH_MAVEN_SIGNING_PASSWORD}" >> ~/.gradle/gradle.properties
66+
echo "mavenCentralUsername=${SECRET_EXECUTORCH_MAVEN_CENTRAL_USERNAME}" >> ~/.gradle/gradle.properties
67+
echo "mavenCentralPassword=${SECRET_EXECUTORCH_MAVEN_CENTRAL_PASSWORD}" >> ~/.gradle/gradle.properties
68+
echo "signing.secretKeyRingFile=/tmp/secring.gpg" >> ~/.gradle/gradle.properties
69+
70+
echo -n "$SECRET_EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS" | base64 -d > /tmp/secring.gpg
71+
5572
# Build AAR Package
5673
mkdir aar-out
5774
export BUILD_AAR_DIR=aar-out
@@ -61,6 +78,12 @@ jobs:
6178
6279
shasum -a 256 "${ARTIFACTS_DIR_NAME}/executorch.aar"
6380
81+
# Publish to maven staging
82+
UPLOAD_TO_MAVEN="${{ inputs.upload_to_maven }}"
83+
if [[ "$UPLOAD_TO_MAVEN" == "true" ]]; then
84+
(cd aar-out; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:publishToMavenCentral)
85+
fi
86+
6487
upload-release-aar:
6588
name: upload-release-aar
6689
needs: build-aar

.mypy.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ ignore_missing_imports = True
8080
[mypy-serializer.*]
8181
ignore_missing_imports = True
8282

83+
[mypy-tosa_tools.*]
84+
ignore_missing_imports = True
85+
8386
[mypy-setuptools.*]
8487
ignore_missing_imports = True
8588

CONTRIBUTING.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Thank you for your interest in contributing to ExecuTorch! We want to make
22
it easy to contribute to this project.
33

4-
 
54

65
## Dev Install
76

@@ -91,7 +90,7 @@ executorch
9190
│ └── <a href="runtime/platform">platform</a> - Layer between architecture specific code and portable C++.
9291
├── <a href="schema">schema</a> - ExecuTorch PTE file format flatbuffer schemas.
9392
├── <a href="scripts">scripts</a> - Utility scripts for building libs, size management, dependency management, etc.
94-
├── <a href="shim">shim</a> - Compatibility layer between OSS and Internal builds.
93+
├── <a href="shim_et">shim_et</a> - Compatibility layer between OSS and Internal builds.
9594
├── <a href="test">test</a> - Broad scoped end-to-end tests.
9695
├── <a href="third-party">third-party</a> - Third-party dependencies.
9796
├── <a href="tools">tools</a> - Tools for building ExecuTorch from source, for different built tools (CMake, Buck).
@@ -103,6 +102,8 @@ executorch
103102
## Contributing workflow
104103
We actively welcome your pull requests (PRs).
105104

105+
If you're completely new to open-source projects, GitHub, or ExecuTorch, please see our [New Contributor Guide](./docs/source/new-contributor-guide.md) for a step-by-step walkthrough on making your first contribution. Otherwise, read on.
106+
106107
1. [Claim an issue](#claiming-issues), if present, before starting work. If an
107108
issue doesn't cover the work you plan to do, consider creating one to provide
108109
context about it, and to build consensus about the scope and solution.
@@ -192,9 +193,6 @@ in the Github repo.
192193

193194
## Coding Style
194195

195-
Goal: Encourage standards that make it easier to read, edit, maintain, and debug
196-
the ExecuTorch code.
197-
198196
### lintrunner
199197

200198
We use [`lintrunner`](https://pypi.org/project/lintrunner/) to help make sure the
@@ -259,7 +257,7 @@ toolchains, and having access to relatively modern C++ features.
259257

260258
#### C/C++ standard library usage
261259

262-
**Restricted usage of the C++ standard library.**
260+
**Restricted usage of the C++ standard library**
263261

264262
Rationale: ExecuTorch is intended to be portable to bare-metal systems that lack
265263
certain features, like dynamic memory, threading, and locking, required by parts
@@ -280,7 +278,7 @@ careful to also manually destroy objects initialized in this way.
280278

281279
#### C++ language features
282280

283-
**Exceptions: Do not use.**
281+
**Exceptions: Do not use**
284282
- Rationale: Exceptions are not widely supported on some classes of
285283
microcontrollers and DSPs, and they can significantly increase binary size.
286284

@@ -289,12 +287,12 @@ must work with threading**
289287
- Rationale: The core runtime must work on systems that do not have threading
290288
support.
291289

292-
**RTTI, dynamic_cast, and `<typeid>`: Do not use.**
290+
**RTTI, dynamic_cast, and `<typeid>`: Do not use**
293291
- Rationale: RTTI adds extra data to every virtual class. ExecuTorch doesn't
294292
have a strong need for `dynamic_cast` and friends, so it's better to reduce
295293
the binary size.
296294

297-
**Templates and template metaprogramming: Be careful and avoid if possible.**
295+
**Templates and template metaprogramming: Be careful and avoid if possible**
298296
- Rationale: Most templating results in code generation, and is one of the most
299297
common sources of binary bloat. Some use of templates is fine (e.g. an
300298
`ArrayRef<T>`, or code that handles multiple `ScalarType` types), but for the
@@ -359,7 +357,7 @@ docs](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/
359357
for basics.
360358

361359
1. Push your branch to your fork of `pytorch/executorch`. Most people do not
362-
have permission to push a branch directoy to the upstream repo.
360+
have permission to push a branch directory to the upstream repo.
363361
1. Create your PR
364362
- Use the `main` branch as the base.
365363
- Give the PR a clear and descriptive title. It will become the title of the

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ Key value propositions of ExecuTorch are:
4949
## Getting Started
5050
To get started you can:
5151

52-
- Visit the [Step by Step Tutorial](https://pytorch.org/executorch/main/index.html) on getting things running locally and deploy a model to a device
52+
- Visit the [Step by Step Tutorial](https://pytorch.org/executorch/main/index.html) to get things running locally and deploy a model to a device
5353
- Use this [Colab Notebook](https://pytorch.org/executorch/stable/getting-started-setup.html#quick-setup-colab-jupyter-notebook-prototype) to start playing around right away
54-
- Jump straight into LLMs use cases by following specific instructions for [Llama](./examples/models/llama/README.md) and [Llava](./examples/models/llava/README.md)
54+
- Jump straight into LLM use cases by following specific instructions for [Llama](./examples/models/llama/README.md) and [Llava](./examples/models/llava/README.md)
5555

5656
## Feedback and Engagement
5757

backends/arm/operators/node_visitor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
from typing import Dict, List
99

10-
import serializer.tosa_serializer as ts # type: ignore
1110
import torch
11+
12+
import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore
1213
from executorch.backends.arm.tosa_mapping import TosaArg
1314
from executorch.backends.arm.tosa_specification import TosaSpecification
1415
from torch.export import ExportedProgram

backends/arm/operators/op_abs.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
import executorch.backends.arm.tosa_quant_utils as tqutils
1010
import executorch.backends.arm.tosa_utils as tutils
1111

12-
import serializer.tosa_serializer as ts # type: ignore
12+
import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore
1313
from executorch.backends.arm.operators.node_visitor import (
1414
NodeVisitor,
1515
register_node_visitor,
1616
)
1717
from executorch.backends.arm.tosa_mapping import TosaArg
1818
from executorch.backends.arm.tosa_specification import TosaSpecification
19-
20-
from serializer.tosa_serializer import TosaOp
2119
from torch.fx import Node
2220

2321

@@ -70,7 +68,7 @@ def define_node(
7068

7169
# Do the INT32 Abs
7270
tosa_graph.addOperator(
73-
TosaOp.Op().ABS,
71+
ts.TosaOp.Op().ABS,
7472
[
7573
rescaled_inputs[0].name,
7674
],
@@ -126,7 +124,7 @@ def define_node(
126124

127125
# MI lowering
128126
tosa_graph.addOperator(
129-
TosaOp.Op().ABS,
127+
ts.TosaOp.Op().ABS,
130128
[inputs[0].name],
131129
[output.name],
132130
None,

backends/arm/operators/op_add.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
import executorch.backends.arm.tosa_quant_utils as tqutils
1111
import executorch.backends.arm.tosa_utils as tutils
1212

13-
import serializer.tosa_serializer as ts # type: ignore
13+
import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore
1414
from executorch.backends.arm.operators.node_visitor import (
1515
NodeVisitor,
1616
register_node_visitor,
1717
)
1818
from executorch.backends.arm.tosa_mapping import TosaArg
1919
from executorch.backends.arm.tosa_specification import TosaSpecification
20-
from serializer.tosa_serializer import TosaOp
2120
from torch.fx import Node
2221

2322

@@ -82,7 +81,7 @@ def define_node(
8281

8382
# Do the INT32 Add
8483
tosa_graph.addOperator(
85-
TosaOp.Op().ADD,
84+
ts.TosaOp.Op().ADD,
8685
[input1.name, input2.name],
8786
[add_output.name],
8887
None,
@@ -135,7 +134,7 @@ def define_node(
135134

136135
# MI lowering
137136
tosa_graph.addOperator(
138-
TosaOp.Op().ADD,
137+
ts.TosaOp.Op().ADD,
139138
[input1.name, input2.name],
140139
[output.name],
141140
None,

backends/arm/operators/op_amax.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
# LICENSE file in the root directory of this source tree.
55
from typing import List
66

7-
import serializer.tosa_serializer as ts
7+
import tosa_tools.v0_80.serializer.tosa_serializer as ts
88
from executorch.backends.arm._passes.arm_pass_utils import get_first_fake_tensor
99
from executorch.backends.arm.operators.node_visitor import (
1010
NodeVisitor,
1111
register_node_visitor,
1212
)
1313
from executorch.backends.arm.tosa_mapping import TosaArg
14-
from serializer.tosa_serializer import TosaOp
1514
from torch.fx import Node
1615

1716

@@ -48,5 +47,5 @@ def define_node(
4847
attr.AxisAttribute(input.dim_order.index(dim))
4948

5049
tosa_graph.addOperator(
51-
TosaOp.Op().REDUCE_MAX, [input.name], [output.name], attr
50+
ts.TosaOp.Op().REDUCE_MAX, [input.name], [output.name], attr
5251
)

backends/arm/operators/op_amin.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
# LICENSE file in the root directory of this source tree.
55
from typing import List
66

7-
import serializer.tosa_serializer as ts
7+
import tosa_tools.v0_80.serializer.tosa_serializer as ts
88
from executorch.backends.arm._passes.arm_pass_utils import get_first_fake_tensor
99
from executorch.backends.arm.operators.node_visitor import (
1010
NodeVisitor,
1111
register_node_visitor,
1212
)
1313
from executorch.backends.arm.tosa_mapping import TosaArg
14-
from serializer.tosa_serializer import TosaOp
1514
from torch.fx import Node
1615

1716

@@ -48,5 +47,5 @@ def define_node(
4847
attr.AxisAttribute(input.dim_order.index(dim))
4948

5049
tosa_graph.addOperator(
51-
TosaOp.Op().REDUCE_MIN, [input.name], [output.name], attr
50+
ts.TosaOp.Op().REDUCE_MIN, [input.name], [output.name], attr
5251
)

backends/arm/operators/op_any.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
# pyre-unsafe
77
from typing import cast, List
88

9-
import serializer.tosa_serializer as ts # type: ignore
9+
import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore
1010
from executorch.backends.arm.operators.node_visitor import ( # type: ignore
1111
NodeVisitor,
1212
register_node_visitor,
1313
)
1414

1515
from executorch.backends.arm.tosa_mapping import TosaArg # type: ignore
16-
from serializer.tosa_serializer import TosaOp
1716
from torch.fx import Node
1817

1918

@@ -49,5 +48,5 @@ def define_node(
4948
attr.AxisAttribute(inputs[0].dim_order.index(dim))
5049

5150
tosa_graph.addOperator(
52-
TosaOp.Op().REDUCE_ANY, [inputs[0].name], [output.name], attr
51+
ts.TosaOp.Op().REDUCE_ANY, [inputs[0].name], [output.name], attr
5352
)

backends/arm/operators/op_avg_pool2d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
# pyre-unsafe
77
from typing import List
88

9-
import serializer.tosa_serializer as ts # type: ignore
109
import torch
1110

11+
import tosa_tools.v0_80.serializer.tosa_serializer as ts # type: ignore
12+
1213
from executorch.backends.arm._passes.fold_qdq_with_annotated_qparams_pass import (
1314
get_input_qparams,
1415
get_output_qparams,

0 commit comments

Comments
 (0)