Skip to content

Commit 38165c8

Browse files
committed
Remove quantize_io from compile_spec
quantize_io was only used in arm_partitioner and is not needed there anymore when running the delegate in the graph. Signed-off-by: Erik Lundell <[email protected]> Change-Id: If35fb66cd1204de10d283a0edbe9780970f32cf0
1 parent a10eabd commit 38165c8

File tree

5 files changed

+11
-54
lines changed

5 files changed

+11
-54
lines changed

backends/arm/arm_backend.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def __init__(self):
4949
self.compiler_flags = []
5050
self.output_format = None
5151
self.path_for_intermediates = None
52-
self.quantize_io = False
5352
self.tosa_version = None
5453
self.input_order = None
5554

@@ -116,14 +115,6 @@ def dump_intermediate_artifacts_to(
116115
self.path_for_intermediates = output_path
117116
return self
118117

119-
def set_quantize_io(self, quantize_io: bool = False) -> "ArmCompileSpecBuilder":
120-
"""
121-
Quantization of inputs and dequantization of outputs for cases where
122-
whole graph is quantized and method signature is not of quantized type.
123-
"""
124-
self.quantize_io = quantize_io
125-
return self
126-
127118
def set_input_order(
128119
self, input_order: Optional[str] = None
129120
) -> "ArmCompileSpecBuilder":
@@ -165,9 +156,6 @@ def build(self) -> List[CompileSpec]:
165156
)
166157
)
167158

168-
if self.quantize_io:
169-
self.compile_spec.append(CompileSpec("quantize_io", "True".encode()))
170-
171159
return self.compile_spec
172160

173161

@@ -178,13 +166,6 @@ def is_tosa(compile_spec: List[CompileSpec]) -> bool:
178166
return False
179167

180168

181-
def is_quantize_io(compile_specs: List[CompileSpec]) -> bool:
182-
for spec in compile_specs:
183-
if spec.key == "quantize_io" and spec.value.decode() == "True":
184-
return True
185-
return False
186-
187-
188169
def get_tosa_version(compile_spec: List[CompileSpec]) -> TosaSpecification:
189170
for spec in compile_spec:
190171
if spec.key == "tosa_version":

backends/arm/arm_partitioner.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import torch
1313
from executorch.backends.arm.arm_backend import (
1414
ArmBackend,
15-
is_quantize_io,
1615
) # usort: skip
1716
from executorch.backends.arm.operator_support.tosa_supported_operators import (
1817
TOSASupportedOperators,
@@ -89,9 +88,6 @@ def is_partitioned(node: torch.fx.Node, tag=tag) -> bool:
8988
node.meta["delegation_tag"] = tag
9089
partition_tags[tag] = self.delegation_spec
9190

92-
if not is_quantize_io(self.delegation_spec.compile_specs):
93-
continue
94-
9591
# De-tag outmost q-nodes upwards and dq-nodes downwards.
9692
# De-tag if at least one input/ output is not part of partition.
9793
for node in partition.nodes:

backends/arm/test/common.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from pathlib import Path
1313

1414
from executorch.backends.arm.arm_backend import ArmCompileSpecBuilder
15+
1516
from executorch.exir.backend.compile_spec_schema import CompileSpec
1617

1718

@@ -75,44 +76,38 @@ def get_tosa_compile_spec_unbuilt(
7576
ArmCompileSpecBuilder()
7677
.tosa_compile_spec(tosa_version)
7778
.dump_intermediate_artifacts_to(custom_path)
78-
.set_quantize_io(True)
7979
)
8080

8181
return compile_spec_builder
8282

8383

8484
def get_u55_compile_spec(
85-
quantize_io=True,
8685
custom_path=None,
8786
reorder_inputs=None,
8887
) -> list[CompileSpec]:
8988
"""
9089
Default compile spec for Ethos-U55 tests.
9190
"""
9291
return get_u55_compile_spec_unbuilt(
93-
quantize_io=quantize_io,
9492
custom_path=custom_path,
9593
reorder_inputs=reorder_inputs,
9694
).build()
9795

9896

9997
def get_u85_compile_spec(
100-
quantize_io=True,
10198
custom_path=None,
10299
reorder_inputs=None,
103100
) -> list[CompileSpec]:
104101
"""
105102
Default compile spec for Ethos-U85 tests.
106103
"""
107104
return get_u85_compile_spec_unbuilt(
108-
quantize_io=quantize_io,
109105
custom_path=custom_path,
110106
reorder_inputs=reorder_inputs,
111107
).build()
112108

113109

114110
def get_u55_compile_spec_unbuilt(
115-
quantize_io=True,
116111
custom_path=None,
117112
reorder_inputs=None,
118113
) -> ArmCompileSpecBuilder:
@@ -130,15 +125,13 @@ def get_u55_compile_spec_unbuilt(
130125
memory_mode="Shared_Sram",
131126
extra_flags="--debug-force-regor --output-format=raw",
132127
)
133-
.set_quantize_io(quantize_io)
134128
.dump_intermediate_artifacts_to(artifact_path)
135129
.set_input_order(reorder_inputs)
136130
)
137131
return compile_spec
138132

