Skip to content

WIP: PD-DFlash — B2 serving-path §8 measurement + go/no-go - #165

Merged
drunkcoding merged 1 commit into
devfrom
feat/pd-dflash-b2-serving
Aug 16, 2026
Merged

WIP: PD-DFlash — B2 serving-path §8 measurement + go/no-go#165
drunkcoding merged 1 commit into
devfrom
feat/pd-dflash-b2-serving

Conversation

@drunkcoding

Copy link
Copy Markdown
Contributor

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_bytes
through the continuous-batching serving path, replacing the
BLOCKED_UNTIL_2D_SCHEDULER placeholder. Depends on #164 (native stat
accessors) 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-6
    verify budgets so Scheduler.verify_scheduling_enabled flips
    ContinuousBatchingEngine onto _step_speculative_session (the 2-D admission
    scheduler). Token budget/cap = block_size; expert-byte budget/cap are
    unbounded — exactly B2's "token-deficit scheduler and no expert-byte
    coupling"
    (BASELINES['B2']).
  • measure_configuration_serving() (_serving_measure.py): drives the
    engine via add_request/run_until_done (NOT MoE.generate()), captures
    real acceptance from each VerifyResult, resets native expert-cache counters
    around the timed window, and reads a real kv_occupancy_bytes by
    peak-sampling the serving PagedKVCache allocator. (The sync generate()
    path has no serving KV manager, hence B0/B1/B3 honestly report 0.0.)
  • run_experiment routes --baseline B2 through the serving path via
    SERVING_BASELINES; everything else keeps the existing MoE.generate() path.
  • CPU test asserts the B2 config enables the token-only verify scheduler.

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).

baseline tok/s goodput@SLO accept a TTFT s hit rate route-ahead cov wasted B expert occ (GB) kv occ (B)
B0 (AR, offloaded) 18.51 18.51 1.00 0.084 0.978 0.0 0 19.97 0 (no serving KV)
B1 (DFlash, AR prefetch) 62.07 62.07 1.00 0.081 0.894 1.0 0 18.86 0 (no serving KV)
B2 (2-D verify sched.) 79.81 79.81 7.98 0.123 0.999 1.0 0 20.55 1 572 864 (real)
B3 (resident upper bound) 84.56 84.56 1.00 0.084 0.890 1.0 0 18.45 0 (no serving KV)

Go/No-Go verdict (computed with the repo's own report.py)

  • report.validate_result_matrixPASS (all B0–B3 present, every §8 metric finite/non-negative; no blocked baseline).
  • report.evaluate_matrix — ok, blocked=[] missing=[] invalid=[].
  • Money-plot ordering B0 < B1 < co-design(B2) → B3: HOLDS18.51 < 62.07 < 79.81 < 84.56.
  • Route-ahead beats AR (B0→B1): yes (+235%).
  • Co-design B2 beats B1: yes (+28.6%), and closes 66% of the B1→B3 (resident) gap while remaining fully offloaded.
  • B2 kv_occupancy_bytes real (serving KV manager present): yes (1.57 MB, no fell back to 0.0 warning).

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

  • Hide inequality (§7): not evaluable from the Phase-A §8 schema — it needs
    t_draft / t_router (BM1, Task 7) and overlap (BM4, Task 10), which are
    not part of the B0–B3 row schema. Reported as out-of-scope for this B2 slice,
    not as a pass/fail.
  • Task 9 priority band (ship_priority_band) is a BM3-gated C++ hop and is
    not decided here (no C++ was touched). The strong route_ahead_coverage=1.0
    • hidden-fetch evidence (B2 approaches the resident B3) justifies proceeding
      to the BM3 three-way ablation, but the ship decision remains BM3's
      (bm3_decision), per "no C++ change ships without its BM".
  • B0/B1/B3 acceptance shows 1.0 because the sync path did not surface
    step_trace; B2's 7.98 is the real per-round acceptance from VerifyResult.

Verification

  • ruff + ruff-format clean; LSP clean on changed files.
  • CPU regressions: 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_sessionall pass.
  • gpt-oss offload no-regression: tests/test_gpt_oss_offload_topology.pypass.
  • B2 GPU run reproduced twice (smoke + 64-request), both real, no fallbacks.

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
drunkcoding marked this pull request as ready for review August 16, 2026 14:33
@drunkcoding
drunkcoding merged commit c8fdda5 into dev Aug 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant