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 marked this pull request as ready for review August 19, 2026 11:29
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