Skip to content

Commit 50cee3e

Browse files
committed
Code Review, BC change
1 parent a8e9275 commit 50cee3e

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

backends/qualcomm/utils/utils.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ def generate_lpai_compiler_spec(
11161116
)
11171117

11181118

1119-
def generate_qnn_executorch_compiler_spec(
1119+
def generate_qnn_executorch_compiler_spec( # noqa: C901
11201120
soc_model: QcomChipset,
11211121
backend_options: QnnExecuTorchBackendOptions,
11221122
debug: bool = False,
@@ -1128,6 +1128,9 @@ def generate_qnn_executorch_compiler_spec(
11281128
is_from_context_binary: bool = False,
11291129
op_package_options: QnnExecuTorchOpPackageOptions = None,
11301130
use_mha2sha: bool = False,
1131+
# Deprecated parameters - use profile_level instead
1132+
profile: Optional[bool] = None,
1133+
optrace: Optional[bool] = None,
11311134
) -> List[CompileSpec]:
11321135
"""
11331136
Helper function generating compiler specs for Qualcomm AI Engine Direct
@@ -1170,6 +1173,24 @@ def generate_qnn_executorch_compiler_spec(
11701173
if soc_model not in _supported_soc_models:
11711174
raise ValueError(f"unknown SoC model for QNN: {soc_model}")
11721175

1176+
# Backward compatibility: map deprecated profile/optrace to profile_level
1177+
if optrace is not None:
1178+
warnings.warn(
1179+
"'optrace' is deprecated, use 'profile_level=3' instead.",
1180+
DeprecationWarning,
1181+
stacklevel=2,
1182+
)
1183+
if optrace and profile_level == 0:
1184+
profile_level = 3 # kProfileOptrace
1185+
if profile is not None:
1186+
warnings.warn(
1187+
"'profile' is deprecated, use 'profile_level=2' instead.",
1188+
DeprecationWarning,
1189+
stacklevel=2,
1190+
)
1191+
if profile and profile_level == 0:
1192+
profile_level = 2 # kProfileDetailed
1193+
11731194
if profile_level and dump_intermediate_outputs:
11741195
warnings.warn(
11751196
"It is not recommended to turn on both profiling and dump_intermediate_outputs the same time"

examples/qualcomm/utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
# TODO: reenable pyre after fixing the issues
88
# pyre-ignore-all-errors
9+
10+
# Backward-compatible re-exports for symbols moved to export_utils.
11+
# Internal callers still import from this module.
912
import csv
1013
import inspect
1114
import os
@@ -16,6 +19,13 @@
1619
import numpy as np
1720
import torch
1821
import transformers
22+
from executorch.backends.qualcomm.export_utils import ( # noqa: F401
23+
_ptq_calibrate,
24+
_qat_train,
25+
build_executorch_binary,
26+
make_quantizer,
27+
SimpleADB,
28+
)
1929

2030

2131
def replace_module_with_custom_class(

0 commit comments

Comments
 (0)