Skip to content

[QNN EP] Make sure everything gets cleaned up - #23275

Merged
HectorSVC merged 11 commits into
microsoft:mainfrom
samwebster:deregister
Jan 8, 2025
Merged

[QNN EP] Make sure everything gets cleaned up#23275
HectorSVC merged 11 commits into
microsoft:mainfrom
samwebster:deregister

Conversation

@samwebster

@samwebster samwebster commented Jan 7, 2025

Copy link
Copy Markdown
Member

Description

Always make sure resources and callbacks are cleaned up

Motivation and Context

We've seen problems where the log callback isn't deregistered which can lead to crashes

@adrianlizarraga

Copy link
Copy Markdown
Contributor

/azp run Linux CPU CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline, Linux GPU CI Pipeline, Linux GPU TensorRT CI Pipeline, Linux OpenVINO CI Pipeline, MacOS CI Pipeline, ONNX Runtime Web CI Pipeline, onnxruntime-binary-size-checks-ci-pipeline, Linux QNN CI Pipeline

@adrianlizarraga

Copy link
Copy Markdown
Contributor

/azp run Windows CPU CI Pipeline, Windows GPU CI Pipeline, Windows GPU TensorRT CI Pipeline, Windows ARM64 QNN CI Pipeline, Windows x64 QNN CI Pipeline, Linux MIGraphX CI Pipeline, Big Models

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 9 pipeline(s).

@adrianlizarraga

Copy link
Copy Markdown
Contributor

/azp run ONNX Runtime React Native CI Pipeline, Linux Android Emulator QNN CI Pipeline, Windows GPU CUDA CI Pipeline, Windows GPU DML CI Pipeline, Windows GPU Doc Gen CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 6 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

@adrianlizarraga adrianlizarraga left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor adjustments to log levels

Comment thread onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc Outdated
Comment thread onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc Outdated
Comment thread onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc Outdated
Comment thread onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc Outdated
Comment thread onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc Outdated
Comment thread onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc Outdated
Comment thread onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc Outdated
Comment thread onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc Outdated
samwebster and others added 7 commits January 7, 2025 17:57
Co-authored-by: Adrian Lizarraga <adrianlm2@gmail.com>
Co-authored-by: Adrian Lizarraga <adrianlm2@gmail.com>
Co-authored-by: Adrian Lizarraga <adrianlm2@gmail.com>
Co-authored-by: Adrian Lizarraga <adrianlm2@gmail.com>
Co-authored-by: Adrian Lizarraga <adrianlm2@gmail.com>
Co-authored-by: Adrian Lizarraga <adrianlm2@gmail.com>
Co-authored-by: Adrian Lizarraga <adrianlm2@gmail.com>
Comment thread onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc
@adrianlizarraga

Copy link
Copy Markdown
Contributor

/azp run Linux CPU CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline, Linux GPU CI Pipeline, Linux GPU TensorRT CI Pipeline, Linux OpenVINO CI Pipeline, MacOS CI Pipeline, ONNX Runtime Web CI Pipeline, onnxruntime-binary-size-checks-ci-pipeline, Linux QNN CI Pipeline

@adrianlizarraga

Copy link
Copy Markdown
Contributor

/azp run Windows CPU CI Pipeline, Windows GPU CI Pipeline, Windows GPU TensorRT CI Pipeline, Windows ARM64 QNN CI Pipeline, Windows x64 QNN CI Pipeline, Linux MIGraphX CI Pipeline, Big Models

@adrianlizarraga

Copy link
Copy Markdown
Contributor

/azp run ONNX Runtime React Native CI Pipeline, Linux Android Emulator QNN CI Pipeline, Windows GPU CUDA CI Pipeline, Windows GPU DML CI Pipeline, Windows GPU Doc Gen CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 6 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 9 pipeline(s).

Comment thread onnxruntime/core/providers/qnn/builder/qnn_backend_manager.h Outdated
@jywu-mysoft

Copy link
Copy Markdown
Contributor

/azp run Linux CPU CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline, Linux GPU CI Pipeline, Linux GPU TensorRT CI Pipeline, Linux OpenVINO CI Pipeline, MacOS CI Pipeline, ONNX Runtime Web CI Pipeline, onnxruntime-binary-size-checks-ci-pipeline, Linux QNN CI Pipeline

@jywu-mysoft

Copy link
Copy Markdown
Contributor

/azp run ONNX Runtime React Native CI Pipeline, Linux Android Emulator QNN CI Pipeline, Windows GPU CUDA CI Pipeline, Windows GPU DML CI Pipeline, Windows GPU Doc Gen CI Pipeline

@jywu-mysoft

Copy link
Copy Markdown
Contributor

/azp run Windows CPU CI Pipeline, Windows GPU CI Pipeline, Windows GPU TensorRT CI Pipeline, Windows ARM64 QNN CI Pipeline, Windows x64 QNN CI Pipeline, Linux MIGraphX CI Pipeline, Big Models

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 9 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 6 pipeline(s).

auto result = ReleaseContext();
if (Status::OK() != result) {
ORT_THROW("Failed to ReleaseContext.");
LOGS_DEFAULT(ERROR) << "Failed to ReleaseContext.";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also log the error message from the Status?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's have another PR for this for the urgency.

@HectorSVC
HectorSVC merged commit 080f87f into microsoft:main Jan 8, 2025
snnn pushed a commit that referenced this pull request Jan 8, 2025
### Description
Always make sure resources and callbacks are cleaned up



### Motivation and Context
We've seen problems where the log callback isn't deregistered which can lead to crashes

---------

Co-authored-by: Adrian Lizarraga <adrianlm2@gmail.com>
backend_setup_completed_ = true;
} else {
LOGS_DEFAULT(WARNING) << "Failed to setup so cleaning up";
ReleaseResources();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReleaseResources() first checks backend_setup_completed_ == true before continuing.

if (!backend_setup_completed_) {
return;
}

as far as I can tell, the only place backend_setup_completed_ gets set to true is in the other branch. so would the call to ReleaseResources() not actually do anything here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot

tarekziade pushed a commit to tarekziade/onnxruntime that referenced this pull request Jan 10, 2025
### Description
Always make sure resources and callbacks are cleaned up



### Motivation and Context
We've seen problems where the log callback isn't deregistered which can lead to crashes

---------

Co-authored-by: Adrian Lizarraga <adrianlm2@gmail.com>
guschmue pushed a commit that referenced this pull request Jan 12, 2025
### Description
Always make sure resources and callbacks are cleaned up



### Motivation and Context
We've seen problems where the log callback isn't deregistered which can lead to crashes

---------

Co-authored-by: Adrian Lizarraga <adrianlm2@gmail.com>
ashrit-ms pushed a commit that referenced this pull request Mar 17, 2025
### Description
Always make sure resources and callbacks are cleaned up



### Motivation and Context
We've seen problems where the log callback isn't deregistered which can lead to crashes

---------

Co-authored-by: Adrian Lizarraga <adrianlm2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants