fix qnn only build flag

This commit is contained in:
hongruichen 2025-05-08 19:53:04 +08:00
parent 0ce53ce7cd
commit 02af8ff653
3 changed files with 4 additions and 25 deletions

View File

@ -48,7 +48,6 @@ add_subdirectory(shared)
if(GGML_HEXAGON_NPU_ONLY)
message("GGML_HEXAGON_NPU_ONLY is enabled")
add_compile_definitions(GGML_HEXAGON_NPU_ONLY)
set(GGML_QNN_ENABLE_HEXAGON_BACKEND ON)
else()
message("GGML_HEXAGON_NPU_ONLY is disabled")

View File

@ -323,30 +323,6 @@ bool qnn_instance::qnn_init(const QnnSaver_Config_t ** saver_config) {
}
}
{
auto & op_package_info = get_op_package_lib_info(_soc_info.soc_model, _soc_info.htp_arch);
if (op_package_info.extra_lib_name) {
_custom_op_extra_lib_handle =
load_lib_with_fallback(op_package_info.extra_lib_name, _additional_lib_load_path);
}
qnn_status = _qnn_interface->qnn_backend_register_op_package(_qnn_backend_handle, op_package_info.lib_name,
op_package_info.interface, op_package_info.type);
if (qnn_status != QNN_SUCCESS) {
QNN_LOG_WARN("failed to register op package %s, interface: %s, error: %s\n", op_package_info.lib_name,
op_package_info.interface, qnn::get_qnn_error_string(qnn_status));
} else {
QNN_LOG_DEBUG("register op package %s successfully, ID %u\n", op_package_info.lib_name,
_qnn_interface->get_backend_id());
_has_custom_op_package = true;
}
}
/* TODO: not used, keep it for further usage
QnnContext_Config_t qnn_context_config = QNN_CONTEXT_CONFIG_INIT;
qnn_context_config.priority = QNN_PRIORITY_DEFAULT;
const QnnContext_Config_t * context_configs[] = {&qnn_context_config, nullptr};
*/
_qnn_interface->qnn_context_create(_qnn_backend_handle, _qnn_device_handle, nullptr, &_qnn_context_handle);
if (!_qnn_context_handle) {
QNN_LOG_WARN("failed to initialize qnn context\n");

View File

@ -12,6 +12,10 @@ target_include_directories(runtime-common PUBLIC
${CMAKE_CURRENT_LIST_DIR}/../../../include/ # TODO: figure out how to remove this
)
if(GGML_HEXAGON_NPU_ONLY)
add_compile_definitions(GGML_HEXAGON_NPU_ONLY)
endif()
if(GGML_QNN_ENABLE_HEXAGON_BACKEND)
if(DEFINED ENV{QNN_SDK_PATH})
set(HEXAGON_SDK_ROOT $ENV{HEXAGON_SDK_ROOT})