From 2f248cf276486f19b87b479e6b75d2f99571e8a9 Mon Sep 17 00:00:00 2001 From: adrianlizarraga Date: Tue, 3 Oct 2023 11:37:31 -0700 Subject: [PATCH] Do not store backend_path_ in QNN EP class --- .../core/providers/qnn/builder/qnn_backend_manager.h | 4 ++-- .../core/providers/qnn/qnn_execution_provider.cc | 11 ++++++----- .../core/providers/qnn/qnn_execution_provider.h | 1 - 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/onnxruntime/core/providers/qnn/builder/qnn_backend_manager.h b/onnxruntime/core/providers/qnn/builder/qnn_backend_manager.h index 449a64a848657..2c2b6ad64206b 100644 --- a/onnxruntime/core/providers/qnn/builder/qnn_backend_manager.h +++ b/onnxruntime/core/providers/qnn/builder/qnn_backend_manager.h @@ -27,11 +27,11 @@ class QnnModel; class QnnBackendManager { public: - QnnBackendManager(std::string backend_path, + QnnBackendManager(std::string&& backend_path, ProfilingLevel profiling_level, uint32_t rpc_control_latency, HtpPerformanceMode htp_performance_mode, - std::string qnn_saver_path = "") + std::string&& qnn_saver_path) : backend_path_(std::move(backend_path)), profiling_level_(profiling_level), rpc_control_latency_(rpc_control_latency), diff --git a/onnxruntime/core/providers/qnn/qnn_execution_provider.cc b/onnxruntime/core/providers/qnn/qnn_execution_provider.cc index 46e561e71e2e3..ec5316eb13ce1 100644 --- a/onnxruntime/core/providers/qnn/qnn_execution_provider.cc +++ b/onnxruntime/core/providers/qnn/qnn_execution_provider.cc @@ -104,9 +104,10 @@ QNNExecutionProvider::QNNExecutionProvider(const ProviderOptions& provider_optio static const std::string BACKEND_PATH = "backend_path"; auto backend_path_pos = runtime_options_.find(BACKEND_PATH); + std::string backend_path; if (backend_path_pos != runtime_options_.end()) { - backend_path_ = backend_path_pos->second; - LOGS_DEFAULT(VERBOSE) << "Backend path: " << backend_path_; + backend_path = backend_path_pos->second; + LOGS_DEFAULT(VERBOSE) << "Backend path: " << backend_path; } else { LOGS_DEFAULT(ERROR) << "No backend path provided."; } @@ -133,7 +134,7 @@ QNNExecutionProvider::QNNExecutionProvider(const ProviderOptions& provider_optio // Enable use of QNN Saver if the user provides a path the QNN Saver backend library. static const std::string QNN_SAVER_PATH_KEY = "qnn_saver_path"; - std::string qnn_saver_path = ""; + std::string qnn_saver_path; auto qnn_saver_path_pos = runtime_options_.find(QNN_SAVER_PATH_KEY); if (qnn_saver_path_pos != runtime_options_.end()) { qnn_saver_path = qnn_saver_path_pos->second; @@ -141,11 +142,11 @@ QNNExecutionProvider::QNNExecutionProvider(const ProviderOptions& provider_optio } qnn_backend_manager_ = std::make_unique( - backend_path_, + std::move(backend_path), profiling_level_, rpc_control_latency_, htp_performance_mode_, - qnn_saver_path); + std::move(qnn_saver_path)); } bool QNNExecutionProvider::IsNodeSupported(qnn::QnnModelWrapper& qnn_model_wrapper, const NodeUnit& node_unit, diff --git a/onnxruntime/core/providers/qnn/qnn_execution_provider.h b/onnxruntime/core/providers/qnn/qnn_execution_provider.h index 2fe507b70a6ab..3827e2044e2b1 100644 --- a/onnxruntime/core/providers/qnn/qnn_execution_provider.h +++ b/onnxruntime/core/providers/qnn/qnn_execution_provider.h @@ -58,7 +58,6 @@ class QNNExecutionProvider : public IExecutionProvider { private: ProviderOptions runtime_options_; - std::string backend_path_; qnn::ProfilingLevel profiling_level_ = qnn::ProfilingLevel::OFF; qnn::HtpPerformanceMode htp_performance_mode_ = qnn::HtpPerformanceMode::kHtpDefault; std::unique_ptr qnn_backend_manager_;