Skip to content

Commit 157b087

Browse files
committed
fix rebase
1 parent df141b0 commit 157b087

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

backends/qualcomm/export_utils.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
LpaiHardwareVersion,
3434
QcomChipset,
3535
QnnExecuTorchBackendType,
36+
QnnExecuTorchHtpPerformanceMode,
3637
QnnExecuTorchOpPackageOptions,
3738
)
3839
from executorch.backends.qualcomm.utils.constants import (
@@ -93,6 +94,7 @@ class QnnConfig:
9394
skip_push: If specified, skip pushing files to device. Assumes all required files are on device already.
9495
ci (bool): This flag is for Continuous Integration(CI) purpose and is NOT recommended to turn on for typical use cases. It will use random inputs instead of real inputs.
9596
seed (int): Set the seed for generating random numbers in both torch and random.
97+
htp_performance_mode (QnnExecuTorchHtpPerformanceMode, optional): Option to set the performance mode for htp backend.
9698
"""
9799

98100
soc_model: str
@@ -116,6 +118,9 @@ class QnnConfig:
116118
skip_push: Optional[bool] = False
117119
ci: Optional[bool] = False
118120
seed: Optional[int] = None
121+
htp_performance_mode: QnnExecuTorchHtpPerformanceMode = (
122+
QnnExecuTorchHtpPerformanceMode.kHtpBurst,
123+
)
119124

120125
def __post_init__(self):
121126
assert self.soc_model, "Please provide the soc_model"
@@ -522,7 +527,8 @@ def build_executorch_binary(
522527
QnnExecuTorchBackendType.kLpaiBackend: generate_lpai_compiler_spec(),
523528
QnnExecuTorchBackendType.kGpuBackend: generate_gpu_compiler_spec(),
524529
QnnExecuTorchBackendType.kHtpBackend: generate_htp_compiler_spec(
525-
use_fp16=not any([quant_dtype, custom_quantizer])
530+
use_fp16=False if quant_dtype is not None else True,
531+
htp_performance_mode=qnn_config.htp_performance_mode,
526532
),
527533
}[qnn_config.backend]
528534
compile_spec = generate_qnn_executorch_compiler_spec(
@@ -819,6 +825,14 @@ def setup_common_args_and_variables():
819825
type=str,
820826
)
821827

828+
parser.add_argument(
829+
"--htp_performance_mode",
830+
type=int,
831+
choices=list(QnnExecuTorchHtpPerformanceMode),
832+
help="Specify performance mode for htp from 0-8, default to burst(2). For more info, refer to qc_schema.py",
833+
default=2,
834+
)
835+
822836
return parser
823837

824838

backends/qualcomm/tests/test_qnn_delegate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4937,7 +4937,7 @@ def test_qnn_backend_compile_time_option_htp_performance(self):
49374937
htp_performance_mode=QnnExecuTorchHtpPerformanceMode.kHtpHighPowerSaver,
49384938
)
49394939
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
4940-
soc_model=self.chipset_table[TestQNN.model],
4940+
soc_model=self.chipset_table[TestQNN.soc_model],
49414941
backend_options=backend_options,
49424942
)
49434943
module = SimpleModel() # noqa: F405
@@ -5566,7 +5566,7 @@ def test_qnn_backend_compile_time_option_htp_performance(self):
55665566
htp_performance_mode=QnnExecuTorchHtpPerformanceMode.kHtpHighPowerSaver,
55675567
)
55685568
TestQNN.compiler_specs = generate_qnn_executorch_compiler_spec(
5569-
soc_model=self.chipset_table[TestQNN.model],
5569+
soc_model=self.chipset_table[TestQNN.soc_model],
55705570
backend_options=backend_options,
55715571
)
55725572
module = SimpleModel() # noqa: F405

0 commit comments

Comments
 (0)