Skip to content

[Feat] Allow symmetric_no_clipping_error for KleidiAI kernels, update Readme and validate Kleidi INT4 quantization path #2570

Merged
metascroy merged 7 commits into
pytorch:mainfrom
gausah01:kai_quantization
Jul 26, 2025
Merged

Conversation

@gausah01

@gausah01 gausah01 commented Jul 18, 2025

Copy link
Copy Markdown
Contributor

This PR validates the support for the INT4 quantization path using KleidiAI by checking the integration to use the new quantize_() API and Int8DynamicActivationIntxWeightConfig. The PR addresses breakages like Symmetric_no_clipping_err caused by API refactors and ensures compatibility with the current layout.

…ated quantizer API

- Switched to quantize_() with Int8DynamicActivationIntxWeightConfig
- Validated the move of
  packed_linear_int8_dynamic_activation_intx_weight_layout.py in torchao/dtypes/uintx
- Fixed handling of SYMMETRIC_NO_CLIPPING_ERR mapping type
- Validated INT4 path on a 2-layer nn.Sequential model with torch.int4 weights
- Compared SYMMETRIC vs SYMMETRIC_NO_CLIPPING_ERR across PerAxis and PerGroup granularities
@pytorch-bot

pytorch-bot Bot commented Jul 18, 2025

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 2 New Failures, 3 Cancelled Jobs, 9 Pending

As of commit c4c1e50 with merge base 2eb4f97 (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOBS - The following jobs were cancelled. Please retry:

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

@meta-cla

meta-cla Bot commented Jul 18, 2025

Copy link
Copy Markdown

Hi @gausah-arm!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@gausah01 gausah01 changed the title [Feat] Restore and validate KleidiAI INT4 quantization path using updated quantizer API [Feat] Allow symmetric_no_clipping_error for KleidAI kernels, update Readme and validate Kleidi INT4 quantization path Jul 21, 2025
@gausah01 gausah01 changed the title [Feat] Allow symmetric_no_clipping_error for KleidAI kernels, update Readme and validate Kleidi INT4 quantization path [Feat] Allow symmetric_no_clipping_error for KleidiAI kernels, update Readme and validate Kleidi INT4 quantization path Jul 21, 2025
@meta-cla meta-cla 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 Jul 21, 2025
@nikhil-arm

Copy link
Copy Markdown
Contributor

@digantdesai @jerryzh168 @metascroy can you please review this PR

@digantdesai digantdesai requested a review from metascroy July 23, 2025 16:02
@digantdesai

Copy link
Copy Markdown
Contributor

@metascroy - can you please take a look?

@metascroy metascroy left a comment

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.

Overall changes look great! Let’s see what CI says.

@metascroy

metascroy commented Jul 23, 2025

Copy link
Copy Markdown
Contributor

@nikhil-arm can you fix the linter error (ruff) and then we can land.

You could also add the new mapping type to the tests here to get CI coverage: https://github.com/pytorch/ao/blob/main/torchao/experimental/tests/test_int8_dynamic_activation_intx_weight.py#L56

@gausah01

Copy link
Copy Markdown
Contributor Author

Overall changes look great! Let’s see what CI says.

Thankyou so much!

@gausah01

Copy link
Copy Markdown
Contributor Author

@nikhil-arm can you fix the linter error (ruff) and then we can land.

You could also add the new mapping type to the tests here to get CI coverage: https://github.com/pytorch/ao/blob/main/torchao/experimental/tests/test_int8_dynamic_activation_intx_weight.py#L56

Thankyou! I have fixed the lint error and done with the changes around test. Please review.

@metascroy

Copy link
Copy Markdown
Contributor

Running CI. I'll merge if it passes

@metascroy metascroy added the topic: improvement Use this tag if this PR is an improvement (doesn't fit into any of the other categories) label Jul 26, 2025
@metascroy metascroy merged commit ebfe173 into pytorch:main Jul 26, 2025
17 of 19 checks passed
liangel-02 pushed a commit that referenced this pull request Aug 25, 2025
… Readme and validate Kleidi INT4 quantization path (#2570)

* [Feat] Restore and validate KleidiAI INT4 quantization path using updated quantizer API

- Switched to quantize_() with Int8DynamicActivationIntxWeightConfig
- Validated the move of
  packed_linear_int8_dynamic_activation_intx_weight_layout.py in torchao/dtypes/uintx
- Fixed handling of SYMMETRIC_NO_CLIPPING_ERR mapping type
- Validated INT4 path on a 2-layer nn.Sequential model with torch.int4 weights
- Compared SYMMETRIC vs SYMMETRIC_NO_CLIPPING_ERR across PerAxis and PerGroup granularities

* [Fix]: Allow "SYMMETRIC_NO_CLIPPING_ERR" in Int8DynamicActivationIntxWeightConfig

* [FEAT]: Add SYMMETRIC_NO_CLIPPING_ERR to tests

* Update test_int8_dynamic_activation_intx_weight.py

* Update test_int8_dynamic_activation_intx_weight.py

* Update test_int8_dynamic_activation_intx_weight.py

---------

Co-authored-by: Scott Roy <161522778+metascroy@users.noreply.github.com>
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. topic: improvement Use this tag if this PR is an improvement (doesn't fit into any of the other categories)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants