Skip to content

Commit d281d96

Browse files
committed
Merge branch 'main' into gh/SS-JIA/215/orig
* main: [ET-VK] Enable int8 tiled compute shader to be used with buffer tensors (#10415) Revert "Migrate elementwise_util callers to the variants with out_dtypes in template arguments" (#10411) Revert "Save some size in dtype_util when dtype selective build is not in use" (#10410) Generalize view_copy fusion. Add job_arn to benchmark result (#10372) Revert "Minibench refactor (#10376)" (#10405) Revert "Arm backend: Populate __init__.py for quantizer and Arm root" (#10395) Arm backend: Convert assert to throw ValueError in op_log (#10392) Arm backend: Add Tutorial to Example tab on the Docs page (#10386) Arm backend: Update node visitors to support TOSA 1.0 (#10390) Arm backend: Make it easier to generate non delegated/quantized PTEs (#10387) Arm backend: Allow --quantize in non delegated using aot_arm_compiler (#10385) Arm backend: Set REGIONCFG registers of the Ethos-U (#10388)
2 parents 02a1115 + 972c988 commit d281d96

Some content is hidden

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

76 files changed

+1174
-705
lines changed

.github/scripts/extract_benchmark_results.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ def transform(
341341
benchmark_results: List,
342342
benchmark_config: Dict[str, str],
343343
job_name: str,
344+
job_report: Any = {},
344345
) -> List:
345346
"""
346347
Transform the benchmark results into the format writable into the benchmark database
@@ -361,6 +362,7 @@ def transform(
361362
# Just keep a copy of the benchmark config here
362363
"benchmark_config": json.dumps(benchmark_config),
363364
"job_conclusion": "SUCCESS",
365+
"job_arn": job_report.get("arn", ""),
364366
},
365367
},
366368
"model": {
@@ -446,6 +448,7 @@ def transform_failure_record(
446448
"app_type": app_type,
447449
"job_conclusion": result,
448450
"failure_type": level,
451+
"job_arn": report.get("arn", ""),
449452
"job_report": json.dumps(report),
450453
},
451454
},
@@ -512,6 +515,7 @@ def get_benchmark_config(
512515
def extract_benchmark_result_from_artifact(
513516
artifact: Dict[str, Any],
514517
benchmark_config: Dict[str, str],
518+
job_report: Any,
515519
) -> List[Any]:
516520
job_name = artifact.get("job_name", "")
517521
artifact_type = artifact.get("type", "")
@@ -532,7 +536,9 @@ def extract_benchmark_result_from_artifact(
532536
)
533537
if not benchmark_results:
534538
return []
535-
return transform(app_type, benchmark_results, benchmark_config, job_name)
539+
return transform(
540+
app_type, benchmark_results, benchmark_config, job_name, job_report
541+
)
536542

537543

538544
def get_app_type(type: str):
@@ -674,7 +680,7 @@ def process_benchmark_results(content: Any, app: str, benchmark_configs: str):
674680
for job_artifact in job_artifacts:
675681
# generate result for each schema
676682
results = extract_benchmark_result_from_artifact(
677-
job_artifact, benchmark_config
683+
job_artifact, benchmark_config, job_report
678684
)
679685
all_benchmark_results.extend(results)
680686
return all_benchmark_results

backends/arm/__init__.py

-10
This file was deleted.

backends/arm/ethosu_backend.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
import logging
1515
from typing import final, List
1616

17-
from executorch.backends.arm import TOSABackend
18-
1917
from executorch.backends.arm.arm_vela import vela_compile
18+
19+
from executorch.backends.arm.tosa_backend import TOSABackend
2020
from executorch.exir.backend.backend_details import BackendDetails, PreprocessResult
2121
from executorch.exir.backend.compile_spec_schema import CompileSpec
2222
from torch.export.exported_program import ExportedProgram

backends/arm/ethosu_partitioner.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
from executorch.backends.arm.arm_backend import (
1111
is_ethosu,
1212
) # usort: skip
13-
from executorch.backends.arm import EthosUBackend, TOSAPartitioner
13+
from executorch.backends.arm.ethosu_backend import EthosUBackend
14+
from executorch.backends.arm.tosa_partitioner import TOSAPartitioner
1415
from executorch.exir.backend.compile_spec_schema import CompileSpec
1516
from executorch.exir.backend.partitioner import DelegationSpec
1617
from torch.fx.passes.operator_support import OperatorSupportBase

backends/arm/operator_support/to_copy_support.py

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ def is_node_tosa_supported(
7777
) -> bool:
7878
assert node.target in self.targets
7979

80-
assert tosa_spec.support_integer()
8180
supported_dtypes = (
8281
self.ALL_SUPPORTED_TYPES
8382
if tosa_spec.support_float()

backends/arm/operators/op_amax.py

+45-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
#
33
# This source code is licensed under the BSD-style license found in the
44
# LICENSE file in the root directory of this source tree.
5-
from typing import List
5+
from typing import Any, List
66

7-
import tosa_tools.v0_80.serializer.tosa_serializer as ts
87
from executorch.backends.arm._passes.arm_pass_utils import get_first_fake_tensor
98
from executorch.backends.arm.operators.node_visitor import (
109
NodeVisitor,
@@ -15,19 +14,22 @@
1514

1615

1716
@register_node_visitor
18-
class MaxVisitor(NodeVisitor):
17+
class MaxVisitor_0_80(NodeVisitor):
1918
target = "aten.amax.default"
2019

20+
tosa_specs = NodeVisitor.tosa_specs_0_80
21+
2122
def __init__(self, *args):
2223
super().__init__(*args)
2324

2425
def define_node(
2526
self,
2627
node: Node,
27-
tosa_graph: ts.TosaSerializer,
28+
tosa_graph: Any,
2829
inputs: List[TosaArg],
2930
output: TosaArg,
3031
) -> None:
32+
import tosa_tools.v0_80.serializer.tosa_serializer as ts
3133

3234
input = inputs[0]
3335
dim = inputs[1].number
@@ -49,3 +51,42 @@ def define_node(
4951
tosa_graph.addOperator(
5052
ts.TosaOp.Op().REDUCE_MAX, [input.name], [output.name], attr
5153
)
54+
55+
56+
@register_node_visitor
57+
class MaxVisitor(NodeVisitor):
58+
target = "aten.amax.default"
59+
60+
tosa_specs = NodeVisitor.tosa_specs_1_00
61+
62+
def __init__(self, *args):
63+
super().__init__(*args)
64+
65+
def define_node(
66+
self,
67+
node: Node,
68+
tosa_graph: Any,
69+
inputs: List[TosaArg],
70+
output: TosaArg,
71+
) -> None:
72+
import serializer.tosa_serializer as ts
73+
74+
input = inputs[0]
75+
dim = inputs[1].number
76+
77+
if dim < 0:
78+
tensor = get_first_fake_tensor(node)
79+
rank = len(tensor.size())
80+
dim = rank + dim
81+
82+
keep_dims = inputs[2].number
83+
if not keep_dims:
84+
raise RuntimeError(
85+
"TOSA only supports keepdims == True; Did you run the convert_minmax pass?"
86+
)
87+
88+
attr = ts.TosaSerializerAttribute()
89+
attr.ReduceMaxAttribute(axis=input.dim_order.index(dim), nan_mode=1)
90+
tosa_graph.addOperator(
91+
ts.TosaOp.Op().REDUCE_MAX, [input.name], [output.name], attr
92+
)

backends/arm/operators/op_amin.py

+45-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
#
33
# This source code is licensed under the BSD-style license found in the
44
# LICENSE file in the root directory of this source tree.
5-
from typing import List
5+
from typing import Any, List
66

7-
import tosa_tools.v0_80.serializer.tosa_serializer as ts
87
from executorch.backends.arm._passes.arm_pass_utils import get_first_fake_tensor
98
from executorch.backends.arm.operators.node_visitor import (
109
NodeVisitor,
@@ -15,19 +14,22 @@
1514

1615

1716
@register_node_visitor
18-
class MinVisitor(NodeVisitor):
17+
class MinVisitor_0_80(NodeVisitor):
1918
target = "aten.amin.default"
2019

20+
tosa_specs = NodeVisitor.tosa_specs_0_80
21+
2122
def __init__(self, *args):
2223
super().__init__(*args)
2324

2425
def define_node(
2526
self,
2627
node: Node,
27-
tosa_graph: ts.TosaSerializer,
28+
tosa_graph: Any,
2829
inputs: List[TosaArg],
2930
output: TosaArg,
3031
) -> None:
32+
import tosa_tools.v0_80.serializer.tosa_serializer as ts
3133

3234
input = inputs[0]
3335
dim = inputs[1].number
@@ -49,3 +51,42 @@ def define_node(
4951
tosa_graph.addOperator(
5052
ts.TosaOp.Op().REDUCE_MIN, [input.name], [output.name], attr
5153
)
54+
55+
56+
@register_node_visitor
57+
class MinVisitor(NodeVisitor):
58+
target = "aten.amin.default"
59+
60+
tosa_specs = NodeVisitor.tosa_specs_1_00
61+
62+
def __init__(self, *args):
63+
super().__init__(*args)
64+
65+
def define_node(
66+
self,
67+
node: Node,
68+
tosa_graph: Any,
69+
inputs: List[TosaArg],
70+
output: TosaArg,
71+
) -> None:
72+
import serializer.tosa_serializer as ts
73+
74+
input = inputs[0]
75+
dim = inputs[1].number
76+
77+
if dim < 0:
78+
tensor = get_first_fake_tensor(node)
79+
rank = len(tensor.size())
80+
dim = rank + dim
81+
82+
keep_dims = inputs[2].number
83+
if not keep_dims:
84+
raise RuntimeError(
85+
"TOSA only supports keepdims == True; Did you run the convert_minmax pass?"
86+
)
87+
88+
attr = ts.TosaSerializerAttribute()
89+
attr.ReduceMinAttribute(axis=input.dim_order.index(dim), nan_mode=1)
90+
tosa_graph.addOperator(
91+
ts.TosaOp.Op().REDUCE_MIN, [input.name], [output.name], attr
92+
)

0 commit comments

Comments
 (0)