Skip to content

Commit 768fee5

Browse files
committed
fix rebase
1 parent c9fdd1e commit 768fee5

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

backends/qualcomm/export_utils.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from executorch.backends.qualcomm.serialization.qc_schema import (
3333
QcomChipset,
3434
QnnExecuTorchBackendType,
35+
QnnExecuTorchHtpPerformanceMode,
3536
QnnExecuTorchOpPackageOptions,
3637
)
3738
from executorch.backends.qualcomm.utils.constants import (
@@ -88,6 +89,7 @@ class QnnConfig:
8889
skip_push: If specified, skip pushing files to device. Assumes all required files are on device already.
8990
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.
9091
seed (int): Set the seed for generating random numbers in both torch and random.
92+
htp_performance_mode (QnnExecuTorchHtpPerformanceMode, optional): Option to set the performance mode for htp backend.
9193
"""
9294

9395
soc_model: str
@@ -111,6 +113,9 @@ class QnnConfig:
111113
skip_push: Optional[bool] = False
112114
ci: Optional[bool] = False
113115
seed: Optional[int] = None
116+
htp_performance_mode: QnnExecuTorchHtpPerformanceMode = (
117+
QnnExecuTorchHtpPerformanceMode.kHtpBurst,
118+
)
114119

115120
def __post_init__(self):
116121
assert self.soc_model, "Please provide the soc_model"
@@ -487,7 +492,8 @@ def build_executorch_binary(
487492
backend_options = {
488493
QnnExecuTorchBackendType.kGpuBackend: generate_gpu_compiler_spec(),
489494
QnnExecuTorchBackendType.kHtpBackend: generate_htp_compiler_spec(
490-
use_fp16=not any([quant_dtype, custom_quantizer])
495+
use_fp16=False if quant_dtype is not None else True,
496+
htp_performance_mode=qnn_config.htp_performance_mode,
491497
),
492498
}[qnn_config.backend]
493499
compile_spec = generate_qnn_executorch_compiler_spec(
@@ -784,6 +790,14 @@ def setup_common_args_and_variables():
784790
type=str,
785791
)
786792

793+
parser.add_argument(
794+
"--htp_performance_mode",
795+
type=int,
796+
choices=list(QnnExecuTorchHtpPerformanceMode),
797+
help="Specify performance mode for htp from 0-8, default to burst(2). For more info, refer to qc_schema.py",
798+
default=2,
799+
)
800+
787801
return parser
788802

789803

0 commit comments

Comments
 (0)