--prefill-head-alias (opt-in, --serve, one GPU): the output head's VRAM holds the prompt buffers while a prompt is read

The native output head is needed only to generate, the batched prompt path's buffers only to read a prompt. With the flag the head is unloaded while a prompt is read (its VRAM counted into the auto cache and the prompt path's hybrid borrowed/owned layout) and read back in before the first decode window. On an 8 GB RTX PRO 2000 Laptop (Windows, IQ3_XXS, 590 MiB reserve) the prompt chunk went from 512 to 2,048 tokens and prefill from 292.5 to 667.1 tok/s on a 29,854-token prompt; reads of up to 512 fresh tokens cost about 0.6-0.75 s more. Off by default: every new path is behind the flag. docs/PREFILL_HEAD_ALIAS.md has the measurements and limits.
This commit is contained in:
Maxim Mazurok authored and Niko1221 committed 2026-10-13 05:00:30 +02:00
1 parent 8488c06bba
commit 640ac438be
9 files changed
+319 -33

No files matched your search

+6
View File
@@ -13,9 +13,15 @@
namespace strata::core {
NativeHead::~NativeHead() {
unload();
}
void NativeHead::unload() {
if (weights_) strata::kernels::native_q6_k_unpack(weights_);
if (scratch_) cudaFree(scratch_);
if (weights_) cudaFree(weights_);
scratch_ = nullptr;
weights_ = nullptr;
}
bool NativeHead::load(const std::vector<std::string>& shards, int64_t n_in, int64_t n_out, std::string& err) {