139133

140134
def get_u85_compile_spec_unbuilt(
141-
quantize_io=True,
142135
custom_path=None,
143136
reorder_inputs=None,
144137
) -> list[CompileSpec]:
@@ -154,7 +147,6 @@ def get_u85_compile_spec_unbuilt(
154147
memory_mode="Shared_Sram",
155148
extra_flags="--output-format=raw",
156149
)
157-
.set_quantize_io(quantize_io)
158150
.dump_intermediate_artifacts_to(artifact_path)
159151
.set_input_order(reorder_inputs)
160152
)

backends/arm/test/ops/test_depthwise_conv.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -259,58 +259,48 @@ def test_dw_conv_tosa_BI(self, test_name: str, model: torch.nn.Module):
259259

260260
@parameterized.expand(testsuite_conv2d[:4], skip_on_empty=True)
261261
@pytest.mark.corstone_fvp
262-
def test_dw_conv2d_u55_BI(
263-
self, test_name: str, model: torch.nn.Module, set_quantize_io: bool = True
264-
):
262+
def test_dw_conv2d_u55_BI(self, test_name: str, model: torch.nn.Module):
265263
self._test_dw_conv_ethos_BI_pipeline(
266264
model,
267-
common.get_u55_compile_spec(quantize_io=set_quantize_io),
265+
common.get_u55_compile_spec(),
268266
model.get_inputs(),
269267
)
270268

271269
@parameterized.expand(testsuite_conv2d[4:], skip_on_empty=True)
272270
@pytest.mark.corstone_fvp
273271
@conftest.expectedFailureOnFVP # TODO: MLETORCH-516
274-
def test_dw_conv2d_u55_BI_xfails(
275-
self, test_name: str, model: torch.nn.Module, set_quantize_io: bool = False
276-
):
272+
def test_dw_conv2d_u55_BI_xfails(self, test_name: str, model: torch.nn.Module):
277273
self._test_dw_conv_ethos_BI_pipeline(
278274
model,
279-
common.get_u55_compile_spec(quantize_io=set_quantize_io),
275+
common.get_u55_compile_spec(),
280276
model.get_inputs(),
281277
)
282278

283279
@parameterized.expand(testsuite_conv1d, skip_on_empty=True)
284280
@pytest.mark.corstone_fvp
285-
def test_dw_conv1d_u55_BI(
286-
self, test_name: str, model: torch.nn.Module, set_quantize_io: bool = True
287-
):
281+
def test_dw_conv1d_u55_BI(self, test_name: str, model: torch.nn.Module):
288282
self._test_dw_conv_ethos_BI_pipeline(
289283
model,
290-
common.get_u55_compile_spec(quantize_io=set_quantize_io),
284+
common.get_u55_compile_spec(),
291285
model.get_inputs(),
292286
)
293287

294288
@parameterized.expand(testsuite_conv1d + testsuite_conv2d_u85)
295289
@pytest.mark.corstone_fvp
296-
def test_dw_conv_u85_BI(
297-
self, test_name: str, model: torch.nn.Module, set_quantize_io: bool = True
298-
):
290+
def test_dw_conv_u85_BI(self, test_name: str, model: torch.nn.Module):
299291
self._test_dw_conv_ethos_BI_pipeline(
300292
model,
301-
common.get_u85_compile_spec(quantize_io=set_quantize_io),
293+
common.get_u85_compile_spec(),
302294
model.get_inputs(),
303295
)
304296

305297
# All test cases except 3x3_1x3x256x256_gp3_st1 have numerical issues on FVP. MLETORCH-520
306298
@parameterized.expand(testsuite_conv2d_u85_xfails)
307299
@pytest.mark.corstone_fvp
308300
@conftest.expectedFailureOnFVP
309-
def test_dw_conv_u85_BI_xfails(
310-
self, test_name: str, model: torch.nn.Module, set_quantize_io: bool = True
311-
):
301+
def test_dw_conv_u85_BI_xfails(self, test_name: str, model: torch.nn.Module):
312302
self._test_dw_conv_ethos_BI_pipeline(
313303
model,
314-
common.get_u85_compile_spec(quantize_io=set_quantize_io),
304+
common.get_u85_compile_spec(),
315305
model.get_inputs(),
316306
)

examples/arm/aot_arm_compiler.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ def get_compile_spec(
273273
memory_mode=memory_mode,
274274
extra_flags="--debug-force-regor --output-format=raw --verbose-operators --verbose-cycle-estimate",
275275
)
276-
.set_quantize_io(True)
277276
.set_input_order(reorder_inputs)
278277
)
279278
elif "ethos-u85" in target:
@@ -285,7 +284,6 @@ def get_compile_spec(
285284
memory_mode=memory_mode,
286285
extra_flags="--output-format=raw --verbose-operators --verbose-cycle-estimate",
287286
)
288-
.set_quantize_io(True)
289287
.set_input_order(reorder_inputs)
290288
)
291289

0 commit comments

Comments
 (0)