Skip to content

Commit

Permalink
Do not store backend_path_ in QNN EP class
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlizarraga committed Oct 3, 2023
1 parent 296533e commit 2f248cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions onnxruntime/core/providers/qnn/builder/qnn_backend_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
11 changes: 6 additions & 5 deletions onnxruntime/core/providers/qnn/qnn_execution_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.";
}
Expand All @@ -133,19 +134,19 @@ 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;
LOGS_DEFAULT(VERBOSE) << "User specified QNN Saver path: " << qnn_saver_path;
}

qnn_backend_manager_ = std::make_unique<qnn::QnnBackendManager>(
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,
Expand Down
1 change: 0 additions & 1 deletion onnxruntime/core/providers/qnn/qnn_execution_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -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::QnnBackendManager> qnn_backend_manager_;
Expand Down

0 comments on commit 2f248cf

Please sign in to comment.