Skip to content

Enable register-codebook W4A4 decode on Ada GPUs and add INT8 output heads - #13

Merged
iamwavecut merged 4 commits into
mainfrom
sm89-register-decode
Sep 12, 2026
Merged

iamwavecut merged 4 commits into
mainfrom
sm89-register-decode

Conversation

@iamwavecut

@iamwavecut iamwavecut commented Sep 12, 2026 •

Copy link
Copy Markdown
Owner

Ada GPUs currently use the shared-codebook W4A4 decode kernel even though the register-codebook path reduces decode time on RTX 4000 Ada. Enable the existing register implementation for SM89 with the same shape guards as SM120, leaving quantization, checkpoint layout, and other architecture dispatch unchanged.

Prepare OrbitQuant 0.9.8 and native 1.0.5, including managed-cache version isolation. Add a CUDA profiler regression that verifies the register kernel actually launches, and cover rejection/preservation of native 1.0.4 artifacts.

Validation: the integrated native build passed 260 GPU tests (30 platform skips) on RTX 4000 Ada / Torch 2.10.0+cu128. Ten complete Russian songs (warmup/control/candidate/candidate/control at CFG 1 and 1.5) preserved all PCM outputs. Mean semantic generation improved 1.33% and 6.39%; whole-song means were 39.882 → 39.244 s and 44.634 → 42.700 s, including unrelated VAE variation. Ruff and all 46 targeted package/provision tests passed after generated kernel-builder files were moved outside the source tree. The CI CPU suite also passed. GPU source/build and full metrics are durably archived; the disposable GPU has been deleted.

Add opt-in INT8 row-quantized output heads: orbitquant.Int8RowLinear / quantize_output_heads / absmax_int8_scales in Python and two CUDA operators in native 1.0.5 (quantize_rows_int8, matmul_int8_rows: one warp per output row, DP4A accumulation, 1..8 activation rows, BF16/FP16 output, optional bias). The native kernel and the torch._int_mm fallback share the epilogue float(sum) * (x_scale * w_scale) and derive scales with a true IEEE division (PyTorch's Python-scalar divisor path multiplies by a reciprocal and is 1 ulp off in some rows), so both paths return identical values. Heads stay in source precision unless the caller opts in.

INT8-head validation on RTX 4090 / Torch 2.10.0+cu128: the full native suite passed (333 passed, 30 platform skips), tests/test_int8_rows.py 81/81 bit-exact against torch._int_mm and tests/test_int8_head.py 10/10. On YuE2-3B the semantic head (32,769 classes) measured a mean forward KL of 0.0015 (top-1 agreement 0.914) and the ABC head 0.0002 over 128 forced positions; the DP4A head GEMV reached 937 GB/s. The PR Build kernels matrix (19 variants + manifest) and the CPU CI suite pass.

…ows_int8/matmul_int8_rows)

Opt-in per-row absmax INT8 for output heads kept outside the W4A4 packed
format: Int8RowLinear / quantize_output_heads in Python, plus two CUDA
operators in native 1.0.5 (quantize_rows_int8, matmul_int8_rows: one warp per
row, DP4A, 1..8 activation rows). The native kernel and the torch._int_mm
fallback share the epilogue float(sum) * (x_scale * w_scale) and derive scales
with a true IEEE division, so both paths return identical values (verified on
RTX 4090: 81 native + 10 Python tests, bit-exact against _int_mm).
The CUDA source now carries 14 kernel launches with launch checks (the two
INT8 row operators added two); the guard also names both new kernels.
@iamwavecut iamwavecut changed the title Enable register-codebook W4A4 decode on Ada GPUs Enable register-codebook W4A4 decode on Ada GPUs and add INT8 output heads Sep 12, 2026
@iamwavecut
iamwavecut merged commit 37d1216 into main Sep 12, 2026
23 checks passed
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