Skip to content

Conversation

@jainapurva
Copy link
Contributor

@jainapurva jainapurva commented Nov 3, 2025

This pull request moves CutlassInt4PackedLayout and its implementation from torchao/dtypes/uintx/cutlass_int4_packed_layout.py to torchao/prototype/dtypes/uintx/cutlass_int4_packed_layout.py, and exposed it via torchao.prototype.dtypes while maintaining BC at torchao.prototype.dtypes.uintx with a deprecation warning for torchao v0.16.0.
Updates API documentation to reflect the changes

Reference Issue: #2752

- Moved cutlass_int4_packed_layout.py from torchao/dtypes/uintx/ to torchao/prototype/dtypes/uintx/
- Created torchao/prototype/dtypes/__init__.py and uintx/__init__.py to export CutlassInt4PackedLayout
- Replaced old file with backward compatibility stub that imports from new location
- Added deprecation warning for old import path (to be removed in v0.16.0)
- Updated torchao/dtypes/__init__.py to re-export from prototype for backward compatibility
- Updated internal imports in affine_quantized_tensor_ops.py to use new prototype location
- Removed CutlassInt4PackedLayout from torchao/dtypes/uintx/__init__.py to avoid circular imports
- Updated documentation to move CutlassInt4PackedLayout to Prototype section

All import paths work:
  - New: from torchao.prototype.dtypes import CutlassInt4PackedLayout
  - Backward compat: from torchao.dtypes import CutlassInt4PackedLayout
  - Deprecated: from torchao.dtypes.uintx.cutlass_int4_packed_layout import CutlassInt4PackedLayout
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 3, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 42acafa with merge base 315e9b4 (image):
💚 Looks good so far! There are no failures yet. 💚

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 Nov 3, 2025
@jainapurva jainapurva changed the base branch from main to move_block_sparsity November 3, 2025 06:04
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Removed unused import for CutlassInt4PackedLayout.
Removed __all__ exports from cutlass_int4_packed_layout.py
@jainapurva jainapurva force-pushed the move_cutlass_int4_packed_layout branch from 6c03ed4 to 8c18d4d Compare November 3, 2025 22:29
@jainapurva jainapurva requested a review from jerryzh168 November 3, 2025 22:34
@jainapurva jainapurva added the topic: bc-breaking Use this tag if this PR breaks backward compatibility label Nov 3, 2025
@jainapurva jainapurva marked this pull request as ready for review November 3, 2025 22:38
@jainapurva jainapurva changed the base branch from move_block_sparsity to main November 3, 2025 22:40
FloatxTensor
FloatxTensorCoreLayout
MarlinSparseLayout
BlockSparseLayout
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like it's both? maybe try to split would be better, or update the summary to say it's two things

Copy link
Contributor Author

@jainapurva jainapurva Nov 4, 2025

Choose a reason for hiding this comment

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

It's in two separate PRs:
Pr for BlockSparseLayout: #3276

This one is for CutlassInt4PackedLayout

from torchao.dtypes.utils import (
Layout,
PlainLayout,
warnings.warn(
Copy link
Contributor

Choose a reason for hiding this comment

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

add a test for warning as well? example

warnings.catch_warnings(record=True) as caught_warnings,

if bias is not None:
y += bias
return y
from torchao.prototype.dtypes.uintx.block_sparse_layout import (
Copy link
Contributor

Choose a reason for hiding this comment

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

since this keeps BC I think we should remove the bc-breaking label

@jainapurva jainapurva changed the base branch from main to move_block_sparsity November 4, 2025 18:27
)
from torchao.dtypes.uintx.plain_layout import (
_aqt_is_int8,
warnings.warn(
Copy link
Contributor

Choose a reason for hiding this comment

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

add #2752 to the message

Copy link
Contributor

Choose a reason for hiding this comment

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

also, I'd remove torchao v0.16.0 and just say "in a future release of torchao", just in case the work gets delayed

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: bc-breaking Use this tag if this PR breaks backward compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants