Skip to content

Fix int8 GEMM by using dedicated BLAS Lt handle on ROCm/CUDA#2018

Open
zjin-lcf wants to merge 1 commit into
bitsandbytes-foundation:mainfrom
zjin-lcf:fix/rocm-hipblaslt-int8-handle
Open

Fix int8 GEMM by using dedicated BLAS Lt handle on ROCm/CUDA#2018
zjin-lcf wants to merge 1 commit into
bitsandbytes-foundation:mainfrom
zjin-lcf:fix/rocm-hipblaslt-int8-handle

Conversation

@zjin-lcf

Copy link
Copy Markdown

Summary

  • Fix int8 GEMM on ROCm (and CUDA) by creating a dedicated (hip|cublas)Lt handle in Context instead of casting the regular BLAS handle
  • Route cigemmlt_32, cigemmlt_8, and cigemmlt_8_rowscale through m_lt_handle for igemmlt
  • Add igemmlt_32_gemmex_fallback for ROCm builds without hipBLASLt (NO_HIPBLASLT)
  • Skip CUDA-only BNB_CUDA_VERSION evaluator tests on HIP; add int8 regression tests

Problem

cigemmlt_* passed Context::m_handle (a rocblas_handle on HIP) cast to hipblasLtHandle_t. hipBLASLt then ran with invalid state, causing OOB GPU writes, corrupted quant stats, and 62 test failures on gfx950 (50 Linear8bitLt, 10 int8 functional, 2 CUDA-only evaluator tests).

Test plan

  • Re-run all 62 originally failing tests on gfx950/ROCm 7.2: 60 passed, 2 skipped
  • Full suite: pytest tests/ -v --tb=short -n 43452 passed, 16 skipped, 32 xfailed, 0 failed (~96s)
  • CI CUDA matrix (same latent handle bug exists on CUDA path)

cigemmlt_* was casting the regular BLAS handle (rocblas on HIP) to
hipBLASLt/cuBLASLt, causing OOB writes and 62 gfx950 test failures.
Create m_lt_handle in Context and route igemmlt through it; add a
gemmex fallback when hipBLASLt is unavailable. Skip CUDA-only library
path tests on HIP and add int8 regression coverage.

Co-authored-by: Cursor <cursoragent@cursor.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