Archived
- every model serves without a GPU: libavx covers every op, so `--kernels libavx` alone serves every shipped container - Qwen3-ASR (zivius): speech to text on /v1/audio/transcriptions and live over /v1/realtime - /v1/messages works with Claude Code as it ships (gearwave00001) - a long agent conversation keeps its cached history when the client rewrites its last turn (manueloverride) - a stream's first event goes out with the first token, so llama-benchy measures prefill right - opt-in --prefill-interleave (Smellyyyy, baKon) and --prefill-span (keptn42) - four-rank TP releases the link early; four-rank selftests and docs/TP4.md (goodman-b) - NVFP4 and FP8 compressed-tensors imports (devmilan); tools/rad-export for finetunes and LoRA adapters (baKon) - many fixes, among them lost tokens on stop strings under concurrency, keep-alive, MiniCPM5 tool arguments and the CPU's vision and audio encoders - plugin ABI 17 and changed op schemas: out-of-tree plugins must be rebuilt
40 lines
2.0 KiB
Plaintext
40 lines
2.0 KiB
Plaintext
// R4D attention dispatch for the DFlash2 drafter: head_dim 128, 4 queries per KV head, paged
|
|
// block 16, sliding window. Instantiations of the h256/gqa6 kernel templates with WIN = 1.
|
|
//
|
|
// Decode only. Queries long enough for the query-tiled prefill kernel occur on a drafter only in
|
|
// prefill steps; the rows declare the decode band (q_len * gqa <= 64), so those resolve elsewhere.
|
|
//
|
|
// Rationale: a general unified-attention kernel (vLLM's) launches (q_blocks, kv_heads, segments)
|
|
// with q_blocks padded for capture, so most workgroups return immediately; on this shape it is
|
|
// 8-9x slower than the window-capped DRAM bound. R4D keeps the query inside the workgroup (up to 64 rows of
|
|
// q_len * gqa), so its grid is (splits, kv_heads, num_seqs) with no dead workgroups.
|
|
#include "r4d.h"
|
|
#include "r4d_common.h"
|
|
#include <cmath>
|
|
#include <algorithm>
|
|
using std::max;
|
|
// The decode kernel uses helpers from the prefill unit, so prefill is included first.
|
|
// Nothing here instantiates r4d_attn_prefill_kernel.
|
|
#include "r4d_attn_prefill_h256_gqa6.hip"
|
|
#include "r4d_attn_decode_h256_gqa6.hip"
|
|
|
|
// Tile, block size, row cap and merge: r4d_decode_launch_win (r4d_attn_decode_h256_gqa6.hip).
|
|
#define B_HEAD_DIM 128
|
|
#define B_GQA 4
|
|
#define B_TILE 16
|
|
// The h256 decode option set, including K prefetch 2 (head_dim 128 would not spill at 4, but 2 is
|
|
// 0.3-1.3% faster here with identical output), plus O_KRAW: one-round K loads
|
|
// (r4d_attn_decode_h256_gqa6.hip), 16 VGPRs at head_dim 128 with no occupancy loss.
|
|
#define B_OPT 20207163
|
|
|
|
extern "C" long r4d_attn_decode_h128_gqa4_scratch_bytes(const R4DArgs* a) {
|
|
return r4d_decode_scratch(a, r4d_decode_splits_win(a, B_TILE), B_OPT);
|
|
}
|
|
|
|
extern "C" int r4d_attn_decode_h128_gqa4_fp8kv(const R4DArgs* a, hipStream_t s) {
|
|
return r4d_decode_launch_win<B_HEAD_DIM, B_GQA, B_OPT, 0>(a, s);
|
|
}
|
|
extern "C" int r4d_attn_decode_h128_gqa4_bf16kv(const R4DArgs* a, hipStream_t s) {
|
|
return r4d_decode_launch_win<B_HEAD_DIM, B_GQA, B_OPT, 1>(a, s);
|
|
}
|