@@ -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"
0 commit comments