Archived
--kv-cache-dtype fp8_v4 | k6_v4 (RadBuildCtx::kv_quant, RadArchProbe::kv_quant_ok; ABI 23)
The flag sets the trunk's cache to E4M3 plus a RAD_KVQ_* layout; a plugin offers the layouts it serves in its probe and the server refuses any other, naming the plugin. qwen35_fp8 offers both at head_dim 256, gqa 6, and declares the group at head_dim 200 / 176 (the row's bytes / 2), so the core sizes pages as for fp8; a drafter's cache stays fp8. Qwen3.8-27B on two R9700s, KL against bf16 on 17 long documents: fp8 0.039963 (518,800 tokens of KV), fp8_v4 0.040076 (664,400), k6_v4 0.039965 (755,184); prefill and decode at fp8's speed. ABI 23: two trailing fields, the layout table regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c00a650bce
commit
1823ccd5e9
14 files changed
+238
-20
No files matched your search
+16
-1
@@ -881,7 +881,9 @@ RadBuildCtx Engine::build_ctx(int rank, int64_t max_tok) const {
|
||||
bc.tp_wire_lossy = cfg_.tp_wire_exact ? 0 : 1;
|
||||
/* The engine always states the KV dtype. RAD_DT_INVALID (zero) remains valid in the ABI for
|
||||
* other callers and means the plugin's default. */
|
||||
bc.kv_dtype = cfg_.kv_cache_dtype == "fp8" ? RAD_F8E4M3 : RAD_BF16;
|
||||
bc.kv_dtype = cfg_.kv_cache_dtype == "bf16" ? RAD_BF16 : RAD_F8E4M3;
|
||||
bc.kv_quant = cfg_.kv_cache_dtype == "fp8_v4" ? RAD_KVQ_V4
|
||||
: cfg_.kv_cache_dtype == "k6_v4" ? RAD_KVQ_K6V4 : RAD_KVQ_NONE;
|
||||
bc.tp_wire_min_bytes = cfg_.tp_wire_min_kb * 1024;
|
||||
bc.scope = "";
|
||||
bc.max_enc_patches = cfg_.mm_max_patches > 0 ? cfg_.mm_max_patches : 0;
|
||||
@@ -987,6 +989,19 @@ int Engine::declare() {
|
||||
cfg_.prefix_cache = false;
|
||||
}
|
||||
}
|
||||
/* fp8_v4 and k6_v4 are layouts only the plugin and libr4d's rows for them know. A plugin that
|
||||
* does not say it serves one (RadArchProbe::kv_quant_ok) would store plain E4M3 under a name
|
||||
* that promised a smaller cache, so the flag is refused rather than ignored. */
|
||||
if (cfg_.kv_cache_dtype == "fp8_v4" || cfg_.kv_cache_dtype == "k6_v4") {
|
||||
const int q = cfg_.kv_cache_dtype == "fp8_v4" ? RAD_KVQ_V4 : RAD_KVQ_K6V4;
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
if (!(pb.kv_quant_ok & (1 << q))) {
|
||||
RAD_ERR("--kv-cache-dtype %s: the '%s' plugin does not serve it for this model "
|
||||
"(fp8 does)", cfg_.kv_cache_dtype.c_str(), plugins_.arch_plugin.c_str());
|
||||
return RAD_E_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
/* Resolved here, not at argument parsing: the plugin states its drafter's depth, and it is
|
||||
* selected only once the container is open. Every consumer of `n_spec` (buffer sizing, kernel
|
||||
* bands, the scheduler's window) runs after this. rad_arch_probe is the core's only source of
|
||||
|
||||
Reference in new issue
Block a user