Repository navigation
Calibrate fused 4-bit GEMM dispatch for B300 (SM103) #1
Description
Problem
The CUDA fused 4-bit GEMM implementation explicitly supports SM103, but the top-level custom-kernel versus dequantize_4bit + F.linear heuristic currently groups every compute capability 10.x device under thresholds calibrated on B200 (SM100).
The upstream kernel-introduction PR documented calibration on B200, not B300. B300 therefore has no hardware-specific evidence for the current routing decisions and may fall back too early or select the fused path after its crossover.
Baseline: 95f9af309d4d5793847169c39288dcd3fcbdf564 (upstream/main)
Planned branch: b300/sm103-4bit-gemm-dispatch
Scope
- Collect direct, interleaved B300 timings of the existing fused custom path versus the existing dequantize-and-linear fallback.
- If the measurements show a coherent and repeatable SM103-only crossover, split the Python top-level dispatch so SM103 has a conservative calibrated rule.
- Keep SM100 and every non-SM103 architecture bit-for-bit unchanged in dispatch decisions.
- Do not change CUDA kernels, C++ SIMT/MMA/tile selection, the CUDA build matrix, public APIs, or unrelated code.
- If no stable improvement survives repeated measurements, record that result and do not manufacture a patch.
Correctness
Compare the custom path, fallback path, and public matmul_4bit result on B300 across:
float16andbfloat16- NF4 and FP4
- nested quantization on/off
- bias on/off
- aligned model projection shapes and block sizes 32/64/128/256
- boundary token counts around any proposed dispatch thresholds
- non-aligned inner dimensions, which must continue to use the existing fallback
Run the relevant test_ops.py, test_functional.py, and test_autograd.py 4-bit tests plus the full pre-commit suite. All CUDA compilation and GPU execution will run through Slurm.
Performance acceptance
- Confirm the allocated GPU reports compute capability 10.3 before collecting evidence.
- Measure native SM103 and published-binary-compatible code paths separately; do not combine them into one conclusion.
- Use real model projection dimensions and a token-count sweep, with custom/fallback calls interleaved in the same allocation.
- Report warmup, repetitions, median, p10/p90 or IQR, raw results, environment, commit SHA, and Slurm job ID.
- Recheck crossover and outlier cells in independent rounds.
- Accept a dispatch change only when affected cells show no significant regression and the worst affected cell remains materially above measurement noise. Otherwise close development as not suitable for upstream.
Upstream context
- Fused 4-bit GEMM introduction and B200 calibration: [CUDA] New 4bit GEMM kernels for inference bitsandbytes-foundation/bitsandbytes#1949
- Hardware-specific dispatch calibration precedent: Add sm121 (GB10) tier to the 4-bit GEMM dispatch heuristic bitsandbytes-foundation/bitsandbytes#2030 and Add sm121 (GB10) to the wide_n_simt 4-bit GEMM dispatch rule bitsandbytes-foundation/bitsandbytes#2039
Activity