Skip to content

Fix mixed INT8 FakeTensor output metadata - #2044

Open
tandede wants to merge 1 commit into
bitsandbytes-foundation:mainfrom
tandede:fix/int8-mixed-fake-metadata
Open

Fix mixed INT8 FakeTensor output metadata#2044
tandede wants to merge 1 commit into
bitsandbytes-foundation:mainfrom
tandede:fix/int8-mixed-fake-metadata

Conversation

@tandede

@tandede tandede commented Aug 19, 2026

Copy link
Copy Markdown

Summary

  • make the mixed INT8 FakeTensor implementation return subA with the same shape and dtype contract as eager execution
  • keep subA two-dimensional when there are zero outlier columns, including when outlier_cols is omitted
  • add CPU and MPS operation checks for non-empty, empty, and omitted outlier-column inputs

Root cause

The fake implementation created subA as a fresh one-dimensional int64 tensor. Eager execution instead returns the selected input columns, which are two-dimensional and inherit the input dtype. This caused torch.library.opcheck to fail with mismatched output metadata. The eager no-outlier branch also returned a one-dimensional empty tensor, making the output rank depend on input data.

Impact

The custom operation now has stable output metadata for FakeTensor and graph-capture consumers. The numerical mixed INT8 result is unchanged.

Tests

  • pytest -q tests/test_ops.py (649 passed, 69 skipped, 60 xfailed)
  • focused mixed INT8 operation checks on CPU and MPS (4 passed)
  • full-graph Linear8bitLt compile checks with threshold 6.0 on CPU and MPS (2 passed)
  • pre-commit run --files bitsandbytes/_ops.py bitsandbytes/backends/default/ops.py tests/test_ops.py

@tandede

tandede commented Aug 30, 2026

Copy link
Copy Markdown
Author

Hi maintainers, I’m following up on this PR in case it was missed. It fixes the output metadata produced for mixed INT8 FakeTensor operations and is ready for review. I’m happy to address any feedback or provide additional validation if needed. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant