Skip to content

Fix fp32 4-bit GEMV test tolerance for ROCm/gfx1200 - #2113

Open
kudomcho wants to merge 1 commit into
bitsandbytes-foundation:mainfrom
kudomcho:fix/rocm-fp32-gemv-4bit-tolerance
Open

kudomcho wants to merge 1 commit into
bitsandbytes-foundation:mainfrom
kudomcho:fix/rocm-fp32-gemv-4bit-tolerance

Conversation

@kudomcho

@kudomcho kudomcho commented Oct 29, 2026 •

Copy link
Copy Markdown

Summary

  • Adds ROCm-specific fp32 thresholds for test_gemv_4bit in tests/test_functional.py
  • ROCm/HIP 4-bit GEMV on gfx1200 produces slightly higher fp32 numerical error than CUDA due to different FMA reduction ordering — the errors are still tiny in absolute terms (sub-microsecond scale) but consistently exceed the CUDA-calibrated tolerances
  • Follows the same override pattern already used for CPU AVX512BF16 thresholds, gated on torch.version.hip

Test plan

  • All 192 test_gemv_4bit cases pass on gfx1200 (RX 9060 XT) with ROCm 6.3/6.4 — 0 failures across fp16, bf16, and fp32
  • Previously failing 14 fp32 cases now pass with 38-100% headroom
  • All 10 pre-commit hooks pass (ruff, ruff format, typos, clang-format, etc.)
  • Verify no regression on CUDA (thresholds are gated on torch.version.hip, so CUDA path is unchanged)

ROCm/HIP 4-bit GEMV on gfx1200 produces slightly higher fp32 numerical
error than CUDA due to different FMA reduction ordering. Add dedicated
fp32 thresholds for ROCm, following the same override pattern used for
CPU AVX512BF16. Verified on gfx1200 (RX 9060 XT) with all 192
test_gemv_4bit cases passing.

Co-Authored-By: Claude <noreply@anthropic.com>

This branch has not been deployed

No deployments
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