Skip to content

Commit 5d215ff

Browse files
authored
[QNN EP] Clean up correctly from a partial setup (microsoft#23320)
### Description Fix bug in previous change where a failure during `SetupBackend` causes `ReleaseResources `to be called to clean up but does nothing because `backend_setup_completed_ ` is false. `backend_setup_completed_ ` _seems_ to now be redundant so removing it fixes the problem. ### Motivation and Context We are seeing crashes due to the log callback failing to be de-registered
1 parent ab59e9e commit 5d215ff

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,39 +1097,35 @@ Status QnnBackendManager::TerminateQnnLog() {
10971097
}
10981098

10991099
void QnnBackendManager::ReleaseResources() {
1100-
if (!backend_setup_completed_) {
1101-
return;
1102-
}
1103-
11041100
auto result = ReleaseContext();
11051101
if (Status::OK() != result) {
1106-
LOGS_DEFAULT(ERROR) << "Failed to ReleaseContext.";
1102+
LOGS_DEFAULT(ERROR) << "Failed to ReleaseContext: " << result.ErrorMessage();
11071103
}
11081104

11091105
result = ReleaseProfilehandle();
11101106
if (Status::OK() != result) {
1111-
LOGS_DEFAULT(ERROR) << "Failed to ReleaseProfilehandle.";
1107+
LOGS_DEFAULT(ERROR) << "Failed to ReleaseProfilehandle: " << result.ErrorMessage();
11121108
}
11131109

11141110
result = ReleaseDevice();
11151111
if (Status::OK() != result) {
1116-
LOGS_DEFAULT(ERROR) << "Failed to ReleaseDevice.";
1112+
LOGS_DEFAULT(ERROR) << "Failed to ReleaseDevice: " << result.ErrorMessage();
11171113
}
11181114

11191115
result = ShutdownBackend();
11201116
if (Status::OK() != result) {
1121-
LOGS_DEFAULT(ERROR) << "Failed to ShutdownBackend.";
1117+
LOGS_DEFAULT(ERROR) << "Failed to ShutdownBackend: " << result.ErrorMessage();
11221118
}
11231119

11241120
result = TerminateQnnLog();
11251121
if (Status::OK() != result) {
1126-
LOGS_DEFAULT(ERROR) << "Failed to TerminateQnnLog.";
1122+
LOGS_DEFAULT(ERROR) << "Failed to TerminateQnnLog: " << result.ErrorMessage();
11271123
}
11281124

11291125
if (backend_lib_handle_) {
11301126
result = UnloadLib(backend_lib_handle_);
11311127
if (Status::OK() != result) {
1132-
LOGS_DEFAULT(ERROR) << "Failed to unload backend library.";
1128+
LOGS_DEFAULT(ERROR) << "Failed to unload backend library: " << result.ErrorMessage();
11331129
}
11341130
}
11351131

0 commit comments

Comments
 (0)