Repository navigation
hostgap hold 5: untuned DFlash block 8 (FlashInfer draft, not dflash-tuned) +1.0-2.2% per user, token-identical; no effect on dflash-tuned - #213
Conversation
The DFlash hold wrote its profiles into prof4, the directory hold 4 used for
the MTP labels. --labels 'dflash-*' summarizes only the DFlash labels, so the
new summary does not repeat hold 4's MTP rows. The default ('*') keeps the
old behaviour.
The stock DFlash host traces of the DFlash hold export without a kernel table: CUPTI recorded the graph executions, copies and runtime calls but no kernel outside the graphs, and gap_analysis.py stopped on the missing table. It now analyses such a trace with graphs, copies and memsets only and flags it (eager_kernel_records: false); graph times and blocking host calls stay valid, busy time and idle attribution do not. summarize.py then derives the stock idle from the patched trace's GPU busy time, as it already does for a stock label without a trace, and names the reason in gpu_busy_source.
An empty match wrote an empty report without complaint. A patched label whose host trace lost its eager kernel records now says on stderr why it has no derived idle instead of leaving it out silently.
Evidence for the DFlash hold (2026-10-02 13:05-13:42 UTC, engine 6b1d344887) on bench's untuned dflash arm (block 8, FlashInfer draft attention), not on dflash-tuned (FA4 draft attention): - greedy outputs identical to stock on 192/192 requests (tokens, verify steps, correct-draft histograms) with pinned, equal pools (240K KV tokens, 128 mamba slots, running limit 128); validation matched every plan; - held cycle -0.9/-1.7/-1.3% at B = 1/8/32, a 4-13% share of the derived stock idle; the six blocking reads removed from the draft plan barely waited, and the draft planning still runs while the GPU idles; - served per-user rate +1.0-2.2% at c = 1-32 in one session of stock, hostgap, hostgap, stock (all twelve pairs 1.004-1.028). The README says the series changes nothing on dflash-tuned (code reading), that the patched arm stays below dflash-tuned, and that the one synchronization per cycle on dflash-tuned matches the wait for the previous verify's lengths. engine/sglang/README.md drops the pending DFlash check.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 955652b624
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| lost = traced is not None and any( | ||
| (entry.get('trace') or {}).get('eager_kernel_records') is False | ||
| for entry in traced['by_concurrency'].values() | ||
| ) |
There was a problem hiding this comment.
Evaluate missing kernel records per concurrency
When only one concurrency in a host-trace label loses its kernel table, this label-wide any(...) marks every concurrency unusable. For a stock label, valid traces at the other concurrencies then incorrectly borrow patched GPU-busy times; for a patched label, the continue below drops all derived-idle rows, including those backed by valid traces. Hold 5 happens to have missing records at every stock concurrency, but mixed future profile directories need this decision made inside the per-concurrency loop.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 9ae55f6: the busy-time source is now chosen per concurrency. A stock label borrows the patched trace only at a concurrency where it has no host-trace label or its own trace lost the eager kernel records. A patched label drops only the affected concurrency and says so on stderr. Nothing changes in the results: hold 5's stock traces lack the kernel table at all three concurrencies, so only the gpu_busy_source text changes (it now names the concurrency). Rerunning the script on holds 2 and 4 reproduces their committed derived_idle and before_after exactly. Evidence regenerated in b40eff3.
… is usable A label-wide check made one trace without eager kernel records disqualify every concurrency of its label: a stock label then borrowed the patched busy time even where its own trace was valid, and a patched label lost all its derived rows. The choice is now made per concurrency (Codex, #213). The derived values of holds 2, 4 and 5 are unchanged; only hold 5's gpu_busy_source text now names the concurrency.
…rency busy source)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b40eff3b7d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| own_trace = own_t is not None and not lost | ||
| trace = own_t if own_trace else None | ||
| busy_source = f'{base}-host' | ||
| if trace is None and patched is not None and (own is None or lost): |
There was a problem hiding this comment.
Fall back when this concurrency has no own trace
When an own host-trace label exists but lacks a usable trace for one concurrency (for example, that collected report is missing), own_t is None, yet this condition rejects the patched fallback because own is None and lost are both false. The loop then skips that concurrency at line 237 even if the patched label has a valid trace, leaving partial profile runs without a derived-idle row; allow the fallback whenever own_t is None as well as when its eager records were lost.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in edd525b. A stock concurrency now borrows the patched trace whenever its own trace is unusable: no host-trace label, no trace at that concurrency, a trace without eager kernel records, or one with no cycles. gpu_busy_source says which. bc56b4b adds tests/test_hostgap_summarize.py with synthetic traces; its first test fails on 9ae55f6 because the c = 8 row is missing. No result changes: summarizing holds 2, 4 and 5 with edd525b gives their committed derived_idle and before_after exactly. Hold 5's cycle_profiles.json is regenerated at edd525b (74c3a46).
|
Verdict: REQUEST CHANGES (head b40eff3) The measurements and their files hold up. Two items block: an inference about Validity
Equality
Served A/B, recomputed from the four raw
|
| c | Pair 1 | Pair 2 | Mean |
|---|---|---|---|
| 1 | 1.0042 | 1.0164 | 1.0103 |
| 2 | 1.0088 | 1.0199 | 1.0143 |
| 4 | 1.0058 | 1.0232 | 1.0145 |
| 8 | 1.0104 | 1.0246 | 1.0175 |
| 16 | 1.0160 | 1.0263 | 1.0211 |
| 32 | 1.0279 | 1.0158 | 1.0218 |
All 12 pairs fall in 1.004-1.028, and y moves by the same ratios.
ab_summary.py regenerates ab_dflash.json byte for byte.
One session of pairs, as the README and the body say.
Held cycle and the gap_analysis fix
- Regeneration. At b40eff3,
summarize.py ~/vp-data/hostgap/prof4 --labels 'dflash-*'reproduceshold5/cycle_profiles.json, apart fromgenerated_by. Against 955652b, the only changes are the per-concurrencygpu_busy_sourcetext and the head. - Holds 2 and 4. The new script also reproduces the committed
derived_idleandbefore_afterof hold 2 (prof2) and hold 4 (prof4 --labels 'mtp-*'). - Values. Changes of -0.86%, -1.69% and -1.29%. Derived stock idle of 1.43, 1.53 and 1.51 ms, of which 4%, 10% and 13% is removed.
gpu_busy_sourcenames the fallback at each concurrency. - Are the graph times within 0.2%?
- Per execution, as the README compares them: within 0.22%. The target verify graph differs by 0.02%, 0.01% and 0.13% at B = 1, 8 and 32; the draft graph by 0.01%, 0.17% and 0.22% (1.6856 against 1.6893 ms at B = 32). The README's figures (3.918 / 5.489 / 11.005 against 3.918 / 5.490 / 11.022, and so on) are right.
- Per cycle: the totals differ by up to 0.38% (+0.38%, -0.11% and -0.25%), because the draft graph runs 1.008-1.010 times per cycle in the stock traces against 1.014-1.016 in the patched ones.
- Either way the substitution moves the derived idle by at most about 0.03 ms (about 2%).
- The patched eager kernels (0.19-1.27 ms per cycle) are assumed equal in stock, and the README says they could not be compared.
The dflash-tuned comparison and framing
- Below
dflash-tuned. The patched arm's per-user rate is 0.893, 0.894, 0.907, 0.930, 0.949 and 0.963 ofdflash-tuned's confirmation means at c = 1-32, which is "4-11% below", derived across days. - Framing. The title, the README, the TASKS lines and the engine README all name the arm as bench's untuned
dflash(block 8, FlashInfer draft) and say it is notdflash-tuned. Nothing presents it as the tuned arm.
Blocking
-
The Profile: DFlash cycle split on the tuned arms; skip only complete profile runs #192 inference is stated as fact in two places. The body and README:314-320 label it ("This suggests (not traced on
dflash-tuned)"). Two places state it outright:- the README summary (lines 63-65): "the one synchronization per cycle the profile workstream found there matches the wait for the previous verify's lengths that every plan needs, not a removable read";
- TASKS.md:172: "whose one synchronization per cycle (PR Profile: DFlash cycle split on the tuned arms; skip only complete profile runs #192) matches the wait for the previous verify's lengths rather than a removable read".
Nothing traced the call site on
dflash-tuned. Say "suggests, by analogy with this arm's traces (not traced ondflash-tuned)" or similar in both. -
Codex P2 4167388504 on b40eff3 is unanswered. When a stock label exists but has no trace at one concurrency,
own_tis None,own is Noneandlostare both false, and the patched fallback is refused, so that concurrency gets no derived-idle row. The old code behaved the same, and it cannot affect hold 5 (every stock concurrency has a trace, without kernel records) or holds 2 and 4, as the reruns show. But the comment is valid: allow the fallback whenown_t is None, or reply with that scope.
Optional
- The body's "The two traces' graph times agree within 0.2%" could say "within 0.22% per execution". The per-cycle totals differ by up to 0.38% through the draft graph's execution count.
- The TASKS H6 row's "does nothing there (PR hostgap hold 5: untuned DFlash block 8 (FlashInfer draft, not dflash-tuned) +1.0-2.2% per user, token-identical; no effect on dflash-tuned #213)" could carry "(code reading)", as the task line does. So could the engine README's sentence that with FA4 draft attention "the drafter's plan does not go through any patched path, so the series changes nothing there" ("by code reading; not run").
Checks
- Pre-commit on the changed files is clean at 955652b and on the delta at b40eff3.
- The hostname grep on 955652b and on the delta is clean.
- Commits are authored and committed by Samuel Mausberg, with no attribution lines.
- Codex 4167345841 (on 955652b) was fixed in 9ae55f6 and answered.
tests/test_hostgap_plan.pyis the GPU plan check; it was not rerun here (hold 4 ran it on this engine, as stated).
…unusable A stock label with its own host-trace label but no usable trace at one concurrency (a missing report, say) skipped that concurrency instead of using the patched trace (Codex, #213). It now falls back whenever the own trace is absent, lost its eager kernel records or has no cycles, and says which in gpu_busy_source. Holds 2, 4 and 5 summarize to the same values.
CPU tests with synthetic traces: a stock label uses its own trace where it is usable and borrows the patched one where its trace is missing or lost the eager kernel records; a patched label drops only the concurrency whose trace lost them; --labels selects labels and rejects an empty match. The first test fails on 9ae55f6 (no row where the label's own trace is missing).
…nt per execution and per cycle The summary bullet and TASKS now say the dflash-tuned point is inferred from this hold's traces and not traced there; the README gives the graphs' agreement as 0.23% per execution and 0.38% (0.03 ms) per cycle; code reading is named for the FA4 claims. cycle_profiles.json regenerated at edd525b (values unchanged).
|
@codex review |
|
Verdict: APPROVE (head 74c3a46; provisional on Codex, which is running on this head) This is a delta review of b40eff3..74c3a46 (edd525b, bc56b4b, 74c3a46). Both of my blocking items are fixed, and so are the optional ones.
Everything I verified at 955652b and b40eff3 still holds: validity, the equality copies, the A/B ratios from the raw sweeps, the 4-11% comparison and the framing. This approval becomes final once Codex is clean on 74c3a46. |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…measured result as such - notes/stack.tex, host-gap paragraph: DFlash equality now covers all five patches with the attention cache pinned; the idle estimate comes from hold 5; the pending sentence becomes the measured result (+1.0-2.2% per request at c = 1-32, one session; held cycle -0.9 to -1.7%). The frontier does not move (the tuned arm serves 4-12% more per request, derived across days). The tuned-arm explanation is labelled an inference. The levers-table and H6 rows follow; both hostgap register entries add hold5/ and hold_dflash.sh; hostgap-served is removed. - Every remaining \pend in the notes and in the paper's appendices becomes a measured result from committed evidence (the DFlash cycle split, now cited as profile-dflash, which enters the notes register; block length against the served frontier) or a plain statement that the work was not done. Both pending lists are removed (paper Appendix F.2, the notes register's subsection), together with the text that explained [D] and [N-D] tags. - "Exactness pending" for the Triton verify kernel becomes "not classified"; "is to be repeated" becomes "was not repeated". - Reviewer's leftover from #212: plain-tuned-replayssm is named as exact up to rounding in the lossy paragraph; "exact runs/arms" there and in both registers become "non-lossy". - Appendices A and C: "128-column groups" and similar become "one scale per 128 weights", as in the main text. - Levers table cells tightened so the table fits its page.
This PR commits the DFlash side of the hostgap evidence: the hold that #163 left queued (
experiments/hostgap/hold_dflash.sh, run 2026-10-02 13:05-13:42 UTC, engine6b1d344887with patches 0001-0005). It ran on bench's untuneddflasharm: block 8 with FlashInfer draft attention, plus radix cache off, 128 mamba slots and a 1M-token KV cap. This is not bench's best-tuned DFlash arm:dflash-tuneddrafts with FA4, and the series does nothing there.Results (all from
evidence/hostgap/hold5/)SGLANG_HOSTGAP_VALIDATE=1and a stock repeat each give output identical to the first stock run on 192/192 greedy requests (64 prompts at c = 1, 8 and 32). The comparison covers token sequences, verify-step counts and correct-draft histograms; log-probabilities were not compared. The pools were pinned and equal in all four servers (240,000 KV tokens from a binding--max-total-tokens, 128 mamba slots, running limit 128, 94.5 GiB free at each start). In-engine validation matched at least 8,192 plans against the stock path, and the pinned-buffer guard waited 0 of 12,284 times. Files:equality/dflash/.ab_dflash.json.cycle_profiles.json.plan()does 6 device-to-host copies and 6cudaStreamSynchronizecalls per cycle, about 2.5 µs each. The host reaches them only after waiting inresolve_seq_lens_cpufor the previous verify, so the stream has already drained. With the series no blocking call is left under the draft plan, but the planning itself is still the largest idle site, about 0.93 ms per traced cycle, because it can only start once the lengths arrive.What it means for the frontier and for
dflash-tuneddflash-tuned's per-user rate at c = 1-32. That comparison is derived across days from bench's three confirmation sessions inevidence/bench/confirm/points.csv. The DFlash frontier does not move.dflash-tuned. DFlash never runs 0001/0002. Its target verify already uses SGLang's sync-freefast_prefill_plan. 0003 changes only the FlashInfer drafter's plan, and with an FA4 draft the drafter's metadata goes through the FlashAttention backend, which the series doesn't touch. The upstream port, [Spec] Plan FlashInfer EAGLE verify and draft from host-known lengths (SGLANG_ENABLE_SYNC_FREE_SPEC_PLAN) sgl-project/sglang#42195, leaves the DFlash plan out altogether.cudaStreamSynchronizeper cycle ondflash-tuned(1.71 ms traced at c = 1) and an untraced gap of at most about 0.66 ms at c = 1. This hold's traces show the same pair per cycle: one stream synchronization inresolve_seq_lens_cpu, growing with B, and one 5 µs event synchronization. That suggests (inferred from this hold's traces, not traced ondflash-tuned) that the tuned arm's synchronization is the required wait for the previous verify's lengths, not a removable read. Its gap would then be host work after the lengths arrive. A port to the tuned arm would have to make that host path cheaper; removing synchronizations would not reach it.Code changes (committed before the evidence was generated)
experiments/hostgap/summarize.py --labels <pattern>: the DFlash labels share hold 4's profile directoryprof4, and this summarizes only them. It fails if nothing matches.experiments/hostgap/gap_analysis.py: this hold's stock host traces exported with no kernel table. CUPTI kept the graph executions, copies and runtime calls but no kernel outside the graphs, and the analysis crashed on that. Such a trace is now analysed from graphs, copies and memsets, and flaggedeager_kernel_records: false.summarize.pythen derives the stock idle from the patched trace's GPU busy time, wherever the stock label's own trace at that concurrency is missing or unusable (Codex), and records the reason ingpu_busy_source.tests/test_hostgap_summarize.pycovers that choice. The two traces' graph times agree within 0.23% per execution and 0.38% (0.03 ms) per cycle, which supports that substitution.Validity
Every server ran from a clean worktree, either at repository
8f9a765(main6f70a23plushold_upstream.sh, which this hold doesn't run) or at engine6b1d344887/ stockbd66ce343e. Every server passed bench's launch checks: graphs captured, overlap scheduler on, capacity 128, FlashInfer attention. The steps ran in the declared order (hold5/hold_dflash.log). No step printed a failure, and the GPU was clean at the end. The lock wrapper doesn't record exit codes, so a zero exit is inferred from the script logic: the log has no failure line. Five of the six py-spy windows were invalidated (a request ended during them), so there is no py-spy comparison. The hold did not rerun the GPU plan check or unit tests; hold 4 ran both on this engine.Checks
pre-commit run --fileson every changed file passes (ruff, mypy, codespell, host-identity guard).summarize.pywith a pattern that matches nothing exits 2 with an error.pytest tests/test_hostgap_summarize.py: 3 passed; the first test fails on9ae55f6.edd525b, whichcycle_profiles.jsonrecords asgenerated_by. Rerunning thatsummarize.pyon holds 2 and 4 reproduces their committedderived_idleandbefore_afterexactly.evidence/hostgap/README.mdgives the command behind every file in its Reproduction table.TASKS.md: H6, the hostgap row and the DFlash task line (review, hostgap hold 5: untuned DFlash block 8 (FlashInfer draft, not dflash-tuned) +1.0-2.2% per user, token-identical; no effect on dflash-tuned #213); the branch merges main a5c82d4.Review rounds
summarize.py: the eager-kernel check was label-wide, so one bad trace would have disqualified every concurrency of its label. Fixed in 9ae55f6 by deciding per concurrency. No result changes: hold 5 has no kernel table at any stock concurrency, and only itsgpu_busy_sourcetext now names the concurrency. Rerunning the script on holds 2 and 4 gives their committed derived values exactly. Evidence regenerated in b40eff3.summarize.py: a stock label whose own trace was missing at one concurrency did not fall back to the patched trace. Fixed in edd525b;tests/test_hostgap_summarize.pyadded in bc56b4b. No result changes for holds 2, 4 or 5.dflash-tunedstatement is now labelled as inferred from this hold's traces, not traced ondflash-tuned. Graph agreement is now given as 0.23% per execution and 0.38% (0.03 ms) per cycle, and "code reading" is named for the FA4 claims (74c3a46).