From db8e10b0b9055fa5eacdf8ea07818226ac9fe6a4 Mon Sep 17 00:00:00 2001 From: Edward Chen <18449977+edgchen1@users.noreply.github.com> Date: Fri, 17 Jan 2025 14:35:25 -0800 Subject: [PATCH] Revert "[QNN EP] Clean up correctly from a partial setup (#23320)" (#23420) ### Description This reverts commit 5d215ff810ceb2d6c0726befd61ba7b7f21516c9. ### Motivation and Context The reverted change causes a packaging pipeline to fail due to a crash in one of the E2E Android tests. Reverting this first to fix the pipeline. We should come up with an alternative way to properly do the necessary clean up. --- .../providers/qnn/builder/qnn_backend_manager.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc b/onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc index 69eabe457a..e91fda3251 100644 --- a/onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc +++ b/onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc @@ -1097,35 +1097,39 @@ Status QnnBackendManager::TerminateQnnLog() { } void QnnBackendManager::ReleaseResources() { + if (!backend_setup_completed_) { + return; + } + auto result = ReleaseContext(); if (Status::OK() != result) { - LOGS_DEFAULT(ERROR) << "Failed to ReleaseContext: " << result.ErrorMessage(); + LOGS_DEFAULT(ERROR) << "Failed to ReleaseContext."; } result = ReleaseProfilehandle(); if (Status::OK() != result) { - LOGS_DEFAULT(ERROR) << "Failed to ReleaseProfilehandle: " << result.ErrorMessage(); + LOGS_DEFAULT(ERROR) << "Failed to ReleaseProfilehandle."; } result = ReleaseDevice(); if (Status::OK() != result) { - LOGS_DEFAULT(ERROR) << "Failed to ReleaseDevice: " << result.ErrorMessage(); + LOGS_DEFAULT(ERROR) << "Failed to ReleaseDevice."; } result = ShutdownBackend(); if (Status::OK() != result) { - LOGS_DEFAULT(ERROR) << "Failed to ShutdownBackend: " << result.ErrorMessage(); + LOGS_DEFAULT(ERROR) << "Failed to ShutdownBackend."; } result = TerminateQnnLog(); if (Status::OK() != result) { - LOGS_DEFAULT(ERROR) << "Failed to TerminateQnnLog: " << result.ErrorMessage(); + LOGS_DEFAULT(ERROR) << "Failed to TerminateQnnLog."; } if (backend_lib_handle_) { result = UnloadLib(backend_lib_handle_); if (Status::OK() != result) { - LOGS_DEFAULT(ERROR) << "Failed to unload backend library: " << result.ErrorMessage(); + LOGS_DEFAULT(ERROR) << "Failed to unload backend library."; } }