Skip to content

Commit 1a86d54

Browse files
committed
Update base for Update on "[ExecuTorch] Add broadcasting support to optimized op_div"
Summary: Similar to broadcast support in op_mul Test Plan: Tests added Reviewers: Subscribers: Tasks: Tags: cc larryliu0820 manuelcandales Differential Revision: [D69491815](https://our.internmc.facebook.com/intern/diff/D69491815) [ghstack-poisoned]
2 parents 036f8d4 + 8148603 commit 1a86d54

File tree

87 files changed

+1199
-699
lines changed

Some content is hidden

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

87 files changed

+1199
-699
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ cmake_dependent_option(
245245
)
246246

247247
if(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR)
248-
set(EXECUTORCH_BUILF_EXTENSION_DATA_LOADER ON)
248+
set(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON)
249249
endif()
250250

251251
if(EXECUTORCH_BUILD_EXTENSION_TRAINING)
@@ -348,6 +348,7 @@ if(EXECUTORCH_BUILD_PTHREADPOOL)
348348
endif()
349349

350350
if(EXECUTORCH_BUILD_TESTS)
351+
set(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON)
351352
include(CTest)
352353
endif()
353354

@@ -373,7 +374,7 @@ if(NOT "${_repo_dir_name}" STREQUAL "executorch")
373374
"fix for this restriction."
374375
)
375376
endif()
376-
set(_common_include_directories ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/runtime/core/portable_type)
377+
set(_common_include_directories ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/runtime/core/portable_type/c10)
377378

378379
#
379380
# The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE}.

backends/apple/coreml/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ target_include_directories(
134134
coremldelegate PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/util
135135
)
136136
target_include_directories(coremldelegate PRIVATE ${EXECUTORCH_ROOT}/..)
137-
target_include_directories(coremldelegate PRIVATE ${EXECUTORCH_ROOT}/runtime/core/portable_type)
137+
target_include_directories(coremldelegate PRIVATE ${EXECUTORCH_ROOT}/runtime/core/portable_type/c10)
138138
target_compile_definitions(coremldelegate PRIVATE C10_USING_CUSTOM_GENERATED_MACROS)
139139
target_link_libraries(coremldelegate PRIVATE executorch_core)
140140

backends/apple/coreml/runtime/workspace/executorchcoreml.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@
922922
"$(SRCROOT)/../kvstore",
923923
"$(SRCROOT)/../inmemoryfs",
924924
"$(SRCROOT)/../include",
925-
"$(SRCROOT)/../include/executorch/runtime/core/portable_type",
925+
"$(SRCROOT)/../include/executorch/runtime/core/portable_type/c10",
926926
"$(SRCROOT)/../sdk",
927927
"$(SRCROOT)/../util",
928928
"$(SRCROOT)/../../third-party/nlohmann_json/single_include",
@@ -954,7 +954,7 @@
954954
"$(SRCROOT)/../kvstore",
955955
"$(SRCROOT)/../inmemoryfs",
956956
"$(SRCROOT)/../include",
957-
"$(SRCROOT)/../include/executorch/runtime/core/portable_type",
957+
"$(SRCROOT)/../include/executorch/runtime/core/portable_type/c10",
958958
"$(SRCROOT)/../sdk",
959959
"$(SRCROOT)/../util",
960960
"$(SRCROOT)/../../third-party/nlohmann_json/single_include",

backends/arm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ endif()
1414

1515
include(${EXECUTORCH_ROOT}/build/Utils.cmake)
1616

17-
set(_common_include_directories ${EXECUTORCH_ROOT}/.. ${EXECUTORCH_ROOT}/runtime/core/portable_type)
17+
set(_common_include_directories ${EXECUTORCH_ROOT}/.. ${EXECUTORCH_ROOT}/runtime/core/portable_type/c10)
1818
add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS)
1919

2020
# Third-party folder and Ethos-U driver inclued

backends/arm/TARGETS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
44
python_library(
55
name = "arm_partitioner",
66
srcs = [
7-
"arm_partitioner.py",
7+
"ethosu_backend.py",
8+
"ethosu_partitioner.py",
9+
"tosa_backend.py",
10+
"tosa_partitioner.py",
811
],
912
typing = True,
1013
deps = [

backends/arm/_passes/arm_pass_manager.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
from executorch.backends.arm._passes.fuse_quantized_activation_pass import ( # type: ignore[import-not-found]
5353
FuseQuantizedActivationPass,
5454
)
55-
from executorch.backends.arm._passes.insert_rescales_pass import InsertRescalePass
5655
from executorch.backends.arm._passes.insert_table_ops import InsertTableOpsPass
5756
from executorch.backends.arm._passes.keep_dims_false_to_squeeze_pass import (
5857
KeepDimsFalseToSqueezePass,
@@ -76,7 +75,6 @@
7675
UnsqueezeScalarPlaceholdersPass,
7776
)
7877
from executorch.backends.arm.tosa_specification import TosaSpecification
79-
8078
from executorch.backends.xnnpack._passes.remove_getitem_op import RemoveGetItemPass
8179
from executorch.exir import ExportedProgram
8280
from executorch.exir.pass_manager import PassManager
@@ -121,7 +119,7 @@ def _tosa_080_BI_pipeline(self, exported_program: ExportedProgram) -> GraphModul
121119
self.add_pass(ConvertSqueezesToViewPass())
122120

123121
self.add_pass(AnnotateChannelsLastDimOrder())
124-
self.add_pass(InsertRescalePass())
122+
125123
return self._transform(exported_program.graph_module)
126124

127125
def _tosa_080_MI_pipeline(self, exported_program: ExportedProgram) -> GraphModule:
@@ -159,7 +157,6 @@ def _tosa_080_MI_pipeline(self, exported_program: ExportedProgram) -> GraphModul
159157
self.add_pass(ConvertSqueezesToViewPass())
160158

161159
self.add_pass(AnnotateChannelsLastDimOrder())
162-
self.add_pass(InsertRescalePass())
163160

164161
return self._transform(exported_program.graph_module)
165162

backends/arm/_passes/fold_qdq_with_annotated_qparams_pass.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,6 @@ def call(self, graph_module: GraphModule) -> PassResult:
131131
n = cast(Node, n)
132132
if n.op != "call_function":
133133
continue
134-
# Don't fold chains of quant-ops into each other.
135-
if n.target in (q_op, dq_op):
136-
continue
137134

138135
# Make sure we haven't already set qparams meta information on the node
139136
assert "input_qparams" not in n.meta.keys()

backends/arm/_passes/insert_rescales_pass.py

Lines changed: 0 additions & 109 deletions
This file was deleted.

backends/arm/operators/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
op_reciprocal,
3232
op_relu,
3333
op_repeat,
34-
op_rescale,
3534
op_rshift,
3635
op_rsqrt,
3736
op_sigmoid,

backends/arm/operators/op_rescale.py

Lines changed: 0 additions & 70 deletions
This file was deleted.

backends/arm/runtime/targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def define_common_targets():
1212
)
1313
runtime.cxx_library(
1414
name = "arm_backend",
15-
srcs = ["ArmBackendEthosU.cpp"],
15+
srcs = ["EthosUBackend.cpp"],
1616
headers = [],
1717
compatible_with = ["ovr_config//cpu:arm32-embedded"],
1818
# arm_executor_runner.cpp needs to compile with executor as whole

backends/arm/test/ops/test_add.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,13 @@
99
from typing import Tuple
1010

1111
import torch
12-
from executorch.backends.arm.arm_backend import get_tosa_version
13-
from executorch.backends.arm.quantizer import arm_quantizer
1412
from executorch.backends.arm.test import common
1513
from executorch.backends.arm.test.tester.test_pipeline import (
1614
EthosU55PipelineBI,
1715
EthosU85PipelineBI,
1816
TosaPipelineBI,
1917
TosaPipelineMI,
2018
)
21-
from executorch.backends.xnnpack.test.tester import Quantize
22-
from torch.ao.quantization.observer import HistogramObserver
23-
from torch.ao.quantization.quantizer import QuantizationSpec
24-
2519

2620
aten_op = "torch.ops.aten.add.Tensor"
2721
exir_op = "executorch_exir_dialects_edge__ops_aten_add_Tensor"
@@ -73,38 +67,6 @@ def test_add_tosa_BI(test_data: input_t1):
7367
pipeline.run()
7468

7569

76-
@common.parametrize("test_data", Add.test_data)
77-
def test_add_i32_tosa_BI(test_data: input_t1):
78-
pipeline = TosaPipelineBI[input_t1](Add(), test_data, aten_op, exir_op)
79-
80-
# Create a quantizer with int8 quantization on the input and output but int32 on everything else.
81-
quantizer = arm_quantizer.ArmQuantizer(
82-
get_tosa_version(common.get_tosa_compile_spec("TOSA-0.80+BI"))
83-
)
84-
quantizer.set_io(arm_quantizer.get_symmetric_quantization_config())
85-
observer_options = {"eps": 2**-16}
86-
observer = HistogramObserver.with_args(**observer_options)
87-
input_act_qspec = QuantizationSpec(
88-
torch.int32,
89-
observer,
90-
qscheme=torch.per_tensor_symmetric,
91-
quant_max=2**31 - 1,
92-
quant_min=-(2**31),
93-
)
94-
# This quantization_config will be set as global config.
95-
quantization_config = arm_quantizer.QuantizationConfig(
96-
input_act_qspec, None, None, None
97-
)
98-
quantize_stage = Quantize(quantizer, quantization_config)
99-
pipeline.change_args("quantize", quantize_stage)
100-
101-
# Check that we get the additional (dq -> q
102-
pipeline.add_stage_after(
103-
"export", pipeline.tester.check_count, {"torch.ops.quantized_decomposed": 8}
104-
)
105-
pipeline.run()
106-
107-
10870
@common.parametrize("test_data", Add.test_data)
10971
def test_add_u55_BI(test_data: input_t1):
11072
pipeline = EthosU55PipelineBI[input_t1](

0 commit comments

Comments
 (0)