Skip to content

Commit 3ae909b

Browse files
Merge branch 'main' into issue9971-profile
2 parents 4995717 + b3963e6 commit 3ae909b

File tree

72 files changed

+1002
-337
lines changed

Some content is hidden

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

72 files changed

+1002
-337
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ jobs:
8080
8181
echo -n "$SECRET_EXECUTORCH_MAVEN_SIGNING_GPG_KEY_CONTENTS" | base64 -d > /tmp/secring.gpg
8282
83+
# Update the version name in build.gradle in case of maven publish
84+
VERSION="${{ inputs.version }}"
85+
if [ ! -z "$VERSION" ]; then
86+
sed -i "s/\(coordinates(\"org.pytorch\", \"executorch-android\", \"\)\([0-9]\+.[0-9]\+.[0-9]\+\)\(\")\)/\1$VERSION\3/" extension/android/executorch_android/build.gradle
87+
fi
88+
8389
# Build AAR Package
8490
mkdir aar-out
8591
export BUILD_AAR_DIR=aar-out
@@ -92,7 +98,7 @@ jobs:
9298
# Publish to maven staging
9399
UPLOAD_TO_MAVEN="${{ inputs.upload_to_maven }}"
94100
if [[ "$UPLOAD_TO_MAVEN" == "true" ]]; then
95-
(cd aar-out; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:publishToMavenCentral)
101+
(cd extension/android; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:publishToMavenCentral)
96102
fi
97103
98104
upload-release-aar:

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,12 +761,16 @@ if(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR)
761761
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/flat_tensor)
762762
endif()
763763

764+
if(EXECUTORCH_BUILD_EXTENSION_MODULE)
765+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/module)
766+
endif()
767+
764768
if(EXECUTORCH_BUILD_EXTENSION_LLM)
765769
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/tokenizers)
766770
endif()
767771

768-
if(EXECUTORCH_BUILD_EXTENSION_MODULE)
769-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/module)
772+
if(EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER)
773+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/runner)
770774
endif()
771775

772776
if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ executorch
4545
│ └── <a href="devtools/visualization">visualization</a> - Visualization tools for representing model structure and performance metrics.
4646
├── <a href="docs">docs</a> - Static docs tooling and documentation source files.
4747
├── <a href="examples">examples</a> - Examples of various user flows, such as model export, delegates, and runtime execution.
48-
├── <a href="exir">exir</a> - Ahead-of-time library: model capture and lowering APIs. EXport Intermediate Representation (EXIR) is a format for representing the result of <a href="https://pytorch.org/docs/main/export.ir_spec.html">torch.export</a>. This directory contains utilities and passes for lowering the EXIR graphs into different <a href="/docs/source/ir-exir.md">dialects</a> and eventually suitable to run on target hardware.
48+
├── <a href="exir">exir</a> - Ahead-of-time library: model capture and lowering APIs. EXport Intermediate Representation (EXIR) is a format for representing the result of <a href="https://pytorch.org/docs/stable/export.html">torch.export</a>. This directory contains utilities and passes for lowering the EXIR graphs into different <a href="/docs/source/ir-exir.md">dialects</a> and eventually suitable to run on target hardware.
4949
│ ├── <a href="exir/_serialize">_serialize</a> - Serialize final export artifact.
5050
│ ├── <a href="exir/backend">backend</a> - Backend delegate ahead of time APIs.
5151
│ ├── <a href="exir/capture">capture</a> - Program capture.

backends/arm/test/ops/test_tanh.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99

1010
from typing import Tuple
1111

12+
import pytest
13+
1214
import torch
1315

