Skip to content

Conversation

vkuzo
Copy link
Contributor

@vkuzo vkuzo commented Aug 19, 2025

Summary:

Adds a _QuantizeableMM module, and a _Float8MM quantized version it. This is to enable quantizing calls to torch.mm where none of the inputs are weights. This requires modeling changes at the callsite.

For now adding this as a prototype with names underscored to help test out a customer need. We can make the API more official at a later time after we get more signal on product market fit.

Usage:

from torchao.float8.quantizeable_mm import _QuantizeableMM

class M(nn.Module):
    def __init__(self):
        super().__init__()
        self.mm = _QuantizeableMM()

    def forward(self, a, b):
        c = self.mm(a, b)
        return c

config = Float8LinearConfig.from_recipe_name(recipe_name)
m_ref = M()
m = copy.deepcopy(m_ref)
m = convert_to_float8_training(m, config=config)

Test Plan:

pytest test/float8/test_base.py -s -x -k quantizeable_mm

Reviewers:

Subscribers:

Tasks:

Tags:

Summary:

Adds a `_QuantizeableMM` module, and a `_Float8MM` quantized version it.
This is to enable quantizing calls to `torch.mm` where none of the
inputs are weights. This requires modeling changes at the callsite.

For now adding this as a prototype with names underscored to help test out
a customer need. We can make the API more official at a later time after
we get more signal on product market fit.

Usage:

```python
class M(nn.Module):
    def __init__(self):
        super().__init__()
        self.mm = _QuantizeableMM()

    def forward(self, a, b):
        c = self.mm(a, b)
        return c

config = Float8LinearConfig.from_recipe_name(recipe_name)
m_ref = M()
m = copy.deepcopy(m_ref)
m = convert_to_float8_training(m, config=config)
```

Test Plan:

```bash
pytest test/float8/test_base.py -s -x -k quantizeable_mm
```

Reviewers:

Subscribers:

Tasks:

Tags:
Copy link

pytorch-bot bot commented Aug 19, 2025

🔗 Helpful Links

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

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

❌ 3 New Failures

As of commit 72e6b38 with merge base 751d7f6 (image):

NEW FAILURES - The following jobs have failed:

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

@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 Aug 19, 2025
@vkuzo vkuzo added the topic: improvement Use this tag if this PR is an improvement (doesn't fit into any of the other categories) label Aug 19, 2025
@facebook-github-bot
Copy link
Contributor

@vkuzo has imported this pull request. If you are a Meta employee, you can view this in D80536689.

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.

2 participants