Skip to content

Support dynamically quantized 2D convolutions #10347

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

Merged

Conversation

keyprocedure
Copy link
Contributor

Summary

Add initial support for dynamically quantized Conv2d in XNNPACK:

  • Add conv to DYNAMIC_OPS for annotation
  • Update partitioner to support dynamically quantized Conv2d
  • Add checks to ensure only 2D, non-depthwise dynamically quantized convs are partitioned and annotated
  • Update NHWC permute node insertion to trace back to original input for dynamically quantized inputs
  • Compute num_nonbatch_dims based on whether the node feeds into a conv
  • Remove the num_nonbatch_dims check from XNNCompiler
  • Add unit tests for channels-last permute and single, sequential, and parallel dynamically quantized 2D convs

Fixes #9021

Test plan

python -m unittest backends.xnnpack.test.ops.test_conv2d.TestConv2d.test_dq_conv2d
python -m unittest backends.xnnpack.test.ops.test_conv2d.TestConv2d.test_dq_conv2d_seq
python -m unittest backends.xnnpack.test.ops.test_conv2d.TestConv2d.test_dq_conv2d_parallel
python -m unittest backends.xnnpack.test.passes.test_channels_last_tagged_reshape.TestChannelsLastTaggedReshapePass.test_dq_conv2d_channels_last_tagged_reshape_pass

Copy link

pytorch-bot bot commented Apr 22, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit d82e080 with merge base ad7cd2b (image):

NEW FAILURE - The following job has 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 Apr 22, 2025
@keyprocedure
Copy link
Contributor Author

@pytorchbot label "topic: not user facing"

Copy link
Contributor

@mcr229 mcr229 left a comment

Choose a reason for hiding this comment

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

looks good! let's wait for CI to run and then we can merge. Thank you for the contribution!

@mcr229
Copy link
Contributor

mcr229 commented Apr 22, 2025

lintrunner failure isn't relevant and is fixed on main. Merging changes

@mcr229 mcr229 merged commit cfd1be3 into pytorch:main Apr 22, 2025
161 of 166 checks passed
@mergennachin mergennachin added the community: contribution PRs coming from community (excluding hardware partners) label Apr 23, 2025
jackzhxng added a commit that referenced this pull request Apr 23, 2025
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. community: contribution PRs coming from community (excluding hardware partners) topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Dynamically Quantized Convolutions
4 participants