Skip to content

[CPU] enable int8_dynamic_activation_int4_weight with Int4CPULayout #2128

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Xia-Weiwen
Copy link
Collaborator

Summary
Enable quantization of model with int8_dynamic_activation_int4_weight and Int4CPULayout.

Test plan

pytest test/quantization/test_quant_api.py -k test_8da4w_cpu

Copy link

pytorch-bot bot commented Apr 25, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 35ece3b with merge base e3db2b2 (image):
💚 Looks good so far! There are no failures yet. 💚

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 25, 2025
@Xia-Weiwen Xia-Weiwen added cpu quantize topic: new feature Use this tag if this PR adds a new feature labels Apr 25, 2025
torch.compile(m, fullgraph=True, dynamic=True),
*example_inputs,
)
assert "_weight_int4pack_mm_for_cpu" in code[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember this op is weight only quant?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. This op is used here because we don't have an op to compute da8w4 on CPU yet. So it will fallback to explicit dequantization and call of this op.

@Xia-Weiwen Xia-Weiwen marked this pull request as ready for review April 29, 2025 02:01
@Xia-Weiwen Xia-Weiwen requested a review from jerryzh168 April 29, 2025 03:16
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. cpu quantize topic: new feature Use this tag if this PR adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants