Skip to content

Delete deprecated BlockSparseLayout and related code#4143

Merged
jerryzh168 merged 3 commits intomainfrom
gh/jerryzh168/59/head
Mar 24, 2026
Merged

Delete deprecated BlockSparseLayout and related code#4143
jerryzh168 merged 3 commits intomainfrom
gh/jerryzh168/59/head

Conversation

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Mar 23, 2026

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit b709232 with merge base 34322b5 (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@jerryzh168
Copy link
Copy Markdown
Contributor Author

@claude review

@claude
Copy link
Copy Markdown

claude bot commented Mar 23, 2026

Claude finished @jerryzh168's task in 1m 33s —— View job


Review of PR #4143: Delete deprecated BlockSparseLayout and related code

  • Gather context and read changed files
  • Analyze the diff for correctness and completeness
  • Post review feedback

Overall: This PR looks good. It cleanly removes the deprecated BlockSparseLayout and BlockSparseAQTTensorImpl code along with the associated test, deprecation shim, and dispatch registration. The deletion is consistent and well-scoped.

Summary of changes

  • Deleted torchao/prototype/dtypes/uintx/block_sparse_layout.py (the actual implementation, 233 lines)
  • Deleted torchao/dtypes/uintx/block_sparse_layout.py (the deprecation stub, 24 lines)
  • Removed BlockSparseLayout from __init__.py exports in torchao/dtypes/, torchao/prototype/dtypes/, and torchao/prototype/dtypes/uintx/
  • Removed the block sparse check/impl dispatch registration from affine_quantized_tensor_ops.py
  • Removed the TestQuantBlockSparseWeight test class from test/sparsity/test_sparse_api.py

Issue found

Stale deprecation test referencetest/dtypes/test_uintx.py:105 still references the now-deleted module:

deprecated_apis = [
    ("BlockSparseLayout", "torchao.dtypes.uintx.block_sparse_layout"),  # line 105
    ("UintxLayout", "torchao.dtypes.uintx.uintx_layout"),
]

This test (test_uintx_api_deprecation) will fail at runtime because:

  1. The module torchao.dtypes.uintx.block_sparse_layout no longer exists
  2. The exec(f"from torchao.dtypes import BlockSparseLayout") call will fail since BlockSparseLayout was removed from torchao/dtypes/__init__.py

This entry should be removed from the deprecated_apis list.

Fix this →

Notes

  • The non-quantized TestBlockSparseWeight test class and block_sparse_weight sparsification API in torchao/sparsity/ are correctly left intact — this PR only removes the quantized block sparse layout path.
  • No other files in the codebase reference BlockSparseLayout, BlockSparseAQTTensorImpl, or block_sparse_layout beyond the stale test noted above.

@jerryzh168
Copy link
Copy Markdown
Contributor Author

@claude review again

@claude
Copy link
Copy Markdown

claude bot commented Mar 23, 2026

Claude finished @jerryzh168's task in 1m 1s —— View job


Re-review of PR #4143: Delete deprecated BlockSparseLayout and related code

  • Gather context and read changed files
  • Check if previously flagged issue was addressed
  • Analyze the full diff for correctness and completeness
  • Post review feedback

Overall: This PR looks good. The previously flagged issue (stale BlockSparseLayout entry in the deprecation test at test/dtypes/test_uintx.py) has been fixed in the updated commit.

Summary of changes (8 files, +0/-318)

  • Deleted torchao/prototype/dtypes/uintx/block_sparse_layout.py — the 233-line implementation (BlockSparseLayout, BlockSparseAQTTensorImpl, and the int8 linear dispatch functions)
  • Deleted torchao/dtypes/uintx/block_sparse_layout.py — the 24-line deprecation shim
  • Removed BlockSparseLayout from __init__.py exports in torchao/dtypes/, torchao/prototype/dtypes/, and torchao/prototype/dtypes/uintx/
  • Removed the block sparse check/impl dispatch registration from torchao/dtypes/affine_quantized_tensor_ops.py
  • Removed TestQuantBlockSparseWeight test class and its instantiate_parametrized_tests call from test/sparsity/test_sparse_api.py
  • Removed the BlockSparseLayout entry from the deprecation test in test/dtypes/test_uintx.py

Verification

  • Searched the entire codebase for BlockSparseLayout, BlockSparseAQTTensorImpl, and block_sparse_layoutzero remaining references. The cleanup is complete.
  • The non-quantized TestBlockSparseWeight test class and block_sparse_weight sparsification API in torchao/sparsity/ are correctly left intact.
  • CI: Ruff, Build Docs, and PR Label Check are passing. GPU/regression tests are still in progress.

No issues found.


View job

@jerryzh168 jerryzh168 changed the base branch from gh/jerryzh168/59/base to main March 24, 2026 00:09
@jerryzh168 jerryzh168 merged commit ea9cece into main Mar 24, 2026
34 of 36 checks passed
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. module: not user facing Use this tag if you don't want this PR to show up in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants