Skip to content

Commit 5dca304

Browse files
committed
Update
[ghstack-poisoned]
2 parents 4a202bc + e2f8624 commit 5dca304

File tree

68 files changed

+1999
-608
lines changed

Some content is hidden

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

68 files changed

+1999
-608
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-macos.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ ${CONDA_RUN} --no-capture-output \
4141
PYTHON_EXECUTABLE=python ./examples/models/llama3_2_vision/install_requirements.sh
4242

4343
if [[ "$BUILD_TOOL" == "cmake" ]]; then
44-
.ci/scripts/unittest-macos-cmake.sh "$BUILD_MODE"
44+
.ci/scripts/unittest-macos-cmake.sh
4545
elif [[ "$BUILD_TOOL" == "buck2" ]]; then
46-
.ci/scripts/unittest-buck2.sh "$BUILD_MODE"
46+
.ci/scripts/unittest-buck2.sh
4747
else
4848
echo "Unknown build tool $BUILD_TOOL"
4949
exit 1

.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/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:

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]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2025 Arm Limited and/or its affiliates.
2+
#
3+
# This source code is licensed under the BSD-style license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
from typing import Tuple
7+
8+
from executorch.exir.dialects._ops import ops as exir_ops
9+
from executorch.exir.pass_base import ExportPass
10+
11+
edge_operators = {
12+
exir_ops.edge.aten.hardtanh.default,
13+
exir_ops.edge.aten.relu.default,
14+
}
15+
16+
17+
def get_clamp_params(op, args) -> Tuple[float | None, float | None]:
18+
if op == exir_ops.edge.aten.hardtanh.default:
19+
return args[1], args[2]
20+
elif op == exir_ops.edge.aten.relu.default:
21+
return 0.0, None
22+
else:
23+
raise ValueError(f"Getting clamp parameters for op {op} is not implemented.")
24+
25+
26+
class ConvertToClampPass(ExportPass):
27+
def call_operator(self, op, args, kwargs, meta):
28+
if op not in edge_operators:
29+
return super().call_operator(op, args, kwargs, meta)
30+
31+
return super().call_operator(
32+
exir_ops.edge.aten.clamp.default,
33+
(args[0], *get_clamp_params(op, args)),
34+
{},
35+
meta,
36+
)

backends/arm/_passes/decompose_select.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ def call(self, graph_module: torch.fx.GraphModule):
3535
input_node, dim, index = node.args
3636

3737
rank = len(input_node.meta["val"].size())
38+
shape = input_node.meta["val"].shape
3839
dim = dim % rank if dim < 0 else dim
39-
index = index % rank if index < 0 else index
40+
index = index % shape[dim] if index < 0 else index
4041

4142
with graph_module.graph.inserting_before(node):
4243
slice_node = create_node(

backends/arm/_passes/insert_table_ops.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class InsertTableOpsPass(ExportPass):
3939

4040
table_ops: Dict[EdgeOpOverload, Callable[[torch.Tensor], torch.Tensor]] = {
4141
exir_ops.edge.aten.exp.default: torch.exp,
42+
exir_ops.edge.aten.floor.default: torch.floor,
4243
exir_ops.edge.aten.log.default: torch.log,
4344
exir_ops.edge.aten.reciprocal.default: torch.reciprocal,
4445
exir_ops.edge.aten.rsqrt.default: torch.rsqrt,

backends/arm/operator_support/tosa_supported_operators.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class BaseTOSASupportList(OperatorSupportBase):
9191

9292
def is_node_supported(self, submodules, node: fx.Node) -> bool:
9393
supported = node.op == "call_function" and node.target in [
94+
exir_ops.edge.aten.abs.default,
9495
exir_ops.edge.aten.add.Tensor,
9596
exir_ops.edge.aten.expand_copy.default,
9697
exir_ops.edge.aten.cat.default,
@@ -106,6 +107,7 @@ def is_node_supported(self, submodules, node: fx.Node) -> bool:
106107
exir_ops.edge.aten.log.default,
107108
exir_ops.edge.aten.linear.default,
108109
exir_ops.edge.aten.split_with_sizes_copy.default,
110+
exir_ops.edge.aten.floor.default,
109111
exir_ops.edge.aten.full.default,
110112
exir_ops.edge.aten.full_like.default,
111113
exir_ops.edge.aten.ge.Tensor,

backends/arm/operators/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from . import ( # noqa
99
node_visitor,
10+
op_abs,
1011
op_add,
1112
op_avg_pool2d,
1213
op_bmm,
@@ -20,7 +21,6 @@
2021
op_ge,
2122
op_get_item,
2223
op_gt,
23-
op_hardtanh,
2424
op_le,
2525
op_log,
2626
op_lt,
@@ -30,7 +30,6 @@
3030
op_mul,
3131
op_permute,
3232
op_reciprocal,
33-
op_relu,
3433
op_repeat,
3534
op_rescale,
3635
op_rshift,
@@ -47,4 +46,5 @@
4746
op_upsample_nearest2d,
4847
op_view,
4948
ops_binary,
49+
ops_unary,
5050
)

0 commit comments

Comments
 (0)