[PR #1095] [CLOSED] kv_q8: the gather decodes 8 int8 per thread (V100 experimental build, +11%) #3019

Closed
opened 2026-11-04 02:04:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1095
Author: @ATIVX928
Created: 10/6/2026
Status: ❌ Closed

Base: main ← Head: v100/kv-q8-gather-v2


📝 Commits (2)

  • 51402fe audit: where the int8 KV read decodes, and whether it is vectorized
  • af52a5e kv_q8: the gather decodes 8 int8 per thread (bitwise, +11% on the 32k microbench)

📊 Changes

3 files changed (+184 additions, -2 deletions)

View changed files

➕ bench/results/2026-10-03-v100-kv-int8-read/README.md (+51 -0)
📝 src/kernels/cuda/kv_q8.cu (+83 -1)
📝 src/kernels/kv_q8_parity.cpp (+50 -1)

📄 Description

Resubmitted from #1019: the original was auto-closed by the 2026-10-06 history cleanup. Rebased onto the new main (82f46a8); build and parity re-verified on 2x V100.

What

The int8 KV gather (kv_gather_q8_kernel, used by the 32K prompt path) decodes four int8 codes per thread. This decodes eight, with uint2/uint4 loads and stores, and falls back to the four-wide path when the alignment does not allow the wider access. It is the int8-gather piece of the V100 work in #627, split out on its own.

Gating

The wide kernel is compiled only under -DSTRATA_EXPERIMENTAL_SM60=ON and only launched on a device below cc 7.5 (pre75_q8_gather()), with STRATA_Q8_GATHER_WIDE=0 as the A/B arm. The ready-made engine compiles the original kernel; as a check, the non-experimental object's SASS sha256 is identical to main's (a4af40d8…, 54376 bytes).

Measured

V100-SXM2-16GB, CUDA 12.8, kv_q8_parity --bench, 2,051 selected cells at 32K:

path time bandwidth
4-wide (main) 15.9 us 399.8 GB/s
8-wide (this PR) 14.2 us 449.4 GB/s

+11.3% on the gather kernel.

32K end-to-end

2x V100-SXM2-16GB, 32,504-token prompt, int8 KV, MTP spec 4, expert-cache auto, prompt cache off; median of 5 rounds after a warm-up. Single-card prefill 1550.4 tok/s and dual-card 2203.0 vs main's 1557.1 / 2207.0 - within the +-1% session noise. The gather is a few tens of microseconds of a 21-second prefill, so the +11.3% stays a kernel-level gain.

Tests

  • kv_q8_parity PASS (worst INT8-vs-FP16 error 0.59 quantization steps), both the wide default and STRATA_Q8_GATHER_WIDE=0.

Notes

bench/results/2026-10-03-v100-kv-int8-read/README.md records the measurement and the footprint/bandwidth comparison of int8 vs q4_0 vs k8v4.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1095 **Author:** [@ATIVX928](https://github.com/ATIVX928) **Created:** 10/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `v100/kv-q8-gather-v2` --- ### 📝 Commits (2) - [`51402fe`](https://github.com/Niko1221/Strata/commit/51402fe88b8da32971a479bacc38ff04a7de00b5) audit: where the int8 KV read decodes, and whether it is vectorized - [`af52a5e`](https://github.com/Niko1221/Strata/commit/af52a5e847c0cbb81d7b3cd94ed0bb49b9e15b0b) kv_q8: the gather decodes 8 int8 per thread (bitwise, +11% on the 32k microbench) ### 📊 Changes **3 files changed** (+184 additions, -2 deletions) <details> <summary>View changed files</summary> ➕ `bench/results/2026-10-03-v100-kv-int8-read/README.md` (+51 -0) 📝 `src/kernels/cuda/kv_q8.cu` (+83 -1) 📝 `src/kernels/kv_q8_parity.cpp` (+50 -1) </details> ### 📄 Description > Resubmitted from #1019: the original was auto-closed by the 2026-10-06 history cleanup. Rebased onto the new `main` (82f46a8); build and parity re-verified on 2x V100. ## What The int8 KV gather (`kv_gather_q8_kernel`, used by the 32K prompt path) decodes four int8 codes per thread. This decodes eight, with `uint2`/`uint4` loads and stores, and falls back to the four-wide path when the alignment does not allow the wider access. It is the int8-gather piece of the V100 work in #627, split out on its own. ## Gating The wide kernel is compiled only under `-DSTRATA_EXPERIMENTAL_SM60=ON` and only launched on a device below cc 7.5 (`pre75_q8_gather()`), with `STRATA_Q8_GATHER_WIDE=0` as the A/B arm. The ready-made engine compiles the original kernel; as a check, the non-experimental object's SASS sha256 is identical to main's (`a4af40d8…`, 54376 bytes). ## Measured V100-SXM2-16GB, CUDA 12.8, `kv_q8_parity --bench`, 2,051 selected cells at 32K: | path | time | bandwidth | | --- | ---: | ---: | | 4-wide (main) | 15.9 us | 399.8 GB/s | | 8-wide (this PR) | 14.2 us | 449.4 GB/s | +11.3% on the gather kernel. ## 32K end-to-end 2x V100-SXM2-16GB, 32,504-token prompt, int8 KV, MTP spec 4, expert-cache auto, prompt cache off; median of 5 rounds after a warm-up. Single-card prefill 1550.4 tok/s and dual-card 2203.0 vs main's 1557.1 / 2207.0 - within the +-1% session noise. The gather is a few tens of microseconds of a 21-second prefill, so the +11.3% stays a kernel-level gain. ## Tests - `kv_q8_parity` PASS (worst INT8-vs-FP16 error 0.59 quantization steps), both the wide default and `STRATA_Q8_GATHER_WIDE=0`. ## Notes `bench/results/2026-10-03-v100-kv-int8-read/README.md` records the measurement and the footprint/bandwidth comparison of int8 vs q4_0 vs k8v4. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:04:59 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3019
No description provided.