Skip to content

[Quant][X86] add an op to compute uint8 pointwise mul#151112

Closed
Xia-Weiwen wants to merge 6 commits into
gh/Xia-Weiwen/37/basefrom
gh/Xia-Weiwen/37/head
Closed

[Quant][X86] add an op to compute uint8 pointwise mul#151112
Xia-Weiwen wants to merge 6 commits into
gh/Xia-Weiwen/37/basefrom
gh/Xia-Weiwen/37/head

Conversation

@Xia-Weiwen

@Xia-Weiwen Xia-Weiwen commented Apr 11, 2025

Copy link
Copy Markdown
Collaborator

Stack from ghstack (oldest at bottom):

Summary
Add a new op, onednn.qmul.tensor, for int8 elementwise mul, which accepts inputs on CPU device (instead of QuantizedCPU).
The new op is implemented by AVX512 instructions and it provides similar or better performance, depending on shape, than its counterpart for QuantizedCPU device quantized.mul.
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_mul_onednn

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

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Apr 11, 2025

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit 8afe2e8 with merge base 7f28c03 (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 Apr 11, 2025
Xia-Weiwen added a commit that referenced this pull request Apr 11, 2025
ghstack-source-id: badb5cb
Pull Request resolved: #151112
@Xia-Weiwen Xia-Weiwen marked this pull request as draft April 11, 2025 15:01
[ghstack-poisoned]
[ghstack-poisoned]
@Xia-Weiwen Xia-Weiwen marked this pull request as ready for review April 15, 2025 05:04
@Xia-Weiwen Xia-Weiwen added the intel This tag is for PR from Intel label Apr 17, 2025
@Xia-Weiwen Xia-Weiwen requested a review from jerryzh168 April 17, 2025 00:33
[ghstack-poisoned]
Xia-Weiwen added a commit that referenced this pull request Apr 18, 2025
ghstack-source-id: 76b8871
Pull Request resolved: #151112
@Xia-Weiwen

Copy link
Copy Markdown
Collaborator Author

Hi @jerryzh168 Could you please review this PR? Thanks.

1 similar comment
@Xia-Weiwen

Copy link
Copy Markdown
Collaborator Author

Hi @jerryzh168 Could you please review this PR? Thanks.

Divigroup-RAP pushed a commit to Divigroup-RAP/PYTORCH that referenced this pull request Apr 22, 2025
Comment on lines +3156 to +3162
qa = torch.quantize_per_tensor(a, s_a, z_a, torch.quint8)
qb = torch.quantize_per_tensor(b, s_b, z_b, torch.quint8)
dqa = qa.dequantize()
dqb = qb.dequantize()
c_ref = dqa * dqb
if output_dtype == torch.uint8:
c_ref = torch.quantize_per_tensor(c_ref, s_c, z_c, torch.quint8).int_repr()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we have the quantized_decomposed ops that's more recent btw

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. I have changed it to the new version.

[ghstack-poisoned]
[ghstack-poisoned]
Xia-Weiwen added a commit that referenced this pull request Apr 25, 2025
ghstack-source-id: 0c4a635
Pull Request resolved: #151112
@Xia-Weiwen

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Apr 25, 2025
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@github-actions github-actions Bot deleted the gh/Xia-Weiwen/37/head branch June 14, 2025 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request intel This tag is for PR from Intel Merged 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.

5 participants