Skip to content

Commit 4c2c33f

Browse files
committed
Update
[ghstack-poisoned]
2 parents 97d1fc2 + 1d2a49f commit 4c2c33f

144 files changed

Lines changed: 6366 additions & 1057 deletions

File tree

Some content is hidden

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

.github/workflows/add-unanswered-to-project.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
// List of authors to exclude
2828
const excludedAuthors = new Set([
2929
"nil-is-all", "tanvirislam-meta", "cbilgin", "kimishpatel", "psiddh", "digantdesai", "SS-JIA", "ahmtox", "mcr229",
30-
"shoumikhin", "manuelcandales", "metascroy", "cccclai", "rohansjoshi", "kirklandsign", "abhinaykukkadapu",
31-
"JacobSzwejbka", "Conarnar", "rascani", "lucylq", "larryliu0820", "BujSet", "Gasoonjia", "Juntian777", "guangy10",
30+
"shoumikhin", "manuelcandales", "metascroy", "cccclai", "rohansjoshi", "kirklandsign", "abhinaykukkadapu", "JacobSzwejbka",
31+
"Conarnar", "rascani", "kiymetakdemir", "JCNTH", "lucylq", "larryliu0820", "BujSet", "Gasoonjia", "Juntian777", "guangy10",
3232
"jackzhxng", "GregoryComer", "leafs1", "swolchok", "mergennachin", "tarun292", "byjlw", "jathu", "Jack-Khuu", "georgehong",
33-
"zhenyan-zhang-meta", "silverguo", "harishs88ss", "AlannaBurke", "dbort", "huydhn", "mcremon-meta", "trivedivivek",
34-
"angelayi", "helunwencser", "hsharma35", "zhxchen17", "iseeyuan", "svekars", "nathanaelsee", "dulinriley",
33+
"zhenyan-zhang-meta", "silverguo", "harishs88ss", "AlannaBurke", "Doggeral", "laithsakka", "Reubend", "dbort", "huydhn", "mcremon-meta",
34+
"trivedivivek", "angelayi", "helunwencser", "hsharma35", "zhxchen17", "iseeyuan", "svekars", "nathanaelsee", "dulinriley",
3535
"jerryzh168", "cmodi-meta", "bigfootjon", "sxu", "ydwu4", "Riandy", "tugsbayasgalan", "bsoyluoglu", "yangw-dev",
3636
"YIWENX14", "namanahuja", "yushangdi", "limintang", "pianpwk", "viveknayakatmeta", "andreanicastro", "JakeStevens",
3737
"gmagogsfm", "zonglinpeng", "eigen-k", "derekxu", "salilsdesai", "skrtskrtfb", "pssrawat", "r-barnes",
@@ -50,7 +50,7 @@ jobs:
5050
"mansnils", "martinlsm", "freddan80", "YufengShi-dudu", "tom-arm", "perheld", "Jerry-Ge", "gggekov", "fumchin", "wwwind",
5151
"benkli01", "Tessil", "maddun01", "Michiel-Olieslagers", "armwaheed", "agrima1304", "emmakujala", "annietllnd",
5252
"MatthiasHertel80", "AlexTawseArm", "jmahbs", "morgolock", "Christoffer-JL", "ArmRyan", "xingguo01", "tgonzalezorlandoarm",
53-
"chizkiyahu", "sarah-blades", "itsMarco-G", "usamahz", "Rob-Hughes-Arm",
53+
"chizkiyahu", "sarah-blades", "itsMarco-G", "usamahz", "Rob-Hughes-Arm", "swha815", "FabulousSuperDude",
5454
"haowhsu-quic", "shewu-quic", "winskuo-quic", "chunit-quic", "DannyYuyang-quic", "chuntl", "thchenqti", "jethroqti",
5555
"chenweng-quic", "qti-horodnic", "qti-mmadhava", "quic-boyuc", "zhaoxul-qti",
5656
"cymbalrush", "DenisVieriu97", "billmguo",
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
12
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
23

34
oncall("executorch")
45

5-
runtime.python_library(
6+
fbcode_target(
7+
_kind = runtime.python_library,
68
name = "passes",
79
srcs = [
8-
"replace_view_copy_with_view.py",
10+
"replace_view_copy_with_view.py",
911
],
1012
visibility = [
1113
"//executorch/...",
Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
# LICENSE file in the root directory of this source tree.
55

66
# @noautodeps
7+
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
78
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
89

9-
runtime.python_library(
10+
fbcode_target(
11+
_kind = runtime.python_library,
1012
name = "constants",
1113
srcs = [
1214
"constants.py",
@@ -15,7 +17,8 @@ runtime.python_library(
1517
"//executorch/exir/dialects:lib",
1618
],
1719
)
18-
runtime.python_library(
20+
fbcode_target(
21+
_kind = runtime.python_library,
1922
name = "ao_ext",
2023
srcs = glob([
2124
"ao_ext/*.py",
@@ -28,7 +31,8 @@ runtime.python_library(
2831
],
2932
)
3033

31-
runtime.python_library(
34+
fbcode_target(
35+
_kind = runtime.python_library,
3236
name = "lib",
3337
srcs = [
3438
"__init__.py",
@@ -40,7 +44,8 @@ runtime.python_library(
4044
"//executorch/backends/arm/quantizer:lib",
4145
],
4246
)
43-
runtime.python_library(
47+
fbcode_target(
48+
_kind = runtime.python_library,
4449
name = "common",
4550
srcs = glob(["common/*.py"]),
4651
deps = [
@@ -50,7 +55,8 @@ runtime.python_library(
5055
],
5156
)
5257

53-
runtime.python_library(
58+
fbcode_target(
59+
_kind = runtime.python_library,
5460
name = "arm_compile_spec",
5561
srcs = [
5662
"common/arm_compile_spec.py",
@@ -67,7 +73,8 @@ runtime.python_library(
6773
"//executorch/backends/arm/_passes:passes",
6874
],
6975
)
70-
runtime.python_library(
76+
fbcode_target(
77+
_kind = runtime.python_library,
7178
name = "ethosu",
7279
srcs = [
7380
"ethosu/__init__.py",
@@ -83,11 +90,13 @@ runtime.python_library(
8390
],
8491
)
8592

86-
runtime.python_library(
93+
fbcode_target(
94+
_kind = runtime.python_library,
8795
name = "vgf",
8896
srcs = [
8997
"vgf/__init__.py",
9098
"vgf/_passes/__init__.py",
99+
"vgf/_passes/insert_grid_sampler_grid_dequant_pass.py",
91100
"vgf/_passes/rewrite_grid_sampler_to_tosa_custom.py",
92101
"vgf/backend.py",
93102
"vgf/check_env.py",
@@ -119,7 +128,8 @@ runtime.python_library(
119128
"//executorch/exir:lib",
120129
],
121130
)
122-
runtime.python_library(
131+
fbcode_target(
132+
_kind = runtime.python_library,
123133
name = "public_api",
124134
srcs = ["__init__.py"],
125135
deps = [
@@ -129,7 +139,8 @@ runtime.python_library(
129139
],
130140
)
131141

132-
runtime.python_library(
142+
fbcode_target(
143+
_kind = runtime.python_library,
133144
name = "process_node",
134145
srcs = ["process_node.py"],
135146
deps = [
@@ -141,7 +152,8 @@ runtime.python_library(
141152
"//executorch/exir:lib",
142153
],
143154
)
144-
runtime.python_library(
155+
fbcode_target(
156+
_kind = runtime.python_library,
145157
name = "arm_vela",
146158
srcs = [
147159
"arm_vela.py",
@@ -150,7 +162,8 @@ runtime.python_library(
150162
"fbsource//third-party/pypi/ethos-u-vela:ethos-u-vela",
151163
],
152164
)
153-
runtime.python_library(
165+
fbcode_target(
166+
_kind = runtime.python_library,
154167
name = "arm_model_evaluator",
155168
srcs = [
156169
"util/arm_model_evaluator.py",
@@ -159,7 +172,8 @@ runtime.python_library(
159172
"//caffe2:torch",
160173
]
161174
)
162-
runtime.python_library(
175+
fbcode_target(
176+
_kind = runtime.python_library,
163177
name = "_factory",
164178
srcs = [
165179
"util/_factory.py"

backends/arm/MODELS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Conformer
66
- Deep AutoEncoder
77
- Deit Tiny
8+
- DeepSeek-R1-Distill-Qwen-1.5B
89
- DeepLab v3 (DL3)
910
- DS CNN
1011
- Inception v3 (IC3)
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
12
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
23

3-
runtime.python_library(
4+
fbcode_target(
5+
_kind = runtime.python_library,
46
name = "core",
57
srcs = [
68
"arm_pass.py",
@@ -17,7 +19,8 @@ runtime.python_library(
1719
],
1820
)
1921

20-
runtime.python_library(
22+
fbcode_target(
23+
_kind = runtime.python_library,
2124
name = "arm_pass_manager_base",
2225
srcs = ["arm_pass_manager.py"],
2326
deps = [
@@ -32,7 +35,8 @@ runtime.python_library(
3235
],
3336
)
3437

35-
runtime.python_library(
38+
fbcode_target(
39+
_kind = runtime.python_library,
3640
name = "arm_pass_manager_fb",
3741
srcs = [],
3842
deps = [
@@ -41,7 +45,8 @@ runtime.python_library(
4145
],
4246
)
4347

44-
runtime.python_library(
48+
fbcode_target(
49+
_kind = runtime.python_library,
4550
name = "passes",
4651
srcs = glob(["*.py"], exclude = [
4752
"arm_pass.py",

backends/arm/_passes/arm_pass_manager.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,9 @@ def _tosa_pipeline(
633633
FuseViewCopyTransformPass(),
634634
PropagateViewCopyPermuteDownPass(self.compile_spec, exported_program),
635635
PropagateViewCopyPermuteUpPass(self.compile_spec, exported_program),
636+
# Propagation can leave a binary op with mismatched operand ranks,
637+
# which TOSA rejects; re-match ranks before lowering.
638+
MatchArgRanksPass(exported_program),
636639
RewriteHighRankSingletonPermutePass(),
637640
DecomposePermuteForU55Pass(),
638641
RewriteSlicePass(),
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Copyright 2026 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 collections.abc import Sequence
7+
from typing import cast
8+
9+
from executorch.backends.transforms.aten_to_dialect_pass import (
10+
AtenToDialectPass,
11+
DialectNodeSpec,
12+
)
13+
from executorch.exir.dialects._ops import ops as exir_ops
14+
from torch.fx import Node
15+
16+
17+
def _get_arg(node: Node, index: int, name: str, default=None):
18+
if len(node.args) > index:
19+
return node.args[index]
20+
return node.kwargs.get(name, default)
21+
22+
23+
def _normalize_dim(dim: int, rank: int) -> int:
24+
return (dim + rank) % rank
25+
26+
27+
def _input_rank(node: Node) -> int:
28+
input_node = cast(Node, node.args[0])
29+
return len(input_node.meta["val"].shape)
30+
31+
32+
def _rewrite_cat(node: Node, pass_: AtenToDialectPass) -> DialectNodeSpec:
33+
tensors = cast(Sequence[Node], node.args[0])
34+
dim = _get_arg(node, 1, "dim", 0)
35+
first_tensor = tensors[0]
36+
axis = _normalize_dim(cast(int, dim), len(first_tensor.meta["val"].shape))
37+
return DialectNodeSpec(
38+
exir_ops.backend.tosa.CONCAT.default,
39+
(tensors,),
40+
{"axis": axis},
41+
)
42+
43+
44+
def _rewrite_view_copy(node: Node, pass_: AtenToDialectPass) -> DialectNodeSpec:
45+
return DialectNodeSpec(
46+
exir_ops.backend.tosa.RESHAPE.default,
47+
node.args,
48+
dict(node.kwargs),
49+
)
50+
51+
52+
def _rewrite_repeat(node: Node, pass_: AtenToDialectPass) -> DialectNodeSpec:
53+
return DialectNodeSpec(
54+
exir_ops.backend.tosa.TILE.default,
55+
node.args,
56+
dict(node.kwargs),
57+
)
58+
59+
60+
def _rewrite_permute_copy(node: Node, pass_: AtenToDialectPass) -> DialectNodeSpec:
61+
permutation = list(cast(Sequence[int], _get_arg(node, 1, "dims")))
62+
rank = _input_rank(node)
63+
permutation = [_normalize_dim(dim, rank) for dim in permutation]
64+
return DialectNodeSpec(
65+
exir_ops.backend.tosa.TRANSPOSE.default,
66+
(node.args[0], permutation),
67+
{},
68+
)
69+
70+
71+
def _rewrite_flip(node: Node, pass_: AtenToDialectPass) -> DialectNodeSpec | None:
72+
dims = list(cast(Sequence[int], _get_arg(node, 1, "dims")))
73+
if len(dims) != 1:
74+
return None
75+
76+
return DialectNodeSpec(
77+
exir_ops.backend.tosa.REVERSE.default,
78+
(node.args[0],),
79+
{"axis": _normalize_dim(dims[0], _input_rank(node))},
80+
)
81+
82+
83+
def rewrite_data_layout_operator(
84+
node: Node, pass_: AtenToDialectPass
85+
) -> DialectNodeSpec | None:
86+
match node.target:
87+
case exir_ops.edge.aten.cat.default:
88+
return _rewrite_cat(node, pass_)
89+
case exir_ops.edge.aten.view_copy.default:
90+
return _rewrite_view_copy(node, pass_)
91+
case exir_ops.edge.aten.repeat.default:
92+
return _rewrite_repeat(node, pass_)
93+
case exir_ops.edge.aten.permute_copy.default:
94+
return _rewrite_permute_copy(node, pass_)
95+
case exir_ops.edge.aten.flip.default:
96+
return _rewrite_flip(node, pass_)
97+
case _:
98+
return None

backends/arm/_passes/exir_to_tosa_pass.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
from executorch.backends.arm._passes.aten_to_tosa_activation_functions import (
1010
get_activation_replacement,
1111
)
12+
from executorch.backends.arm._passes.aten_to_tosa_data_layout import (
13+
rewrite_data_layout_operator,
14+
)
1215
from executorch.backends.arm._passes.aten_to_tosa_tensor_operators import (
1316
rewrite_argmax,
1417
rewrite_binary_operator,
@@ -118,3 +121,16 @@ def _get_activation_replacement(
118121
node: Node, pass_: AtenToDialectPass
119122
) -> DialectNodeSpec | None:
120123
return get_activation_replacement(node, pass_)
124+
125+
126+
@register_dialect_substitutions(
127+
exir_ops.edge.aten.cat.default,
128+
exir_ops.edge.aten.flip.default,
129+
exir_ops.edge.aten.permute_copy.default,
130+
exir_ops.edge.aten.repeat.default,
131+
exir_ops.edge.aten.view_copy.default,
132+
)
133+
def _get_data_layout_replacement(
134+
node: Node, pass_: AtenToDialectPass
135+
) -> DialectNodeSpec | None:
136+
return rewrite_data_layout_operator(node, pass_)

backends/arm/_passes/insert_data_layout_casts_pass.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class InsertDataLayoutCastsPass(ArmOpTargetedPass):
3535

3636
_concat_ops = {
3737
exir_ops.edge.aten.cat.default,
38-
exir_ops.edge.aten.concatenate.default,
3938
exir_ops.backend.tosa.CONCAT.default,
4039
}
4140
_single_input_ops = {
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# @noautodeps
2+
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
23
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
34

4-
runtime.python_library(
5+
fbcode_target(
6+
_kind = runtime.python_library,
57
name = "schema",
68
srcs = [
79
"__init__.py",

0 commit comments

Comments
 (0)