This repository has been archived on 2026-11-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
radiance-sycl/libr4d/r4d_attn_paged_h128_gqa16.hip
keptn42 7cad854f2b libr4d: the gqa16 decode takes a verify of eight rows, so a draft step matches its single-row decodes
The h128/gqa16 decode row stopped at q_len 4 (64 query-head rows a workgroup), so LiLiCorr's
verify of 7 drafts and the anchor (q_len 8) ran the query-tiled prefill kernel while a plain decode
runs the split-KV one: no verify row was the single-row decode at its position, and greedy text
with the drafter left the text without it within a few hundred characters at one and two ranks.
The gqa16 unit raises G8_MAX_DECODE_ROWS to 128, which compiles an eight-wave arm into the gqa8
body's decode launch; gqa8 and every other unit compile as before. The rows take q_len <= 8.

Selftest: the numeric cases at q_len 8, and attn_verify_bits_case, eight verify rows against eight
single decodes bit for bit at 120, 700 and 2048 keys (gqa 16, and gqa 8 for four ranks).
docs/ARCHITECTURES.md: past 2048 keys the split law partitions a verify and a decode differently,
so a near-tie can still flip greedy text.
2026-11-04 22:08:53 +01:00

21 lines
1.1 KiB
Plaintext

// R4D attention at sixteen queries per KV head, head_dim 128: Nemotron-H's attention layers (32
// query heads over 2 KV heads) at one and two ranks. Geometry only; r4d_attn_paged_gqa8.hip is the
// body. The ratio changes two bounds, both stated in the row table:
//
// decode verify width 128 / gqa = 8 (a workgroup of eight waves holds 128 (query, head) rows).
// prefill block width 384 / gqa = 24 query positions.
//
// The verify width is the drafter's: LiLiCorr proposes 7, so a verify is 8 query rows. At 64
// rows (q_len <= 4) those rows ran the query-tiled prefill kernel while a plain decode runs this
// split-KV one, so no verify row was the single-row decode at its position, and greedy text with
// the drafter left the text without it at one and two ranks within a few hundred characters (gqa
// 8, four ranks, already verified here). A wave holds one query's 16 heads in both launches.
//
// No head_dim 256 leg (R4D_ATTN_H256 0): nothing in scope is gqa 16 at 256. Page size 16.
#define R4D_ATTN_GQA 16
#define G8_MAX_DECODE_ROWS 128
#define R4D_ATTN_H128 1
#define R4D_ATTN_H256 0
#include "r4d_attn_paged_gqa8.hip"