Skip to content

fix: bypass broken hipblasLt int8 GEMM on gfx950#94

Open
kudomcho wants to merge 3 commits into
ROCm:rocm_enabled_multi_backendfrom
kudomcho:fix/igemmlt-gfx950-fallback
Open

fix: bypass broken hipblasLt int8 GEMM on gfx950#94
kudomcho wants to merge 3 commits into
ROCm:rocm_enabled_multi_backendfrom
kudomcho:fix/igemmlt-gfx950-fallback

Conversation

@kudomcho

@kudomcho kudomcho commented Jul 21, 2026

Copy link
Copy Markdown

Root cause

hipBLASLt's column-major Int8 GEMM kernel has a tiling bug on gfx950 — works for ≤64 columns, produces wrong results for ≥128 columns, and writes out of bounds on large inputs causing unrecoverable GPU page faults. The col-major int32 matrix transform is also broken.

Fix

Bypass the broken hipBLASLt col-major path on gfx950 by routing Int8 GEMM through torch._int_mm (row-major), which works correctly at all sizes. Python-only patch, no rebuild needed.

Changes:

  • bitsandbytes/backends/cuda.py: Add _igemmlt_fallback() gated on ROCM_GPU_ARCH == "gfx950". Recovers row-major matrices from col-major transformed inputs, computes via torch._int_mm with K/N padding to multiples of 8, returns result in row format
  • bitsandbytes/functional.py: Add no-op short-circuit in nvidia_transform() when from_order == to_order (needed because fallback returns row-format output)

Test plan

  • pytest -xvs tests/test_functional.py -k "igemmlt and cuda" — 2/2 passed (dims=2 and dims=3)
  • pytest -xvs tests/test_functional.py -k "igemmlt" — 3 passed, 12 skipped, 0 failed
  • Manual verification: 6 shapes (2D + 3D, including non-multiple-of-8 K and N) with max_diff=0.0

kudomcho and others added 3 commits July 21, 2026 17:57
hipblasLt int8 matmul on gfx950 (MI350) produces wrong results for
non-power-of-2 dimensions and GPU page faults (process abort) for
certain 3D/batched inputs. Root cause is a hipblasLt bug, not a
bitsandbytes buffer issue.

Add _igemmlt_fallback() that uses torch.matmul in float32 on gfx950,
undoing the col-major transform on inputs and re-applying it on output
to match the expected calling convention.

Fixes: test_igemmlt_int for both dims=2 and dims=3 on gfx950.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
Switch from torch.matmul(float) to torch._int_mm (native int8, row-major)
with K/N padding to multiples of 8. Return output in row format and add
no-op handling for row-to-row transform in nvidia_transform since
hipblasLt's col-major int32 transform is also broken on gfx950.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
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