Skip to content
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

Qualcomm AI Engine Direct - LPBQ enablement #9313

Merged
merged 1 commit into from
Mar 23, 2025

Conversation

haowhsu-quic
Copy link
Collaborator

Summary

  • QC backend changes for adopting LPBQ
  • test case: conv2d 16a4w
  • refactor a bit

Test plan

python backends/qualcomm/tests/test_qnn_delegate.py -k TestQNNQuantizedOperator.test_qnn_backend_conv2d_block -s $SERIAL_NO -m SM8650 -b build-android

@haowhsu-quic haowhsu-quic requested a review from cccclai as a code owner March 17, 2025 15:00
Copy link

pytorch-bot bot commented Mar 17, 2025

🔗 Helpful Links

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

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

❌ 2 New Failures

As of commit a04f4a9 with merge base d980ce0 (image):

NEW FAILURES - The following jobs have failed:

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 Mar 17, 2025
@haowhsu-quic
Copy link
Collaborator Author

@pytorchbot label "release notes: qualcomm"

@pytorch-bot pytorch-bot bot added the release notes: qualcomm Changes to the Qualcomm backend delegate label Mar 17, 2025
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.

Really great to see that LPBQ is enabled so fast!

@@ -409,6 +409,13 @@ def _topological_sort_passes(passes: OrderedDict):
def _transform(
edge_program: ExportedProgram, passes_job: OrderedDict = None
) -> ExportedProgram:
# TODO: remove this workaround when target could be correclty detected
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The pt2e_quant.quantize_affine, pt2e_dequant.quantize_affine should be put in this section originally.
But looks like exir could not find the correct target under namespace.

@@ -1,56 +0,0 @@
# Copyright (c) Qualcomm Innovation Center, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the context for this removal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think torch.nn.functional.interpolate is no longer decomposed into multiple nodes now. It will directly map to super nodes like aten.upsample_nearest2d.vec, aten.upsample_bilinear2d.vec, aten.upsample_bicubic2d.vec.

@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@cccclai
Copy link
Contributor

cccclai commented Mar 20, 2025

I'm getting this error

    from executorch.backends.qualcomm.quantizer.observers.per_block_param_observer import (
ModuleNotFoundError: No module named 'executorch.backends.qualcomm.quantizer.observers'
``

@haowhsu-quic
Copy link
Collaborator Author

I'm getting this error

    from executorch.backends.qualcomm.quantizer.observers.per_block_param_observer import (
ModuleNotFoundError: No module named 'executorch.backends.qualcomm.quantizer.observers'
``

Sorry I cannot repro on my side, any chance the PYTHONPATH was not set correctly or earlier ET version was used?

@cccclai
Copy link
Contributor

cccclai commented Mar 22, 2025

Oh it's the buck failure...can you add this patch?

--- a/executorch/backends/qualcomm/quantizer/targets.bzl
+++ b/executorch/backends/qualcomm/quantizer/targets.bzl
@@ -10,6 +10,7 @@
         name = "quantizer",
         srcs = glob([
             "*.py",
+            "*/*.py",
         ]),
         visibility = [
             "@EXECUTORCH_CLIENTS",

summary:
- QC backend change for adopting LPBQ
- test case: conv2d 16a4w
- refactor & update document
@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@cccclai cccclai merged commit 20abf34 into pytorch:main Mar 23, 2025
79 of 81 checks passed
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. release notes: qualcomm Changes to the Qualcomm backend delegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants