Skip to content

Commit 185f7b0

Browse files
authored
Merge branch 'main' into export-D72485973
2 parents e3ef2c7 + 5e9e9d1 commit 185f7b0

File tree

18 files changed

+142
-55
lines changed

18 files changed

+142
-55
lines changed

Diff for: .github/release.yml

+43-18
Original file line numberDiff line numberDiff line change
@@ -15,57 +15,82 @@ changelog:
1515
- title: ARM
1616
labels:
1717
- "release notes: arm"
18+
- "module: arm"
19+
- "partner: arm"
1820
- title: NXP
19-
labels:
21+
labels:
2022
- "release notes: nxp"
23+
- "module: nxp"
2124
- title: Exir
22-
labels:
25+
labels:
2326
- "release notes: exir"
27+
- "module: exir"
2428
- title: Misc
25-
labels:
29+
labels:
2630
- "release notes: misc"
2731
- title: Apple
28-
labels:
32+
labels:
2933
- "release notes: apple"
34+
- "module: coreml"
35+
- "module: mps"
36+
- title: Android
37+
labels:
38+
- "module: android"
39+
- title: IOS
40+
labels:
41+
- "module: ios"
3042
- title: Build
31-
labels:
43+
labels:
3244
- "release notes: build"
3345
- title: Vulkan
34-
labels:
46+
labels:
3547
- "release notes: vulkan"
48+
- "module: vulkan"
3649
- title: Cadence
37-
labels:
50+
labels:
3851
- "release notes: cadence"
52+
- "module: cadence"
3953
- title: Runtime
40-
labels:
54+
labels:
4155
- "release notes: runtime"
56+
- "module: runtime"
4257
- title: XNNPACK
43-
labels:
58+
labels:
4459
- "release notes: xnnpack"
60+
- "module: xnnpack"
4561
- title: Devtools
46-
labels:
62+
labels:
4763
- "release notes: devtools"
64+
- "module: devtools"
4865
- title: Examples
49-
labels:
66+
labels:
5067
- "release notes: examples"
68+
- title: LLM
69+
labels:
70+
- "module: llm"
5171
- title: Mediatek
52-
labels:
72+
labels:
5373
- "release notes: mediatek"
74+
- "partner: mediatek"
5475
- title: Openvino
55-
labels:
76+
labels:
5677
- "release notes: openvino"
5778
- title: Qualcomm
58-
labels:
79+
labels:
5980
- "release notes: qualcomm"
81+
- "partner: qualcomm"
82+
- "module: qnn"
6083
- title: Training
61-
labels:
84+
labels:
6285
- "release notes: training"
86+
- "module: training"
6387
- title: Quantization
64-
labels:
88+
labels:
6589
- "release notes: quantization"
6690
- title: Ops & kernels
67-
labels:
68-
- "release notes: ops & kernels"
91+
labels:
92+
- "release notes: ops & kernels"
93+
- "module: kernels"
6994
- title: Other Changes
7095
labels:
7196
- "*"

Diff for: backends/arm/operators/op_eq.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ def define_node(
3434
inputs: List[TosaArg],
3535
output: TosaArg,
3636
) -> None:
37-
assert (
38-
inputs[0].dtype == inputs[1].dtype
39-
), "EQ must have the same dtypes as input"
37+
if inputs[0].dtype != inputs[1].dtype:
38+
raise TypeError(
39+
"All inputs need to have the same data type for operator EQ but got "
40+
f"{inputs[0].dtype=}, {inputs[1].dtype=}"
41+
)
4042

4143
input_nodes = inputs
4244
# Handle quantization

Diff for: backends/arm/operators/op_exp.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ def define_node(
3636
output: TosaArg,
3737
) -> None:
3838

39-
assert len(node.all_input_nodes) == 1
40-
assert inputs[0].dtype == output.dtype == ts.DType.FP32
39+
if len(node.all_input_nodes) != 1:
40+
raise ValueError(
41+
f"Expected 1 input for {self.target}, got {len(node.all_input_nodes)}"
42+
)
43+
if inputs[0].dtype != ts.DType.FP32 or output.dtype != ts.DType.FP32:
44+
raise ValueError(
45+
f"Input and output for {self.target} need to be FP32, got input dtype: "
46+
f"{inputs[0].dtype} and output dtype: {output.dtype}"
47+
)
4148

4249
tosa_graph.addOperator(TosaOp.Op().EXP, [inputs[0].name], [output.name])

Diff for: backends/arm/operators/op_ge.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ def define_node(
3434
inputs: List[TosaArg],
3535
output: TosaArg,
3636
) -> None:
37-
assert (
38-
inputs[0].dtype == inputs[1].dtype
39-
), "GE must have the same dtypes as input"
37+
if inputs[0].dtype != inputs[1].dtype:
38+
raise TypeError(
39+
"All inputs need to have the same data type for operator GE but got "
40+
f"{inputs[0].dtype=}, {inputs[1].dtype=}"
41+
)
4042

4143
input_nodes = inputs
4244
# Handle quantization

Diff for: backends/arm/operators/op_gt.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ def define_node(
3434
inputs: List[TosaArg],
3535
output: TosaArg,
3636
) -> None:
37-
assert (
38-
inputs[0].dtype == inputs[1].dtype
39-
), "GT must have the same dtypes as input"
37+
if inputs[0].dtype != inputs[1].dtype:
38+
raise TypeError(
39+
"All inputs need to have the same data type for operator GT but got "
40+
f"{inputs[0].dtype=}, {inputs[1].dtype=}"
41+
)
4042

4143
input_nodes = inputs
4244
# Handle quantization

Diff for: backends/arm/operators/op_le.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ def define_node(
3434
inputs: List[TosaArg],
3535
output: TosaArg,
3636
) -> None:
37-
assert (
38-
inputs[0].dtype == inputs[1].dtype
39-
), "LE must have the same dtypes as input"
37+
if inputs[0].dtype != inputs[1].dtype:
38+
raise TypeError(
39+
"All inputs need to have the same data type for operator LE but got "
40+
f"{inputs[0].dtype=}, {inputs[1].dtype=}"
41+
)
4042

4143
input_nodes = inputs
4244
# Handle quantization

Diff for: backends/arm/operators/op_lt.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ def define_node(
3434
inputs: List[TosaArg],
3535
output: TosaArg,
3636
) -> None:
37-
assert (
38-
inputs[0].dtype == inputs[1].dtype
39-
), "LT must have the same dtypes as input"
37+
if inputs[0].dtype != inputs[1].dtype:
38+
raise TypeError(
39+
"All inputs need to have the same data type for operator LT but got "
40+
f"{inputs[0].dtype=}, {inputs[1].dtype=}"
41+
)
4042

4143
input_nodes = inputs
4244
# Handle quantization

Diff for: backends/arm/test/ops/test_mm.py

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from typing import Callable
88

9+
import pytest
910
import torch
1011
from executorch.backends.arm.test import common
1112
from executorch.backends.arm.test.tester.test_pipeline import (
@@ -53,6 +54,7 @@ def test_mm_tosa_u55(test_data_generator: Callable[[], tuple]):
5354

5455

5556
@parameterized.expand(MM.test_data_generators)
57+
@pytest.mark.flaky # Investigate flakiness (MLETORCH-870)
5658
def test_mm_tosa_u85(test_data_generator: Callable[[], tuple]):
5759
test_data = test_data_generator()
5860
EthosU85PipelineBI[test_t](MM(), test_data, MM.aten_op, MM.exir_op).run()
@@ -67,6 +69,7 @@ def test_mm_tosa_u55_on_fvp(test_data_generator: Callable[[], tuple]):
6769

6870
@parameterized.expand(MM.test_data_generators)
6971
@common.SkipIfNoCorstone320
72+
@pytest.mark.flaky # Investigate flakiness (MLETORCH-870)
7073
def test_mm_tosa_u85_on_fvp(test_data_generator: Callable[[], tuple]):
7174
test_data = test_data_generator()
7275
EthosU85PipelineBI[test_t](

Diff for: backends/vulkan/op_registry.py

+1
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ def register_binary_op(features: OpFeatures):
277277
exir_ops.edge.aten.rsqrt.default,
278278
exir_ops.edge.aten.tanh.default,
279279
exir_ops.edge.aten.round.default,
280+
exir_ops.edge.aten.leaky_relu.default,
280281
]
281282
)
282283
def register_unary_op(features: OpFeatures):

