Skip to content

[QNN EP] Enable QNN Saver for debugging issues#17747

Merged
adrianlizarraga merged 15 commits intomainfrom
adrianl/qnn-saver
Oct 3, 2023
Merged

[QNN EP] Enable QNN Saver for debugging issues#17747
adrianlizarraga merged 15 commits intomainfrom
adrianl/qnn-saver

Conversation

@adrianlizarraga
Copy link
Contributor

@adrianlizarraga adrianlizarraga commented Sep 29, 2023

Description

  • Enables option to use the QNN Saver backend for dumping QNN API calls to file.
  • Adds logic to read environment variable ORT_UNIT_TEST_ENABLE_QNN_SAVER from QNN EP unit tests. If enabled, unit tests will use the QNN Saver backend and dump files to ./saver_output/.

Motivation and Context

QNN Saver makes it easier to debug issues when unit tests fail. The output files generated by QNN Saver can be used to replay the exact QNN API calls that lead to a specific error condition.

QNN Saver dumps QNN API calls (and weights) to disk.

  • saver_output/saver_output.c: C file containing all QNN API calls.
  • saver_output/params.bin: binary file containing all input/output/parameter tensor data provided during tensor creation, op config validation, and graph execution.

Enabling the QNN Saver backend has 2 note-worthy effects:

  1. All* QNN API calls will succeed.
  2. Inference output returns dummy data.

Because the output files from QNN Saver are always overwritten, it is recommended to run individual unit tests via the --gtest_filter command-line option.

Example (linux):

$ ORT_UNIT_TEST_ENABLE_QNN_SAVER=1 ./onnxruntime_test_all --gtest_filter=QnnHTPBackendTests.Resize_DownSample_Linear_AlignCorners

Example (windows):
TODO

@adrianlizarraga adrianlizarraga marked this pull request as ready for review October 3, 2023 01:56
jywu-msft
jywu-msft previously approved these changes Oct 3, 2023
Copy link
Contributor

@HectorSVC HectorSVC left a comment

Choose a reason for hiding this comment

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

:shipit:

@adrianlizarraga adrianlizarraga merged commit 8e6019a into main Oct 3, 2023
@adrianlizarraga adrianlizarraga deleted the adrianl/qnn-saver branch October 3, 2023 23:24
kleiti pushed a commit to kleiti/onnxruntime that referenced this pull request Mar 22, 2024
### Description
- Enables option to use the QNN Saver backend for dumping QNN API calls
to file.
- Adds logic to read environment variable
`ORT_UNIT_TEST_ENABLE_QNN_SAVER` from QNN EP unit tests. If enabled,
unit tests will use the QNN Saver backend and dump files to
`./saver_output/`.


### Motivation and Context
QNN Saver makes it easier to debug issues when unit tests fail. The
output files generated by QNN Saver can be used to replay the exact QNN
API calls that lead to a specific error condition.

QNN Saver dumps QNN API calls (and weights) to disk.
- saver_output/saver_output.c: C file containing all QNN API calls.
- saver_output/params.bin: binary file containing all
input/output/parameter tensor data provided during tensor creation, op
config validation, and graph execution.

Enabling the QNN Saver backend has 2 note-worthy effects:
  1. All QNN API calls will succeed.
  2. Inference output returns dummy data.
 
Because the output files from QNN Saver are always overwritten, it is
recommended to run individual unit tests via the `--gtest_filter`
command-line option.

Example (linux):
```shell
$ ORT_UNIT_TEST_ENABLE_QNN_SAVER=1 ./onnxruntime_test_all --gtest_filter=QnnHTPBackendTests.Resize_DownSample_Linear_AlignCorners
```
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.

3 participants