WIP: PD-DFlash — B2 serving-path §8 measurement + go/no-go - #165
Merged
Conversation
Replace the B2 BLOCKED_UNTIL_2D_SCHEDULER placeholder with a real serving-path measurement that drives moe_infinity.serving.engine.ContinuousBatchingEngine instead of MoE.generate(). Task 6 (SpecSession + 2-D verify scheduler + native stat accessors) is merged on dev, so B2 only needs runner wiring: * build_b2_serving_config() sets all four Task-6 verify budgets so Scheduler.verify_scheduling_enabled flips the engine onto _step_speculative_session (the 2-D admission scheduler). The token budget/cap equal block_size while the expert-byte budget/cap are unbounded -- exactly B2's 'token-deficit scheduler and no expert-byte coupling'. * measure_configuration_serving() runs deterministic greedy requests through add_request/run_until_done, captures real acceptance from each VerifyResult, clears native expert-cache counters around the timed run, and reads a real kv_occupancy_bytes by peak-sampling the serving PagedKVCache allocator (the sync generate() path has no serving KV manager and falls back to 0.0). Opt-in and GPU-gated; default serving behaviour is unchanged. Adds a CPU test asserting the B2 config enables the token-only verify scheduler. gpt-oss-20b B16/c1 slice, one RTX PRO 6000 (measured H2D 57.6 GB/s): B0=18.51 B1=62.07 B2=79.81 B3=84.56 tok/s B2 kv_occupancy_bytes=1572864 (real), coverage=1.0, hit=0.999, a=7.98 validate_result_matrix passes; ordering B0 < B1 < B2 -> B3 holds.
drunkcoding
marked this pull request as ready for review
August 16, 2026 14:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP: PD-DFlash — B2 serving-path §8 measurement + go/no-go
DRAFT — do not merge. Closes out the Phase-A §8 go/no-go by measuring B2
(the co-designed 2-D verify-scheduler baseline) and a real
kv_occupancy_bytesthrough the continuous-batching serving path, replacing the
BLOCKED_UNTIL_2D_SCHEDULERplaceholder. Depends on #164 (native stataccessors) and Task 6 (SpecSession + 2-D verify scheduler + engine wiring),
both already on
dev.What this PR does (runner wiring only — no engine/scheduler/session change)
Task 6's engine wiring is already merged, so B2 needed only benchmark-runner
wiring — no architectural change:
build_b2_serving_config()(pd_dflash_serving.py): sets all four Task-6verify budgets so
Scheduler.verify_scheduling_enabledflipsContinuousBatchingEngineonto_step_speculative_session(the 2-D admissionscheduler). Token budget/cap =
block_size; expert-byte budget/cap areunbounded — exactly B2's "token-deficit scheduler and no expert-byte
coupling" (
BASELINES['B2']).measure_configuration_serving()(_serving_measure.py): drives theengine via
add_request/run_until_done(NOTMoE.generate()), capturesreal acceptance from each
VerifyResult, resets native expert-cache countersaround the timed window, and reads a real
kv_occupancy_bytesbypeak-sampling the serving
PagedKVCacheallocator. (The syncgenerate()path has no serving KV manager, hence B0/B1/B3 honestly report
0.0.)run_experimentroutes--baseline B2through the serving path viaSERVING_BASELINES; everything else keeps the existingMoE.generate()path.Opt-in and GPU-gated; default serving/hot-path behaviour is unchanged.
Measurement — gpt-oss-20b, B=16, concurrency=1, one RTX PRO 6000 (SM120), measured H2D 57.6 GB/s
Primed FP4 offload dir reused; B2 measured via serving path this PR; B0/B1/B3
are the prior real rows (they are defined on the sync path and keep it).
aGo/No-Go verdict (computed with the repo's own
report.py)report.validate_result_matrix— PASS (all B0–B3 present, every §8 metric finite/non-negative; no blocked baseline).report.evaluate_matrix— ok,blocked=[] missing=[] invalid=[].B0 < B1 < co-design(B2) → B3: HOLDS —18.51 < 62.07 < 79.81 < 84.56.kv_occupancy_bytesreal (serving KV manager present): yes (1.57 MB, nofell back to 0.0warning).VERDICT: GO. The matrix is complete and all-real; the design §8 ordering holds; the co-design B2 delivers a measurable win over B1 on the serving path.
Scope notes / honest limitations
t_draft/t_router(BM1, Task 7) andoverlap(BM4, Task 10), which arenot part of the B0–B3 row schema. Reported as out-of-scope for this B2 slice,
not as a pass/fail.
ship_priority_band) is a BM3-gated C++ hop and isnot decided here (no C++ was touched). The strong
route_ahead_coverage=1.0to the BM3 three-way ablation, but the ship decision remains BM3's
(
bm3_decision), per "no C++ change ships without its BM".1.0because the sync path did not surfacestep_trace; B2's7.98is the real per-round acceptance fromVerifyResult.Verification
ruff+ruff-formatclean; LSP clean on changed files.test_pd_dflash_serving_contract,test_pd_dflash_report,serving
test_sequence/test_batch/test_scheduler/test_dflash_deficit_scheduler,dflash
test_engine_wire/test_route_ahead_wire/test_spec_session— all pass.tests/test_gpt_oss_offload_topology.py— pass.