Skip to content
Merged
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
7 changes: 6 additions & 1 deletion backends/qualcomm/builders/op_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
from typing import Dict

import executorch.backends.qualcomm.python.PyQnnManagerAdaptor as PyQnnManager
Expand Down Expand Up @@ -242,6 +243,10 @@ def define_node(
node: torch.fx.Node,
nodes_to_wrappers: Dict[torch.fx.Node, PyQnnManager.TensorWrapper],
) -> PyQnnManager.PyQnnOpWrapper:
if is_qnn_sdk_version_less_than("2.48"):
# The optimized pattern requires QNN 2.48+. Resolving the SDK version
# relies on QNN_SDK_ROOT; when it is unavailable (e.g. AOT-only
# environments) fall back to the legacy lowering, which is valid on all
# QNN versions.
if not os.environ.get("QNN_SDK_ROOT") or is_qnn_sdk_version_less_than("2.48"):
return self.define_node_legacy(node, nodes_to_wrappers)
Comment on lines +246 to 251
return self.define_node_optimize(node, nodes_to_wrappers)
7 changes: 6 additions & 1 deletion backends/qualcomm/utils/check_qnn_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ def _get_qnn_host_lib_dir_name() -> str:


def get_sdk_build_id():
qnn_sdk_root = os.environ.get("QNN_SDK_ROOT")
if not qnn_sdk_root:
raise EnvironmentError(
"QNN_SDK_ROOT must be set to query the QNN SDK build id."
)
htp_library_path = os.path.join(
os.environ.get("QNN_SDK_ROOT", None),
qnn_sdk_root,
"lib",
_get_qnn_host_lib_dir_name(),
get_qnn_lib_name("QnnHtp"),
Expand Down
Loading