sycl: lend cache slots to the prompt path above a 32K context - 80,000 tokens at 1,062 tok/s, decode 35-40 after
Without borrowing, the VRAM reserve for the KV state and the chunk buffers evicts ~1,900 experts, the prompt streams them (790 tok/s at 80,000 tokens) and decode after it runs at 2 tok/s. Borrowing lends ~940 slots and refills them in ~1 s: 1,062 tok/s and 35-40 tok/s decode. It costs ~1 s per prompt at short contexts (2,184 tokens 610 vs 792 tok/s), so the default is by context: borrow above 32K. --prefill-borrow / --no-prefill-borrow decide explicitly; layer splits keep their own buffers as before.
This commit is contained in:
1 parent
14e0c017bb
commit
04e00c08c6
2 files changed
+15
-3
No files matched your search
+6
-2
@@ -280,8 +280,12 @@ output tokens between paths, never only timings.
|
||||
dequant 12.7 s, QSA block selection 9.3 s (0.2 s at 8k: it scans every block of the context per query), gate/up
|
||||
GEMM 8.9 s, gather 6.1 s, the per-layer grouping sync 5.2 s, GDN recurrence 4.8 s. The PLE rows are free at this
|
||||
scale (97.6% row-cache hits).
|
||||
- **Open: decode after such a prompt runs at 2-3 tok/s**, because the experts the reserve pushed out of the cache
|
||||
stay out; the prompt buffers should give their VRAM back to the cache when the prompt ends.
|
||||
- **Decode after such a prompt, and the fix.** Without lending cache slots to the prompt path (`--no-prefill-borrow`,
|
||||
which the port used from the start) the reserve evicts ~1,900 experts for good and decode after the prompt runs at
|
||||
2 tok/s. Borrowing lends ~940 slots to the prompt path and refills them in about a second afterwards: 80,000
|
||||
tokens in 75 s = **1,062 tok/s, decode 35-40 tok/s** after it, at `--vram-reserve-mib 2048 --prefill 4096`.
|
||||
It costs ~1 s on short prompts (2,184 tokens: 610 vs 792 tok/s), so the port borrows by default only above a
|
||||
32K context (`--prefill-borrow` / `--no-prefill-borrow` decide explicitly).
|
||||
|
||||
**Keeping up with upstream.** A merge of upstream `main` into `b70` leaves the copies in `sycl/` behind
|
||||
wherever upstream touched a file they mirror. They are refreshed by re-migration, not by hand (done for
|
||||
|
||||
@@ -981,6 +981,7 @@ int main(int argc, char** argv) {
|
||||
#endif
|
||||
}
|
||||
Options o;
|
||||
bool borrow_explicit = false; // SYCL port: --prefill-borrow / --no-prefill-borrow given (else chosen by context)
|
||||
bool have_tokens = false;
|
||||
bool have_logits_stride = false;
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
@@ -1082,7 +1083,8 @@ int main(int argc, char** argv) {
|
||||
o.prefill_chunk = o.prefill_auto ? 8192 : std::atoll(v.c_str());
|
||||
}
|
||||
else if (a == "--no-split-rows") o.no_split_rows = true;
|
||||
else if (a == "--no-prefill-borrow") o.no_prefill_borrow = true;
|
||||
else if (a == "--no-prefill-borrow") { o.no_prefill_borrow = true; borrow_explicit = true; }
|
||||
else if (a == "--prefill-borrow") { o.no_prefill_borrow = false; borrow_explicit = true; }
|
||||
else if (a == "--prefill-until") o.prefill_until = std::atoll(next("--prefill-until"));
|
||||
else if (a == "--dump-final-r") o.dump_final_r = next("--dump-final-r");
|
||||
else if (a == "--spec") o.spec = std::atoi(next("--spec"));
|
||||
@@ -1245,6 +1247,7 @@ int main(int argc, char** argv) {
|
||||
return 2;
|
||||
}
|
||||
o.no_prefill_borrow = true; // each stage's prompt path has its own buffers
|
||||
borrow_explicit = true;
|
||||
int n_vis = 1;
|
||||
if (DPCT_CHECK_ERROR(n_vis = dpct::device_count()) != 0 || n_vis < 1)
|
||||
n_vis = 1;
|
||||
@@ -1269,6 +1272,11 @@ int main(int argc, char** argv) {
|
||||
std::fprintf(stderr, "strata generate: layer split across %zu GPUs: CUDA0, then CUDA%s (split %s)\n",
|
||||
split_devs.size() + 1, devs.c_str(), o.layer_split.c_str());
|
||||
}
|
||||
// SYCL port (the B70, 2026-09-30): lending cache slots to the prompt path costs ~1 s per prompt (2,184 tokens:
|
||||
// 610 vs 792 tok/s) but is what keeps every expert in VRAM at a long context - 80,000 tokens without it: the
|
||||
// reserve for the KV and the chunk buffers evicts ~1,900 experts, prompt 790 tok/s and decode 2 tok/s after it;
|
||||
// with it: 1,062 tok/s and 39.5 tok/s. So by default only above a 32K context; the flags still decide.
|
||||
if (!borrow_explicit) o.no_prefill_borrow = o.max_context <= 32768;
|
||||
if (o.prefill_auto && (o.no_prefill_borrow || o.expert_profile.empty())) {
|
||||
o.prefill_auto = false; // nothing to lend from: the buffers are reserved for the session, so keep them small
|
||||
o.prefill_chunk = 2048;
|
||||
|
||||
Reference in new issue
Block a user