Archived
New models and formats: - libr3d: a kernel library for RDNA3 (gfx11) cards - nomic-embed-text-v2-moe (the nomicbert plugin) - Gemma 4 E2B with its per-layer MLP width, and Google's unmodified E2B/E4B directories in bf16 - DeepSeek-V4.1-Flash converted straight from its release: the Engram tables, the fused imatrix and rad-convert --chat-template for a release that ships no template - GGUF Q8_0, Q4_K and Q6_K tensors import as their planes; rad-convert writes them without a recipe - Qwen3.8-Flash-Next-FP8 converts and serves through qwen4exp_fp8 Speed: - hc_read's decode kernels as one grid (34.7 -> 25.2 us at 4 rows) and its tiled up-mix pipelined - gemm_fp8a8: the narrow form's scales staged through LDS (Flash-Next int8 at 32 rows 83.6 -> 68.3 us), the gated three-tile form at 8 waves (gate_up at 48 rows 272.9 -> 180.6 us) - Qwen3.8-27B: the delta net's out-projection read beside its decode recurrent update (x1 19.40 -> 19.10 ms a step), and the verify's split-KV attention sized by context depth (x3 at 180K 42.4 -> 40.3 ms a step) - Hy-Memory (HYV3) decode: fused QK norm, RoPE and KV store, residual adds folded into the norms, coalesced one-token expert GEMMs - spechub: the coupled verify walks the live candidates only (151 -> 31 us a launch) Speculation: - DFlash2: lossless coupled acceptance at T > 0 (--draft-coupling on) - A block drafter's proposals verified as a tree, on by default for the Gemma 4 31B's DFlash2, with a block-16 tree that runs its short block under load Features: - Decode-hot residency: --draft-expert-placement host, --expert-profile, --expert-pin-top, and --expert-stats FILE for the routed experts each layer selects - --ngram-placement ram=DIR: one n-gram table shared by engines on separate cards - Prefix cache: --prefix-resume exact (default) resumes a hit on the cold run's own chunk grid, so it answers bit-identically; snapshots at a head other prompts share, from 528-token prompts, and for tip-only one drafter window below the tip; hits on models whose KV groups have different block sizes; the snapshot store keeps a floor of 8 ahead of --host-headroom-mib - Typed tool-call argument tags; rad-chatparse --request renders and reads back one request as the server does - MiniMax-H3: keyframes ride a latent upscale - Gemma 3's fused all-reduce junction on the lossy wire Fixes: - A speculative step shorter than its band (an MTP step of 4 rows at gqa 8) no longer stops the engine with a scratch refusal at issue (#293) - --p2p off: prefill back to 1.12.0's rate; 1.13.0's push check read a host-memory slot over the link twice (#323) - A chat template that cannot render a conversation is refused at load, not mid-request - imatrix entries found under llama.cpp's spelling; the W4A8 prefill's tail scale read; the GDN conv kernels on an f32 weight; dense integer rows at the group they compute (a Q8_0 weight at group 32) - --expert-profile refuses a profile recorded on another model - hc_read's one-grid wait traps past its deadline instead of reading a stale value Changes: Plugin ABI 31, unchanged. RADIANCE_DRAFT_TREE, DFLASH2_TREE_NODES, DFLASH2_TREE_TEMP and DFLASH_Q_TEMP are gone (trees run where the probe says they pay; temperatures 1.25 / 0.6).
69 lines
3.0 KiB
C
69 lines
3.0 KiB
C
/* r3d_fp8_dequant.h -- E4M3 -> f16 decode through a 256-entry LDS table.
|
|
*
|
|
* gfx11 has no E4M3-to-f16 instruction: `__builtin_amdgcn_cvt_pk_f16_fp8` compiles on gfx1102 but
|
|
* emits no `v_cvt_pk_f16_fp8`, only the same software exponent work as `e4m3_to_f32`. The codec in
|
|
* r3d_codecs.h costs about 25 instructions a pair, 100 an eight-code group. On the M=1 vocabulary
|
|
* head (r3d_vocab_bf16.hip, gfx1102, 32 CU) that makes the row ALU-bound at about 8x its DRAM floor.
|
|
*
|
|
* Every one of E4M3's 256 bit patterns has an exact f16 value (f16's exponent range covers E4M3's,
|
|
* subnormals included, and NaN maps to NaN), so the decoder is a 512-byte table and eight LDS reads
|
|
* replace about a hundred ALU instructions. The table lives in LDS, not __constant__: each lane
|
|
* decodes a different code, and divergent constant indexes serialise.
|
|
*
|
|
* Cost: 512 bytes of LDS a block and a 256-store fill plus a barrier at block start. Reads are
|
|
* 16-bit loads at data-dependent addresses; random codes put about two lanes on each bank word, for
|
|
* about two cycles a read.
|
|
*
|
|
* The table is filled by calling the codec once per entry, so results are bit-identical to the
|
|
* codec. Invariant: the table must be filled before any lane reads it; r3d_e4m3_f16_init contains
|
|
* the barrier.
|
|
*
|
|
* int8 codes need no table: `v_cvt_f32_i8` is a hardware instruction (r3d_codecs.h: i8x2_to_f16x2).
|
|
*
|
|
* Include in a .hip after r3d_codecs.h.
|
|
*/
|
|
#ifndef R3D_FP8_DEQUANT_H
|
|
#define R3D_FP8_DEQUANT_H
|
|
|
|
#include "r3d_codecs.h"
|
|
|
|
#define R3D_E4M3_TBL 256 /* every E4M3 bit pattern, in order, as the f16 it means */
|
|
#define R3D_E4M3_TBL_BYTES (R3D_E4M3_TBL * 2)
|
|
|
|
/* Fill the block's table: `tbl` is __shared__ uint16_t[R3D_E4M3_TBL]. Ends with the barrier that
|
|
* orders the fill before any read. */
|
|
__device__ __forceinline__ void r3d_e4m3_f16_init(uint16_t* tbl, int tid, int nthr)
|
|
{
|
|
for (int i = tid; i < R3D_E4M3_TBL; i += nthr)
|
|
tbl[i] = f32_to_f16(e4m3_to_f32((uint8_t)i));
|
|
__syncthreads();
|
|
}
|
|
|
|
/* Two codes (the low 16 bits of a dword) as one f16 pair in dot2_f16x2 layout, the first code in
|
|
* the low half. Same result as e4m3x2_to_f16x2. */
|
|
__device__ __forceinline__ uint32_t r3d_e4m3x2_ld(const uint16_t* tbl, uint32_t pair)
|
|
{
|
|
const uint16_t lo = tbl[pair & 0xffu];
|
|
const uint16_t hi = tbl[(pair >> 8) & 0xffu];
|
|
return (uint32_t)lo | ((uint32_t)hi << 16);
|
|
}
|
|
|
|
/* Eight codes (two dwords) as four f16 pairs; the fp8 counterpart of codes8_to_f16x4 in
|
|
* r3d_vocab_bf16.hip. */
|
|
__device__ __forceinline__ void r3d_e4m3x8_ld(const uint16_t* tbl, uint2 c, uint32_t* w)
|
|
{
|
|
const uint32_t d0 = c.x, d1 = c.y;
|
|
w[0] = r3d_e4m3x2_ld(tbl, d0 & 0xffffu);
|
|
w[1] = r3d_e4m3x2_ld(tbl, d0 >> 16);
|
|
w[2] = r3d_e4m3x2_ld(tbl, d1 & 0xffffu);
|
|
w[3] = r3d_e4m3x2_ld(tbl, d1 >> 16);
|
|
}
|
|
|
|
/* One code, for rows that decode a scalar per step (an activation tile staged a byte a lane). */
|
|
__device__ __forceinline__ uint16_t r3d_e4m3_ld(const uint16_t* tbl, uint8_t code)
|
|
{
|
|
return tbl[code];
|
|
}
|
|
|
|
#endif /* R3D_FP8_DEQUANT_H */
|