Skip to content

Conversation

@winskuo-quic
Copy link
Collaborator

Summary

Supporting following options that can be set during both AOT and runtime:

  • Log Level
  • Performance Mode
  • Profiling Level

Test plan

  • Log Level: Check debug message prefix exists.
  • Performance Mode: Ensure QNN SDK prints config log for performance, and ensure burst is faster than high power saver.
  • Profiling Level: Turn profiling off in compile spec and add profiling flag in runtime, ensure profiler gets expected number of events.

@pytorch-bot
Copy link

pytorch-bot bot commented Jul 9, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/12297

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 2 New Failures, 1 Unrelated Failure

As of commit 6e04866 with merge base 07b6059 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 9, 2025
@github-actions
Copy link

github-actions bot commented Jul 9, 2025

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

* Currently we assume that the outputs are all fp32 tensors.
*/

#include <executorch/backends/qualcomm/runtime/QnnBackendOptions.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it needed to have these headers?

#include <executorch/backends/qualcomm/runtime/QnnBackendOptions.h>
#include <executorch/backends/qualcomm/runtime/QnnExecuTorchBackend.h>

Copy link
Contributor

Choose a reason for hiding this comment

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

And these two

#include <executorch/runtime/backend/backend_option_context.h>
#include <executorch/runtime/backend/interface.h>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for reviewing the PR and catching this.
Some of these headers are not required and I have removed them.
However, QnnExecuTorchBackend.h would still be required since the backend name variable QNN_BACKEND is inside QnnExecuTorchBackend.h. If there are any concerns, I can move this variable to somewhere else.
Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, I'm just trying to understand what headers are required to be added to the runtime. What is the alternative option for the QNN_BACKEND variable?

Copy link
Collaborator Author

@winskuo-quic winskuo-quic Jul 12, 2025

Choose a reason for hiding this comment

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

I have pushed a new commit that places all these macros under executorch/backends/qualcomm/runtime/QnnExecuTorch.h, so we don't need to include QnnExecuTorchBackend.h.
However, I will still need to include executorch/runtime/backend/interface.h since I need to call the set_options api.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, I might refactor to move the set_options API. But let's merge this PR for now

@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/runtime_option branch from 83b19ef to 141c7be Compare July 12, 2025 05:44
@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this in D78522200.

@cccclai
Copy link
Contributor

cccclai commented Jul 18, 2025

Hmm lots of internal failure, might be easier if I move the API to <options.h> now

@winskuo-quic
Copy link
Collaborator Author

Hmm lots of internal failure, might be easier if I move the API to <options.h> now

Sure! I will rebase to mainline and change the header once the API is moved to <options.h>

@cccclai
Copy link
Contributor

cccclai commented Aug 4, 2025

Actually can you make this one line change

--- a/executorch/backends/qualcomm/runtime/targets.bzl
+++ b/executorch/backends/qualcomm/runtime/targets.bzl
@@ -75,11 +75,11 @@
                 "//executorch/backends/qualcomm:schema",
                 "//executorch/backends/qualcomm/aot/ir:qcir_utils",
                 "//executorch/backends/qualcomm/aot/wrappers:wrappers",
-                "//executorch/runtime/backend:interface",
                 "//executorch/runtime/core:core",
                 "//executorch/extension/tensor:tensor",
             ],
             exported_deps = [
+                "//executorch/runtime/backend:interface",
                 "//executorch/runtime/core/exec_aten/util:scalar_type_util",
                 "//executorch/runtime/core:event_tracer",
             ],

It seems fix the issue

@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/runtime_option branch from 141c7be to 6e04866 Compare August 5, 2025 01:51
@winskuo-quic
Copy link
Collaborator Author

Actually can you make this one line change

--- a/executorch/backends/qualcomm/runtime/targets.bzl
+++ b/executorch/backends/qualcomm/runtime/targets.bzl
@@ -75,11 +75,11 @@
                 "//executorch/backends/qualcomm:schema",
                 "//executorch/backends/qualcomm/aot/ir:qcir_utils",
                 "//executorch/backends/qualcomm/aot/wrappers:wrappers",
-                "//executorch/runtime/backend:interface",
                 "//executorch/runtime/core:core",
                 "//executorch/extension/tensor:tensor",
             ],
             exported_deps = [
+                "//executorch/runtime/backend:interface",
                 "//executorch/runtime/core/exec_aten/util:scalar_type_util",
                 "//executorch/runtime/core:event_tracer",
             ],

It seems fix the issue

I have the 1 line change fixed and also rebased to mainline. Thanks

@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this in D78522200.

Copy link
Contributor

@cccclai cccclai left a comment

Choose a reason for hiding this comment

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

Thanks for adding the feature!

@cccclai cccclai merged commit 047587e into pytorch:main Aug 5, 2025
101 of 104 checks passed
agrima1304 pushed a commit to agrima1304/executorch that referenced this pull request Aug 26, 2025
### Summary
Supporting following options that can be set during both AOT and
runtime:

- Log Level
- Performance Mode
- Profiling Level

### Test plan

- Log Level: Check `debug` message prefix exists. 
- Performance Mode: Ensure QNN SDK prints config log for performance,
and ensure burst is faster than high power saver.
- Profiling Level: Turn profiling off in compile spec and add profiling
flag in runtime, ensure profiler gets expected number of events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants