diff --git a/backends/arm/arm_backend.py b/backends/arm/arm_backend.py index 8ef5a79d3f..f187191fee 100644 --- a/backends/arm/arm_backend.py +++ b/backends/arm/arm_backend.py @@ -166,43 +166,6 @@ def get_intermediate_path(compile_spec: List[CompileSpec]) -> str: return None -def generate_ethosu_compile_spec( - config: str, - permute_memory_to_nhwc: Optional[bool] = None, - quantize_io: Optional[bool] = None, - system_config: Optional[str] = None, - memory_mode: Optional[str] = None, - extra_flags: Optional[str] = None, - config_ini: Optional[str] = "Arm/vela.ini", -) -> List[CompileSpec]: - return ( - ArmCompileSpecBuilder() - .ethosu_compile_spec( - config, - system_config=system_config, - memory_mode=memory_mode, - extra_flags=extra_flags, - config_ini=config_ini, - ) - .set_permute_memory_format(permute_memory_to_nhwc) - .set_quantize_io(quantize_io) - .build() - ) - - -def generate_tosa_compile_spec( - permute_memory_to_nhwc: Optional[bool] = None, - output_path: Optional[str] = None, -) -> List[CompileSpec]: - return ( - ArmCompileSpecBuilder() - .tosa_compile_spec() - .set_permute_memory_format(permute_memory_to_nhwc) - .dump_intermediate_artifacts_to(output_path) - .build() - ) - - @final class ArmBackend(BackendDetails): @staticmethod diff --git a/examples/arm/aot_arm_compiler.py b/examples/arm/aot_arm_compiler.py index 916a766f7c..f854a081fa 100644 --- a/examples/arm/aot_arm_compiler.py +++ b/examples/arm/aot_arm_compiler.py @@ -11,7 +11,8 @@ import logging import torch -from executorch.backends.arm.arm_backend import generate_ethosu_compile_spec + +from executorch.backends.arm.arm_backend import ArmCompileSpecBuilder from executorch.backends.arm.arm_partitioner import ArmPartitioner from executorch.backends.arm.quantizer.arm_quantizer import ( ArmQuantizer, @@ -212,12 +213,13 @@ def forward(self, x): if args.delegate is True: edge = edge.to_backend( ArmPartitioner( - generate_ethosu_compile_spec( - "ethos-u55-128", - permute_memory_to_nhwc=args.model_name - in MODEL_NAME_TO_MODEL.keys(), - quantize_io=True, + ArmCompileSpecBuilder() + .ethosu_compile_spec("ethos-u55-128") + .set_permute_memory_format( + args.model_name in MODEL_NAME_TO_MODEL.keys() ) + .set_quantize_io(True) + .build() ) ) logging.debug(f"Lowered graph:\n{edge.exported_program().graph}")