-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[QNN-EP] Enable Optrace from QNN into QNN EP #25987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[QNN-EP] Enable Optrace from QNN into QNN EP #25987
Conversation
- Add optrace profiling level - Add profiling to compose graph - Add new qnn system profile serializer class - Add API versioning safeguards - Add backwards compatibility for QNN API < 2.28.1 - Use QNN System Profile API for QNN API >= 2.28.1 - Check for log file at end of profiling unit test - Ensure system libs are loaded when profiling is enabled
/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline |
Azure Pipelines successfully started running 5 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds optrace profiling level support to the QNN Execution Provider, enabling detailed operation tracing for debugging purposes. It introduces a new QNN System Profile API serializer that generates binary log files compatible with qnn-profile-viewer when using QNN API >= 2.28.1, falling back to CSV format for older versions.
- Adds optrace profiling level alongside existing basic and detailed levels
- Implements QNN System Profile API integration with backwards compatibility
- Adds profiling instrumentation to graph composition, finalization, and execution
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
qnn_basic_test.cc | Updates test to use .log extension and adds new optrace test |
qnn_execution_provider.cc | Adds optrace parsing support to profiling level parser |
qnn_utils.h/.cc | Adds timestamp utility function for profiling |
qnn_profile_serializer.h/.cc | New serializer class for QNN System Profile API |
qnn_model.cc | Adds profiling instrumentation to graph operations |
qnn_def.h | Defines optrace level and profiling method types |
qnn_backend_manager.h/.cc | Major refactoring of profiling infrastructure |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
#pragma once | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an include guard in a .cc file, not a .h file. This line should be removed from the implementation file.
#pragma once |
Copilot uses AI. Check for mistakes.
QnnProfile_EventData_t event_data) { | ||
auto system_event = &(event_list.emplace_back()); | ||
|
||
if (system_event != nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This null check is unnecessary as emplace_back() returns a reference to the newly created object, which cannot be null. The check should be removed to improve code clarity.
Copilot uses AI. Check for mistakes.
QnnProfile_ExtendedEventData_t event_data) { | ||
auto system_event = &(event_list.emplace_back()); | ||
|
||
if (system_event != nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This null check is unnecessary as emplace_back() returns a reference to the newly created object, which cannot be null. The check should be removed to improve code clarity.
Copilot uses AI. Check for mistakes.
|
||
// This name must be same with the EPContext node name | ||
const auto& graph_name = fused_node.Name(); | ||
ORT_RETURN_IF_ERROR(SetGraphInputOutputInfo(graph_viewer, fused_node, logger)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Empty line was removed between logically separate operations. Consider adding the blank line back to improve code readability and maintain separation between setup and construction phases.
ORT_RETURN_IF_ERROR(SetGraphInputOutputInfo(graph_viewer, fused_node, logger)); | |
ORT_RETURN_IF_ERROR(SetGraphInputOutputInfo(graph_viewer, fused_node, logger)); |
Copilot uses AI. Check for mistakes.
Description
Motivation and Context
Adds optrace level profiling for debugging purposes. Utilizes new QNN System Profile API to generate a binary log file compatible with qnn-profile-viewer executable (or creates a .csv file as before if QNN API version is < 2.28.1).