Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Quant][X86] add an op to compute uint8 batch norm 2d #152811

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

Draft
wants to merge 7 commits into
base: gh/Xia-Weiwen/39/base
Choose a base branch
from

Conversation

Xia-Weiwen
Copy link
Collaborator

@Xia-Weiwen Xia-Weiwen commented May 5, 2025

Stack from ghstack (oldest at bottom):

Summary
This PR adds a new op, onednn.qbatch_norm2d, which accepts uint8 inputs on CPU device (instead of QuantizedCPU).
The new ops are implemented with AVX512 instructions and it provides similar performance as its counterpart for QuantizedCPU device quantized.batch_norm2d.
The new op supports output dtypes other than uint8 (fp32, fp16 and bf16 are supported).

Test plan

pytest test/quantization/core/test_quantized_op.py -k test_int8_batch_norm_onednn

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @jerryzh168

[ghstack-poisoned]
Copy link

pytorch-bot bot commented May 5, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 6770c6e with merge base 7e637de (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot bot added module: cpu CPU specific problem (e.g., perf, algorithm) release notes: quantization release notes category labels May 5, 2025
Xia-Weiwen added a commit that referenced this pull request May 5, 2025
ghstack-source-id: 949cb72
Pull Request resolved: #152811
@Xia-Weiwen Xia-Weiwen marked this pull request as draft May 5, 2025 08:13
[ghstack-poisoned]
Xia-Weiwen added a commit that referenced this pull request May 5, 2025
ghstack-source-id: dfcf0db
Pull Request resolved: #152811
[ghstack-poisoned]
Xia-Weiwen added a commit that referenced this pull request May 6, 2025
ghstack-source-id: 3b393ae
Pull Request resolved: #152811
[ghstack-poisoned]
Xia-Weiwen added a commit that referenced this pull request May 6, 2025
ghstack-source-id: 0c2d840
Pull Request resolved: #152811
Xia-Weiwen added a commit that referenced this pull request May 6, 2025
ghstack-source-id: 0c2d840
Pull Request resolved: #152811
@Xia-Weiwen Xia-Weiwen added the intel This tag is for PR from Intel label May 6, 2025
[ghstack-poisoned]
Xia-Weiwen added a commit that referenced this pull request May 6, 2025
ghstack-source-id: d3e06ef
Pull Request resolved: #152811
);
} else if (output.scalar_type() == c10::ScalarType::BFloat16) {
auto out_ptr = output.data_ptr<at::BFloat16>();
q_batch_norm_cpu_kernel_impl<at::BFloat16>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment as previous PR, let's merge these branches.

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. I have updated this part.

[ghstack-poisoned]
Xia-Weiwen added a commit that referenced this pull request May 7, 2025
ghstack-source-id: f1f01f2
Pull Request resolved: #152811
[ghstack-poisoned]
Xia-Weiwen added a commit that referenced this pull request May 7, 2025
ghstack-source-id: 1d1f4ec
Pull Request resolved: #152811
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intel This tag is for PR from Intel module: cpu CPU specific problem (e.g., perf, algorithm) open source release notes: quantization release notes category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants