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 ,
@@ -512,11 +511,9 @@ def lower_module_and_test_output(
512511 skip_node_id_set = skip_node_id_set ,
513512 skip_node_op_set = skip_node_op_set ,
514513 skip_mutable_buffer = skip_mutable_buffer ,
514+ generate_etrecord = self .enable_profile ,
515515 )
516516
517- # this is needed for the ETRecord as lowering modifies the graph in-place
518- edge_copy = copy .deepcopy (delegated_program )
519-
520517 exec_prog = delegated_program .to_executorch (
521518 exir .ExecutorchBackendConfig (
522519 # For shared buffer, user must pass the memory address
@@ -543,7 +540,7 @@ def lower_module_and_test_output(
543540
544541 etrecord_path = "etrecord.bin"
545542 if self .enable_profile :
546- generate_etrecord ( etrecord_path , edge_copy , exec_prog )
543+ exec_prog . get_etrecord (). save ( etrecord_path )
547544 # Check numerics
548545 if (
549546 assert_output_equal
0 commit comments