Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backends/qualcomm/export_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def build_executorch_binary(
),
QnnExecuTorchBackendType.kGpuBackend: generate_gpu_compiler_spec(),
QnnExecuTorchBackendType.kHtpBackend: generate_htp_compiler_spec(
use_fp16=False if quant_dtype is not None else True,
use_fp16=quant_dtype is None and custom_quantizer is None,
htp_performance_mode=qnn_config.htp_performance_mode,
),
Comment thread
psiddh marked this conversation as resolved.
}[qnn_config.backend]
Expand Down
6 changes: 4 additions & 2 deletions examples/qualcomm/custom_op/custom_ops_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ def main(args):
]

# Quantization
quant_dtype = QuantDtype.use_8a8w
# quant_dtype must be None for fp16, otherwise build_executorch_binary
# still lowers as a quantized graph and applies a default quantizer.
if args.use_fp16:
quantizer = None
quant_dtype, quantizer = None, None
else:
quant_dtype = QuantDtype.use_8a8w
quant_cfg = get_ptq_per_channel_quant_config()
custom_quant_annotator = CustomOpsQuantAnnotator()
custom_quant_annotator.register_annotation(
Expand Down
6 changes: 4 additions & 2 deletions examples/qualcomm/custom_op/custom_ops_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ def main(args):
]

# Quantization
quant_dtype = QuantDtype.use_8a8w
# quant_dtype must be None for fp16, otherwise build_executorch_binary
# still lowers as a quantized graph and applies a default quantizer.
if args.use_fp16:
quantizer = None
quant_dtype, quantizer = None, None
else:
quant_dtype = QuantDtype.use_8a8w
quant_cfg = get_ptq_per_channel_quant_config()
custom_quant_annotator = CustomOpsQuantAnnotator()
custom_quant_annotator.register_annotation(
Expand Down
Loading