Skip to content

Commit 7f6a341

Browse files
robellfacebook-github-bot
authored andcommitted
Remove redundant generate_*_compile_spec funcs (#3869)
Summary: tidying up a redundant wrapper function. Pull Request resolved: #3869 Reviewed By: mergennachin Differential Revision: D58301772 Pulled By: digantdesai fbshipit-source-id: cd906e2aa307408e7e2f877ace6544e91cd972fc
1 parent 711ecec commit 7f6a341

File tree

2 files changed

+8
-43
lines changed

2 files changed

+8
-43
lines changed

backends/arm/arm_backend.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -166,43 +166,6 @@ def get_intermediate_path(compile_spec: List[CompileSpec]) -> str:
166166
return None
167167

168168

169-
def generate_ethosu_compile_spec(
170-
config: str,
171-
permute_memory_to_nhwc: Optional[bool] = None,
172-
quantize_io: Optional[bool] = None,
173-
system_config: Optional[str] = None,
174-
memory_mode: Optional[str] = None,
175-
extra_flags: Optional[str] = None,
176-
config_ini: Optional[str] = "Arm/vela.ini",
177-
) -> List[CompileSpec]:
178-
return (
179-
ArmCompileSpecBuilder()
180-
.ethosu_compile_spec(
181-
config,
182-
system_config=system_config,
183-
memory_mode=memory_mode,
184-
extra_flags=extra_flags,
185-
config_ini=config_ini,
186-
)
187-
.set_permute_memory_format(permute_memory_to_nhwc)
188-
.set_quantize_io(quantize_io)
189-
.build()
190-
)
191-
192-
193-
def generate_tosa_compile_spec(
194-
permute_memory_to_nhwc: Optional[bool] = None,
195-
output_path: Optional[str] = None,
196-
) -> List[CompileSpec]:
197-
return (
198-
ArmCompileSpecBuilder()
199-
.tosa_compile_spec()
200-
.set_permute_memory_format(permute_memory_to_nhwc)
201-
.dump_intermediate_artifacts_to(output_path)
202-
.build()
203-
)
204-
205-
206169
@final
207170
class ArmBackend(BackendDetails):
208171
@staticmethod

examples/arm/aot_arm_compiler.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
import logging
1212

1313
import torch
14-
from executorch.backends.arm.arm_backend import generate_ethosu_compile_spec
14+
15+
from executorch.backends.arm.arm_backend import ArmCompileSpecBuilder
1516
from executorch.backends.arm.arm_partitioner import ArmPartitioner
1617
from executorch.backends.arm.quantizer.arm_quantizer import (
1718
ArmQuantizer,
@@ -212,12 +213,13 @@ def forward(self, x):
212213
if args.delegate is True:
213214
edge = edge.to_backend(
214215
ArmPartitioner(
215-
generate_ethosu_compile_spec(
216-
"ethos-u55-128",
217-
permute_memory_to_nhwc=args.model_name
218-
in MODEL_NAME_TO_MODEL.keys(),
219-
quantize_io=True,
216+
ArmCompileSpecBuilder()
217+
.ethosu_compile_spec("ethos-u55-128")
218+
.set_permute_memory_format(
219+
args.model_name in MODEL_NAME_TO_MODEL.keys()
220220
)
221+
.set_quantize_io(True)
222+
.build()
221223
)
222224
)
223225
logging.debug(f"Lowered graph:\n{edge.exported_program().graph}")

0 commit comments

Comments
 (0)