From 28a00e5e6c9cc691bca6c49d706b7fbf81ba9625 Mon Sep 17 00:00:00 2001 From: hongruichen Date: Sat, 20 Jul 2024 14:10:00 +0800 Subject: [PATCH] fix: try fix QNN_GRAPH_ERROR_INVALID_OP_CONFIG --- ggml/src/ggml-qnn.cpp | 6 ------ ggml/src/ggml-qnn/graph.hpp | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ggml/src/ggml-qnn.cpp b/ggml/src/ggml-qnn.cpp index aadf53c35..3ca0dc607 100644 --- a/ggml/src/ggml-qnn.cpp +++ b/ggml/src/ggml-qnn.cpp @@ -123,12 +123,6 @@ struct ggml_backend_qnn_buffer_type_context { std::string name; }; -// ================================================================================================= -// -// QNN backend internal helper functions -// -// ================================================================================================= - // ================================================================================================= // // implementation of QNN backend for GGML diff --git a/ggml/src/ggml-qnn/graph.hpp b/ggml/src/ggml-qnn/graph.hpp index 2d412dffd..30f96a994 100644 --- a/ggml/src/ggml-qnn/graph.hpp +++ b/ggml/src/ggml-qnn/graph.hpp @@ -101,12 +101,19 @@ public: _tensor_inputs = tensor_inputs; _tensor_outputs = tensor_outputs; - Qnn_OpConfig_t op_config = { /*.version = */ QNN_OPCONFIG_VERSION_1, - /*.v1 = */ { _graph_name.c_str(), QNN_OP_PACKAGE_NAME_QTI_AISW, op_name.c_str(), - (uint32_t)_param_types.size(), _param_types.data(), - (uint32_t)_tensor_inputs.size(), _tensor_inputs.data(), - (uint32_t)_tensor_outputs.size(), _tensor_outputs.data() } }; - auto error = _qnn_interface->qnn_graph_add_node(_graph_handle, op_config); + Qnn_OpConfig_t config = QNN_OPCONFIG_INIT; + config.version = QNN_OPCONFIG_VERSION_1; + auto &op_config = config.v1; + op_config.name = _graph_name.c_str(); + op_config.packageName = QNN_OP_PACKAGE_NAME_QTI_AISW; + op_config.typeName = op_name.c_str(); + op_config.numOfParams = (uint32_t)_param_types.size(); + op_config.params = _param_types.data(); + op_config.numOfInputs = (uint32_t)_tensor_inputs.size(); + op_config.inputTensors = _tensor_inputs.data(); + op_config.numOfOutputs = (uint32_t)_tensor_outputs.size(); + op_config.outputTensors = _tensor_outputs.data(); + auto error = _qnn_interface->qnn_graph_add_node(_graph_handle, config); if (error != QNN_SUCCESS) { auto *error_str = get_qnn_error_string(error); if (error_str) {