Archived
core/sched: a prefix hit resumes on the cold run's chunk grid, so it recomputes the cold run's own chunks
A hit recomputes the tokens past where it resumes. Kernels may round a row differently at another chunk length (spec §17: the fp8 GEMM's split-K count is chosen from M), so a hit that recomputes its tail in other chunks than a cold prefill of the same prompt can flip a near-tie in greedy text. On the DeepSeek-V4.1 daily (TP4) a 24k-token prompt that hit a 16k one's tail snapshot resumed at 15856, ran a 528-token chunk to the next boundary and answered differently from its cold run. --prefix-resume exact, the default: - ChunkGeometry carries the grid an idle server's cold prefill chunks on: --max-num-batched-tokens rounded down to the quantum, or the checkpoint interval where chunks split at it and it is the smaller, times the span from the second interval on. - plan_chunk writes checkpoints only on that grid. A prompt's tail snapshot is taken where its last chunk starts (sliding-window snapshots keep their one-block margin) instead of at its last quantum boundary. The chunk already ends there, so a long cold prompt no longer runs a short extra step at its end. - A checkpoint interval past the chunk must be a multiple of it; otherwise it is rounded up, and startup says so. - admit_one steps a hit with no snapshot to resume from (full attention) back to the grid. A request's own checkpoint (Request::checkpoint_at, /v1/systemone's shared head) is honored where it falls. --prefix-resume nearest keeps the previous rule. The cost is re-prefill: an exact repeat runs the cold run's last chunk again, and an agent's next turn resumes where the previous prompt's last chunk started, about half a chunk more than nearest (2048 tokens at a 4096-token budget). The property holds on an idle server; a prefill that shares its steps with decode rows or other requests (--busy-prefill-chunk, --prefill-interleave) is cut differently, as batching already changes greedy text. Tests: sched_test covers the grid for six geometries (GDN hybrid, interval past the budget, span, periodic and tip-only window snapshots, full attention), the interval rounding, the tail snapshot at the last chunk start, admission stepping back to the grid, and a property over prompt lengths: every checkpoint is a chunk start of the cold run of its prompt and of any longer prompt it prefixes, and a hit from it cuts the cold run's chunks. config_test covers the flag.
This commit is contained in:
1 parent
f43929ccb8
commit
662b7720b5
9 files changed
+449
-4
No files matched your search
@@ -437,6 +437,7 @@ const std::map<std::string, std::vector<std::string>>& legal_values() {
|
||||
{ "--placement", { "all_vram" } }, { "--checkpoint-interval", { "256" } },
|
||||
{ "--prefill-span", { "2" } },
|
||||
{ "--checkpoint-slots", { "4" } }, { "--checkpoint-policy", { "tip-only" } },
|
||||
{ "--prefix-resume", { "nearest" } },
|
||||
{ "--num-speculative-tokens", { "2" } }, { "--draft-window", { "fixed" } }, { "--draft-short-from", { "4" } },
|
||||
{ "--draft-coupling", { "on" } },
|
||||
{ "--host", { "127.0.0.1" } }, { "--port", { "8001" } }, { "--api-key", { "k" } },
|
||||
@@ -865,6 +866,20 @@ TEST(expert_stats_is_off_until_it_names_a_file) {
|
||||
CHECK(parse_fresh({ "--expert-stats" }) < 0);
|
||||
}
|
||||
|
||||
/* A prefix hit resumes on the cold run's chunk grid unless the operator trades that for a shorter
|
||||
* re-prefill; any other word is refused. */
|
||||
TEST(prefix_resume_is_exact_unless_nearest_is_asked_for) {
|
||||
Config d;
|
||||
CHECK_EQ(parse({}, &d), RAD_OK);
|
||||
CHECK(d.prefix_exact);
|
||||
Config c;
|
||||
CHECK_EQ(parse({ "--prefix-resume", "nearest" }, &c), RAD_OK);
|
||||
CHECK(!c.prefix_exact);
|
||||
CHECK_EQ(parse({ "--prefix-resume", "exact" }, &c), RAD_OK);
|
||||
CHECK(c.prefix_exact);
|
||||
CHECK_EQ(parse({ "--prefix-resume", "deepest" }, &c), RAD_E_INVAL);
|
||||
}
|
||||
|
||||
/* --checkpoint-slots is auto by default, resolved by the engine once a snapshot's size is known;
|
||||
* a count is taken as given, 0 included, and the report shows which. */
|
||||
TEST(the_checkpoint_slots_are_auto_or_a_count) {
|
||||
|
||||
Reference in new issue
Block a user