Diff for: backends/xnnpack/operators/op_slice_copy.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ def define_node(
6969
output_shape = [output_shape[i] for i in PERM_NCHW_TO_NHWC]
7070
dim_of_slice = PERM_NHWC_TO_NCHW[dim_of_slice]
7171

72-
slice_begin_index = cast(int, node.args[2])
72+
slice_begin_index = 0
73+
if len(node.args) > 2 and node.args[2]:
74+
slice_begin_index = cast(int, node.args[2])
7375
if slice_begin_index < 0:
7476
slice_begin_index = input_shape[dim_of_slice] + slice_begin_index
7577

Diff for: backends/xnnpack/test/ops/test_slice_copy.py

+12
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ def forward(self, x):
6969
# Note that two of the slices are optimized away as they are identity.
7070
self._test_slice_copy(ConvSlice(), inputs, 4, 2)
7171

72+
def test_fp32_slice_copy_default_start(self):
73+
"""
74+
XNNPACK supports default start in slice op.
75+
"""
76+
77+
class Slice(torch.nn.Module):
78+
def forward(self, x):
79+
return torch.ops.aten.slice.Tensor(x, 0, None, 2)
80+
81+
inputs = (torch.randn(5, 5),)
82+
self._test_slice_copy(Slice(), inputs, 1, 1)
83+
7284
def test_fp32_slice_copy_stride_non_1(self):
7385
"""
7486
XNNPACK does not support strided slicing.

Diff for: examples/qualcomm/scripts/mobilebert_fine_tune.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
make_output_dir,
2424
make_quantizer,
2525
parse_skip_delegation_node,
26-
QnnPartitioner,
2726
setup_common_args_and_variables,
2827
SimpleADB,
2928
)
@@ -273,19 +272,15 @@ def calibrator(gm):
273272

274273
quantizer = make_quantizer(quant_dtype=quant_dtype)
275274
backend_options = generate_htp_compiler_spec(quant_dtype is not None)
276-
partitioner = QnnPartitioner(
277-
generate_qnn_executorch_compiler_spec(
278-
soc_model=getattr(QcomChipset, args.model),
279-
backend_options=backend_options,
280-
),
281-
skip_node_id_set=skip_node_id_set,
282-
skip_node_op_set=skip_node_op_set,
275+
compiler_specs = generate_qnn_executorch_compiler_spec(
276+
soc_model=getattr(QcomChipset, args.model),
277+
backend_options=backend_options,
283278
)
284279
# skip embedding layer cause it's quantization sensitive
285280
graph_module, _ = skip_annotation(
286281
nn_module=model,
287282
quantizer=quantizer,
288-
partitioner=partitioner,
283+
compiler_specs=compiler_specs,
289284
sample_input=inputs[0],
290285
calibration_cb=calibrator,
291286
fp_node_op_set={torch.ops.aten.embedding.default},

Diff for: extension/parallel/targets.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ def define_common_targets():
1717
"@EXECUTORCH_CLIENTS",
1818
],
1919
deps = [
20-
"//executorch/runtime/kernel:thread_parallel_interface",
20+
"//executorch/extension/threadpool:threadpool",
2121
],
2222
)

Diff for: extension/threadpool/targets.bzl

+33-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def define_common_targets():
2020
] + (["fb/threadpool_use_n_threads.h"] if not runtime.is_oss else [])
2121

2222
runtime.cxx_library(
23-
name = "threadpool",
23+
name = "threadpool_lib",
2424
srcs = _THREADPOOL_SRCS,
2525
deps = [
2626
"//executorch/runtime/core:core",
@@ -45,6 +45,38 @@ def define_common_targets():
4545
],
4646
)
4747

48+
runtime.cxx_library(
49+
name = "threadpool",
50+
# TODO: OSS doesn't have os:iphoneos. Sync buck2 prelude
51+
# update to add it and remove duplication.
52+
exported_deps = (select({
53+
# Major operating systems should be able to use threadpool.
54+
"ovr_config//os:linux": [":threadpool_lib"],
55+
"ovr_config//os:macos": [":threadpool_lib"],
56+
"ovr_config//os:windows": [":threadpool_lib"],
57+
"ovr_config//os:android": [":threadpool_lib"],
58+
"ovr_config//os:iphoneos": [":threadpool_lib"],
59+
# Machines without an operating system shouldn't.
60+
"ovr_config//os:none": ["//executorch/runtime/kernel:thread_parallel_interface"],
61+
# If we don't know what it is, disable threadpool out of caution.
62+
"DEFAULT": ["//executorch/runtime/kernel:thread_parallel_interface"],
63+
}) if not runtime.is_oss else select({
64+
# Major operating systems should be able to use threadpool.
65+
"ovr_config//os:linux": [":threadpool_lib"],
66+
"ovr_config//os:macos": [":threadpool_lib"],
67+
"ovr_config//os:windows": [":threadpool_lib"],
68+
"ovr_config//os:android": [":threadpool_lib"],
69+
# Machines without an operating system shouldn't.
70+
"ovr_config//os:none": ["//executorch/runtime/kernel:thread_parallel_interface"],
71+
# If we don't know what it is, disable threadpool out of caution.
72+
"DEFAULT": ["//executorch/runtime/kernel:thread_parallel_interface"],
73+
})),
74+
visibility = [
75+
"//executorch/...",
76+
"@EXECUTORCH_CLIENTS",
77+
],
78+
)
79+
4880
runtime.cxx_library(
4981
name = "cpuinfo_utils",
5082
srcs = [

Diff for: kernels/optimized/cpu/targets.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ _OPTIMIZED_ATEN_OPS = (
107107
op_target(
108108
name = "op_where",
109109
deps = [
110+
"//executorch/extension/threadpool:threadpool",
110111
"//executorch/kernels/portable/cpu/util:elementwise_util",
111-
"//executorch/runtime/kernel:thread_parallel_interface",
112112
],
113113
),
114114
)

Diff for: kernels/optimized/lib_defs.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,9 @@ def define_libs(is_fbcode=False):
232232
"DEFAULT": [],
233233
}) + LIBBLAS_DEPS,
234234
exported_deps = [
235+
"//executorch/extension/threadpool:threadpool",
235236
"//executorch/kernels/optimized:libutils",
236237
"//executorch/runtime/core/exec_aten:lib",
237-
"//executorch/runtime/kernel:thread_parallel_interface",
238238
],
239239
**get_apple_framework_deps_kwargs(is_fbcode),
240240
)

0 commit comments

Comments
 (0)