Skip to content

Commit 5d63bad

Browse files
authored
Revert "Arm backend: Add --enable_debug_mode to AOT compiler (#14145)" (#14174)
This reverts commit 8c51641. Trying to revert #14111 and this has conflicts.
1 parent 4eae4c9 commit 5d63bad

File tree

3 files changed

+4
-32
lines changed

3 files changed

+4
-32
lines changed

backends/arm/operators/op_abs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ def define_node(
7373
abs_output = output
7474

7575
# Do the INT32 Abs
76-
self._serialize_operator(
77-
node,
78-
tosa_graph,
76+
tosa_graph.addOperator(
7977
ts.TosaOp.Op().ABS,
8078
[
8179
rescaled_inputs[0].name,

backends/arm/operators/op_sum.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ def define_node(
6767
dtype=ts.DType.INT32,
6868
)
6969

70-
self._serialize_operator(
71-
node,
72-
tosa_graph,
70+
tosa_graph.addOperator(
7371
ts.TosaOp.Op().REDUCE_SUM,
7472
[rescaled_inputs[0].name],
7573
[intermediate.name],
@@ -113,9 +111,7 @@ def define_node(
113111
attr = ts.TosaSerializerAttribute()
114112
attr.ReduceSumAttribute(tensor.dim_order.index(dim))
115113

116-
self._serialize_operator(
117-
node,
118-
tosa_graph,
114+
tosa_graph.addOperator(
119115
ts.TosaOp.Op().REDUCE_SUM,
120116
[tensor.name],
121117
[output.name],

examples/arm/aot_arm_compiler.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import torch
2020
from examples.devtools.scripts.export_bundled_program import save_bundled_program
21-
from executorch.backends.arm.common.arm_compile_spec import ArmCompileSpec
2221
from executorch.backends.arm.ethosu import EthosUCompileSpec, EthosUPartitioner
2322
from executorch.backends.arm.quantizer import (
2423
EthosUQuantizer,
@@ -387,7 +386,6 @@ def get_compile_spec(
387386
memory_mode: Optional[str] = None,
388387
quantize: bool = False,
389388
config: Optional[str] = None,
390-
debug_mode: Optional[str] = None,
391389
) -> TosaCompileSpec | EthosUCompileSpec | VgfCompileSpec:
392390
compile_spec = None
393391
if target.startswith("TOSA"):
@@ -416,10 +414,6 @@ def get_compile_spec(
416414
if intermediates is not None:
417415
compile_spec.dump_intermediate_artifacts_to(intermediates)
418416

419-
if debug_mode is not None:
420-
mode = ArmCompileSpec.DebugMode[debug_mode.upper()]
421-
compile_spec.dump_debug_info(mode)
422-
423417
return compile_spec
424418

425419

@@ -607,12 +601,6 @@ def get_args():
607601
action="store_true",
608602
help="Enable the QuantizedOpFusionPass fusion step",
609603
)
610-
parser.add_argument(
611-
"--enable_debug_mode",
612-
required=False,
613-
choices=["json", "tosa"],
614-
help="Flag to enable ATen-to-TOSA debug mode.",
615-
)
616604
args = parser.parse_args()
617605

618606
if args.evaluate and (
@@ -747,7 +735,6 @@ def to_edge_TOSA_delegate(
747735
args.memory_mode,
748736
args.quantize,
749737
args.config,
750-
args.enable_debug_mode,
751738
)
752739

753740
model_int8 = None
@@ -789,7 +776,6 @@ def to_edge_no_delegate(exported_program, args, model: torch.nn.Module, example_
789776
args.memory_mode,
790777
args.quantize,
791778
args.config,
792-
args.enable_debug_mode,
793779
)
794780
model, exported_program = quantize_model(
795781
args, model, example_inputs, compile_spec
@@ -838,21 +824,12 @@ def transform_for_cortex_m_backend(edge, args):
838824
exported_program = torch.export.export(
839825
model, example_inputs, strict=args.strict_export
840826
)
841-
842827
model = exported_program.module()
843828
model_fp32 = model
844829

845-
model_name = os.path.basename(os.path.splitext(args.model_name)[0])
846830
if args.intermediates:
847831
os.makedirs(args.intermediates, exist_ok=True)
848832

849-
# We only support Python3.10 and above, so use a later pickle protocol
850-
torch.export.save(
851-
exported_program,
852-
f"{args.intermediates}/{model_name}_exported_program.pt2",
853-
pickle_protocol=5,
854-
)
855-
856833
# Quantize if required
857834
model_int8 = None
858835
if args.delegate:
@@ -885,6 +862,7 @@ def transform_for_cortex_m_backend(edge, args):
885862
else:
886863
raise e
887864

865+
model_name = os.path.basename(os.path.splitext(args.model_name)[0])
888866
output_name = f"{model_name}" + (
889867
f"_arm_delegate_{args.target}"
890868
if args.delegate is True

0 commit comments

Comments
 (0)