44# This source code is licensed under the BSD-style license found in the
55# LICENSE file in the root directory of this source tree.
66import collections
7- import copy
87import os
98import subprocess
109import tempfile
3029 get_soc_to_chipset_map ,
3130 to_edge_transform_and_lower_to_qnn ,
3231)
33- from executorch .devtools import generate_etrecord , Inspector
32+ from executorch .devtools import Inspector
3433from executorch .devtools .inspector ._inspector_utils import TimeScale
3534from executorch .examples .qualcomm .utils import (
3635 generate_inputs ,
@@ -475,11 +474,9 @@ def lower_module_and_test_output(
475474 skip_node_id_set = skip_node_id_set ,
476475 skip_node_op_set = skip_node_op_set ,
477476 skip_mutable_buffer = skip_mutable_buffer ,
477+ generate_etrecord = self .enable_profile ,
478478 )
479479
480- # this is needed for the ETRecord as lowering modifies the graph in-place
481- edge_copy = copy .deepcopy (delegated_program )
482-
483480 exec_prog = delegated_program .to_executorch (
484481 exir .ExecutorchBackendConfig (
485482 # For shared buffer, user must pass the memory address
@@ -506,7 +503,7 @@ def lower_module_and_test_output(
506503
507504 etrecord_path = "etrecord.bin"
508505 if self .enable_profile :
509- generate_etrecord ( etrecord_path , edge_copy , exec_prog )
506+ exec_prog . get_etrecord (). save ( etrecord_path )
510507 # Check numerics
511508 if (
512509 assert_output_equal
0 commit comments