From 84111c9795442f9f44fa484ea2115cbce063e6d9 Mon Sep 17 00:00:00 2001 From: SergiioB <119968745+SergiioB@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:52:24 +0100 Subject: [PATCH 1/2] docs(xpu): the prompt cache's state size and what the 2 GiB default holds With the DFlash2 drafter, a Qwen3.8-27B state with bf16 K/V takes 64 KiB a prompt token plus 187 MiB, so the default budget keeps nothing past about 29,700 tokens. Say so next to the budget, with the log line that shows it, that the budget is shared by the streams, and that a larger budget needs a smaller --context on one card. --- docs/xpu/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/xpu/README.md b/docs/xpu/README.md index edddef11648..5335ff527b7 100644 --- a/docs/xpu/README.md +++ b/docs/xpu/README.md @@ -57,6 +57,14 @@ context (~0.8 GB at 9.7 k tokens). A resume gives exactly the state of a full pa answer, bit for bit. Budget: `--prompt-cache-gib` (2 GiB by default, reserved before the streams: 6 streams instead of 7 in GPTQ at 16 k; `0` disables it). The core keeps nothing below 4,096 tokens. Measured on a 9.7 k-token document: the same request replayed 6.1 → 1.2 s, the next turn of a conversation 6.1 → 1.1 s. +With the DFlash2 drafter, a kept state with bf16 K/V takes 64 KiB a prompt token plus 187 MiB (147 MiB without a +drafter), so the default budget keeps nothing past about 29,700 tokens: the log says +`kept nothing at N tokens: M MiB passes the 2048 MiB budget`, and a later turn resumes from the last state that +fit, or from the start when none matches. The budget is shared by the streams: give a conversation you want resumed +a budget above its state and a `--context` that leaves room for it. On one 32 GB card, measured on the MLX 4-bit +checkpoint at `--parallel 1`, 3 GiB at `--context 40960` holds a 32 k-token conversation (first token 0.3–0.6 s, +against 22 s with nothing kept), while 3 GiB beside `--context 139264` does not fit and the server refuses to +start. Prefix shared between different requests: put the common base in the **system** message (or in the tools); the server places points at the end of the system prefix (and 512 / 2,048 tokens before it), and any request that shares that system message restarts from there, whatever follows (measured: two other questions on the same 9.7 k-token From f3ea65ed856fa1706959133c93a2367fbc5699c6 Mon Sep 17 00:00:00 2001 From: ashhart <71890694+ashhart@users.noreply.github.com> Date: Thu, 19 Nov 2026 23:20:24 +0000 Subject: [PATCH 2/2] changelog: #3972 under Unreleased --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 164b20692fb..7c99b328695 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel ## Unreleased +- Docs: the XPU guide gives the size of a Qwen3.8-27B prompt-cache state with the DFlash2 drafter and bf16 K/V (64 KiB a prompt token plus 187 MiB), so the 2 GiB default keeps nothing past about 29,700 tokens, the log line that says so, and that a larger budget needs a smaller `--context` on one card (#3972). Thanks to @SergiioB. + - HIP: prompt attention's permlane16 fetches inactive lanes (#4080, fixes #3765). - Docs: on unified memory, `MemAvailable` can settle a little above the reserve after start-up and the pool's page count can differ by a few tens between launches with the same settings, because the room is read once while the host is still settling (#4079, fixes #3940). Thanks to @Bizuayeu.