14-
from executorch.backends.arm.test import common
16+
from executorch.backends.arm.test import common, conftest
1517
from executorch.backends.arm.test.tester.arm_tester import ArmTester
1618
from executorch.exir.backend.compile_spec_schema import CompileSpec
1719
from parameterized import parameterized
@@ -40,7 +42,7 @@ def forward(self, x):
4042
def _test_tanh_tosa_MI_pipeline(
4143
self, module: torch.nn.Module, test_data: Tuple[torch.tensor]
4244
):
43-
(
45+
tester = (
4446
ArmTester(
4547
module,
4648
example_inputs=test_data,
@@ -54,11 +56,13 @@ def _test_tanh_tosa_MI_pipeline(
5456
.check_not(["executorch_exir_dialects_edge__ops_aten_tanh_default"])
5557
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
5658
.to_executorch()
57-
.run_method_and_compare_outputs(inputs=test_data)
5859
)
5960

61+
if conftest.is_option_enabled("tosa_ref_model"):
62+
tester.run_method_and_compare_outputs(inputs=test_data)
63+
6064
def _test_tanh_tosa_BI_pipeline(self, module: torch.nn.Module, test_data: Tuple):
61-
(
65+
tester = (
6266
ArmTester(
6367
module,
6468
example_inputs=test_data,
@@ -73,9 +77,11 @@ def _test_tanh_tosa_BI_pipeline(self, module: torch.nn.Module, test_data: Tuple)
7377
.check_not(["executorch_exir_dialects_edge__ops_aten_tanh_default"])
7478
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
7579
.to_executorch()
76-
.run_method_and_compare_outputs(inputs=test_data)
7780
)
7881

82+
if conftest.is_option_enabled("tosa_ref_model"):
83+
tester.run_method_and_compare_outputs(inputs=test_data)
84+
7985
def _test_tanh_tosa_ethos_BI_pipeline(
8086
self,
8187
compile_spec: list[CompileSpec],
@@ -114,6 +120,7 @@ def _test_tanh_tosa_u85_BI_pipeline(
114120
)
115121

116122
@parameterized.expand(test_data_suite)
123+
@pytest.mark.tosa_ref_model
117124
def test_tanh_tosa_MI(
118125
self,
119126
test_name: str,
@@ -122,6 +129,7 @@ def test_tanh_tosa_MI(
122129
self._test_tanh_tosa_MI_pipeline(self.Tanh(), (test_data,))
123130

124131
@parameterized.expand(test_data_suite)
132+
@pytest.mark.tosa_ref_model
125133
def test_tanh_tosa_BI(self, test_name: str, test_data: torch.Tensor):
126134
self._test_tanh_tosa_BI_pipeline(self.Tanh(), (test_data,))
127135

backends/arm/test/targets.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def define_arm_tests():
1616
"ops/test_linear.py",
1717
"ops/test_slice.py",
1818
"ops/test_sigmoid.py",
19+
"ops/test_tanh.py",
1920
]
2021

2122
TESTS = {}

backends/cadence/runtime/et_pal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
#if defined(XTENSA)
9+
#if defined(__XTENSA__)
1010

1111
#include <stdio.h>
1212
#include <sys/times.h>

backends/qualcomm/aot/ir/targets.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ load(
44
)
55
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
66
load("@fbsource//xplat/executorch/backends/qualcomm:targets.bzl", "generate_schema_header")
7-
load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_verision")
7+
load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_version")
88

99
QCIR_NAME = "qcir"
1010
INPUT_QCIR = QCIR_NAME + ".fbs"
@@ -56,7 +56,7 @@ def define_common_targets():
5656
platforms = [ANDROID],
5757
visibility = ["@EXECUTORCH_CLIENTS"],
5858
deps = [
59-
"fbsource//third-party/qualcomm/qnn/qnn-{0}:api".format(get_qnn_library_verision()),
59+
"fbsource//third-party/qualcomm/qnn/qnn-{0}:api".format(get_qnn_library_version()),
6060
"//executorch/runtime/backend:interface",
6161
"//executorch/runtime/core:core",
6262
"//executorch/backends/qualcomm/aot/wrappers:wrappers",

backends/qualcomm/aot/python/targets.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ load(
33
"ANDROID",
44
)
55
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
6-
load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_verision")
6+
load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_version")
77

88
PYTHON_MODULE_NAME = "PyQnnManagerAdaptor"
99

@@ -34,7 +34,7 @@ def define_common_targets():
3434
"//executorch/backends/qualcomm/aot/ir:qcir_utils",
3535
"//executorch/backends/qualcomm/runtime:runtime",
3636
"fbsource//third-party/pybind11:pybind11",
37-
"fbsource//third-party/qualcomm/qnn/qnn-{0}:api".format(get_qnn_library_verision()),
37+
"fbsource//third-party/qualcomm/qnn/qnn-{0}:api".format(get_qnn_library_version()),
3838
],
3939
external_deps = [
4040
"libtorch_python",
@@ -67,7 +67,7 @@ def define_common_targets():
6767
"//executorch/backends/qualcomm/aot/ir:qcir_utils",
6868
"//executorch/backends/qualcomm/runtime:runtime",
6969
"fbsource//third-party/pybind11:pybind11",
70-
"fbsource//third-party/qualcomm/qnn/qnn-{0}:api".format(get_qnn_library_verision()),
70+
"fbsource//third-party/qualcomm/qnn/qnn-{0}:api".format(get_qnn_library_version()),
7171
],
7272
external_deps = [
7373
"libtorch_python",
@@ -94,6 +94,6 @@ def define_common_targets():
9494
"//executorch/backends/qualcomm/aot/ir:qcir_utils",
9595
"//executorch/backends/qualcomm/runtime:runtime",
9696
"fbsource//third-party/pybind11:pybind11",
97-
"fbsource//third-party/qualcomm/qnn/qnn-{0}:api".format(get_qnn_library_verision()),
97+
"fbsource//third-party/qualcomm/qnn/qnn-{0}:api".format(get_qnn_library_version()),
9898
],
9999
)

backends/qualcomm/aot/wrappers/targets.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ load(
33
"ANDROID",
44
)
55
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
6-
load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_verision")
6+
load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_version")
77

88
def define_common_targets():
99
"""Defines targets that should be shared between fbcode and xplat.
@@ -23,7 +23,7 @@ def define_common_targets():
2323
platforms = [ANDROID],
2424
visibility = ["@EXECUTORCH_CLIENTS"],
2525
deps = [
26-
"fbsource//third-party/qualcomm/qnn/qnn-{0}:api".format(get_qnn_library_verision()),
26+
"fbsource//third-party/qualcomm/qnn/qnn-{0}:api".format(get_qnn_library_version()),
2727
"//executorch/runtime/backend:interface",
2828
"//executorch/runtime/core:core",
2929
],

backends/qualcomm/builders/README.md

Lines changed: 124 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Thank you for contributing to Qualcomm AI Engine Direct delegate for ExecuTorch.
88
* [Check Operator Spec](#check-operator-spec)
99
* [Implementation](#implementation)
1010
* [Quantizer Annotation](#quantizer-annotation)
11+
* [Operator Support Status](#operator-support-status)
1112
* [Issues](#issues)
1213
* [Pull Requests](#pull-requests)
1314

@@ -246,7 +247,7 @@ Now, we can start to fill in function body step by step:
246247
nodes_to_wrappers,
247248
)
248249
```
249-
The logic should be similar and straightforward. Please carefully set arguments `tensor_type`
250+
The logic should be similar and straightforward. Please carefully set arguments `tensor_type`
250251
according to tensors' property.
251252
252253
3. Define parameters:
@@ -355,6 +356,128 @@ Now, we can start to fill in function body step by step:
355356
### Quantizer Annotation
356357
The operator now should be functional for Qualcomm backends. For operator to work in fixed-precision, we should also make `QnnQuantizer` to correctly insert observers for recording calibrated encodings. Please read more on the [Quantization Annotation Tutorial](../quantizer//README.md).
357358

359+
## Operator Support Status
360+
Please help update following table if you are contributing new operators:
361+
362+
| Operators | HTP - 77/116 Enabled |
363+
|-----------|---------|
364+
| Argmax | &cross; |
365+
| Argmin | &check; |
366+
| BatchNorm | &check; |
367+
| BatchToSpace | &cross; |
368+
| Cast | &check; |
369+
| ChannelShuffle | &cross; |
370+
| Concat | &check; |
371+
| Conv2d | &check; |
372+
| Conv3d | &cross; |
373+
| Convert | &check; |
374+
| CreateSparse | &cross; |
375+
| CumulativeSum | &check; |
376+
| DepthToSpace | &check; |
377+
| DepthWiseConv2d | &check; |
378+
| Dequantize | &check; |
379+
| DetectionOutput | &cross; |
380+
| ElementWiseAbs | &check; |
381+
| ElementWiseAdd | &check; |
382+
| ElementWiseAnd | &check; |
383+
| ElementWiseAsin | &cross; |
384+
| ElementWiseAtan | &cross; |
385+
| ElementWiseBinary | &cross; |
386+
| ElementWiseCeil | &check; |
387+
| ElementWiseCos | &check; |
388+
| ElementWiseDivide | &check; |
389+
| ElementWiseEqual | &check; |
390+
| ElementWiseExp | &check; |
391+
| ElementWiseFloor | &cross; |
392+
| ElementWiseFloorDiv | &cross; |
393+
| ElementWiseGreater | &check; |
394+
| ElementWiseGreaterEqual | &check; |
395+
| ElementWiseLess | &check; |
396+
| ElementWiseLessEqual | &check; |
397+
| ElementWiseLog | &check; |
398+
| ElementWiseMaximum | &check; |
399+
| ElementWiseMinimum | &check; |
400+
| ElementWiseMultiply | &check; |
401+
| ElementWiseNeg | &check; |
402+
| ElementWiseNeuron | &check; |
403+
| ElementWiseNot | &check; |
404+
| ElementWiseNotEqual | &check; |
405+
| ElementWiseOr | &check; |
406+
| ElementWisePower | &check; |
407+
| ElementWiseRound | &cross; |
408+
| ElementWiseRsqrt | &check; |
409+
| ElementWiseSelect | &check; |
410+
| ElementWiseSign | &cross; |
411+
| ElementWiseSin | &check; |
412+
| ElementWiseSquaredDifference | &cross; |
413+
| ElementWiseSquareRoot | &check; |
414+
| ElementWiseSubtract | &check; |
415+
| ElementWiseUnary | &cross; |
416+
| ElementWiseXor | &cross; |
417+
| Elu | &check; |
418+
| ExpandDims | &check; |
419+
| ExtractGlimpse | &cross; |
420+
| ExtractPatches | &cross; |
421+
| FullyConnected | &check; |
422+
| Gather | &check; |
423+
| GatherElements | &cross; |
424+
| GatherNd | &check; |
425+
| Gelu | &check; |
426+
| GetSparseIndices | &cross; |
427+
| GetSparseValues | &cross; |
428+
| GridSample | &cross; |
429+
| GroupNorm | &check; |
430+
| HardSwish | &check; |
431+
| InstanceNorm | &check; |
432+
| L2Norm | &cross; |
433+
| LayerNorm | &check; |
434+
| LogSoftmax | &check; |
435+
| Lrn | &cross; |
436+
| Lstm | &cross; |
437+
| MatMul | &check; |
438+
| MultiClassNms | &cross; |
439+
| NonMaxSuppression | &cross; |
440+
| Nonzero | &cross; |
441+
| OneHot | &cross; |
442+
| Pack | &check; |
443+
| Pad | &check; |
444+
| PoolAvg2d | &check; |
445+
| PoolAvg3d | &cross; |
446+
| PoolMax2d | &check; |
447+
| Prelu | &check; |
448+
| Quantize | &check; |
449+
| ReduceMax | &check; |
450+
| ReduceMean | &check; |
451+
| ReduceMin | &cross; |
452+
| ReduceSum | &check; |
453+
| Relu | &check; |
454+
| Relu1 | &cross; |
455+
| Relu6 | &cross; |
456+
| ReluMinMax | &check; |
457+
| Reshape | &check; |
458+
| Resize | &cross; |
459+
| ResizeBilinear | &check; |
460+
| ResizeNearestNeighbor | &check; |
461+
| RoiAlign | &cross; |
462+
| RmsNorm | &check; |
463+
| ScatterElements | &cross; |
464+
| ScatterNd | &check; |
465+
| Sigmoid | &check; |
466+
| Softmax | &check; |
467+
| SpaceToBatch | &cross; |
468+
| SpaceToDepth | &check; |
469+
| SparseToDense | &cross; |
470+
| Split | &check; |
471+
| Squeeze | &check; |
472+
| StridedSlice | &check; |
473+
| Tanh | &check; |
474+
| Tile | &check; |
475+
| TopK | &check; |
476+
| TransPose | &check; |
477+
| TransPoseConv2d | &check; |
478+
| TransPoseConv3d | &cross; |
479+
| Unpack | &check; |
480+
358481
## Issues
359482
Please refer to the [issue section](../README.md#issues) for more information.
360483

0 commit comments

Comments
 (0)