Repository navigation
Profile: DFlash cycle split on the tuned arms; skip only complete profile runs - #192
Conversation
run_all.sh skipped any run directory whose windows.jsonl was non-empty, so a DFlash sweep interrupted after one window would be skipped on resubmission and its partial windows analysed (Codex on #173). run_profiles.py --check-complete now compares a directory with every window record its arguments plan (and each collected window's report); prof() skips only a complete run and moves an incomplete one aside to <dir>.set-aside-<UTC time> before repeating it whole. run_profiles.py refuses a directory that already holds windows.jsonl, so one file always records one server session. check_run.py applies the same check to a run directory from the command in its run_meta.json; analyze_all.sh stops on an incomplete DFlash run. dflash_cycle.py splits the DFlash cycle into draft forward, the drafter's context KV, draft head, verify forward, verify head, GDN commit, sampling and bookkeeping, gaps inside graphs and the host gap, adds the untraced cycle from the repeated windows and the derived head share, and refuses to write unless every planned window and attribution is present and valid. attribute.py: SGLang's Triton attention (_fwd_kernel*) counts as full attention; DFlash's eager GEMM, norm, RoPE and KV-write kernels after verify (the drafter's KV from the verified target features) get their own category, draft_context_kv, instead of the target's; and a launch without a kernel record counts as dropped only if the main stream recorded a later kernel (the host can lead the GPU past the end of collection).
Evidence from run_all.sh dflash (hold 2026-10-02 07:45-08:00 UTC, repository 5bc91db, SGLang bd66ce34), analysed with ba8c325: attributions of the eight traces of dflash-tuned-b16 and dflash-tuned at c = 1, 4, 16, 64, their client windows and start-up logs, dflash_cycle.json/csv (the cycle by phase with the untraced cycle and the derived head share), and dflash_breakdown.csv (same columns as breakdown.csv, which is unchanged). README section with the results, the estimator's error and the context offset between traced and untraced windows. The plain, MTP and plain-rerun attributions are regenerated with the corrected completeness check: only eager_kernel_records_per_launch_call changes (plain 0.9991-0.9996 to 1.0), eager_launch_calls_after_collection is added, and host_sync_calls is filled for plain B = 8 and 32; every category and kernel row is unchanged.
|
@codex review |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da195a4212
ℹ️ 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".
| rows, problems = read_windows(path) | ||
| if not rows and not problems: | ||
| return ABSENT, [f'{path} has no records'] | ||
| problems += window_problems(rows, args.arm, args.mode, args.concurrency, args.repeats) |
There was a problem hiding this comment.
Compare all profiling arguments before skipping a run
When an existing directory has the same arm, mode, concurrency list, and repeat count but was produced with different profiling options, this check still returns COMPLETE; options such as --graph-trace, --trace, --window, --host-trace, and --extra-server-args are never compared with run_meta.json. Consequently, after changing one of those options in run_all.sh, prof silently skips the old run and preserves evidence collected under the previous configuration. Compare the normalized current arguments with the recorded command before declaring the run complete.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 566a84f. --check-complete now also compares the command recorded in run_meta.json with the current arguments: every option except --out-dir and --check-complete, so --window, --graph-trace, --trace, --host-trace, --extra-server-args and the rest all count. It also compares the server command and environment those arguments resolve to now, which catches a changed bench/arms.toml arm. A mismatch makes the run incomplete, so prof() moves it aside and repeats it. A directory without run_meta.json is incomplete. check_run.py (used by analyze_all.sh) still checks only whether the recorded run finished, so analysing an old run does not depend on later edits to the arms. New test: test_check_complete_compares_the_recorded_command (a changed option, extra server args, an edited recorded server command, a missing run_meta.json). The four DFlash run directories still check complete, and the committed evidence is unchanged.
…ommand run_profiles.py --check-complete now also compares the command recorded in run_meta.json with the current arguments (every option except --out-dir and --check-complete) and with the server command and environment they resolve to now, so a run made with other profiling options or another bench arm definition is repeated instead of skipped (Codex on #192). A directory without run_meta.json is incomplete. check_run.py keeps checking only whether the recorded run finished, so analysing an old run does not depend on later edits to bench/arms.toml.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 566a84f48a
ℹ️ 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".
| cs = traced_run['args'].concurrency | ||
| if sorted(cs) != sorted(untraced_run['args'].concurrency): | ||
| problems.append(f'{arm}: traced and untraced runs planned different concurrencies') |
There was a problem hiding this comment.
Reject DFlash run pairs from different revisions
When an interrupted run_all.sh dflash hold is resumed after the repository or SGLang revision changes, --check-complete can retain the old completed nsys run while the missing untraced run is produced by the new revision, because completeness compares arguments/server flags but not the recorded SHAs. This check validates only the concurrency lists, after which the analysis subtracts traced GPU work from the untraced cycle and reports only the untraced run's SHA, so measurements from different implementations are silently combined into invalid derived head-share and host-gap results. Require matching repo_sha and sglang_sha (or otherwise verify compatible provenance) before accepting the pair.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f8546e5. dflash_cycle.py now refuses to pair an arm's traced and untraced runs unless they share repo_sha and sglang_sha (both must be present), the GPU and clocks string, the server command (the traced one must be the untraced one under the nsys prefix) and its environment. The check is pair_problems, and it runs before anything is written. Tests: two new refusal cases, another SGLang SHA and another server command. The committed pair passes (both runs: repo 5bc91db, SGLang bd66ce34, same GPU line and server command), and dflash_cycle.json/.csv regenerate byte-identically.
…ovenance The derived terms subtract the traced GPU work from the untraced cycle, so an arm's two runs must come from the same repository and SGLang commits, the same GPU and clocks, and the same server command and environment (the traced one under nsys). A hold resumed after a revision change could otherwise combine an old traced run with a new untraced one (Codex on #192). The committed evidence passes the check and regenerates byte-identically.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
|
Verdict: REQUEST CHANGES at f8546e5 I reviewed the current head, f8546e5. da195a4, which main first named, is two commits behind it, and both newer commits answer Codex P1s. The measurements and their reproduction hold. One labelling item blocks. What I checked
Blocking
Optional
|
…ing fixes Reviewer 1 (#192): the head share over the untraced cycle (9.3%, 7.3-12.8%) rests on the estimated untraced cycle, so it is derived. Also: the b8 GDN ceiling is 1.80x; the b16 host leads by 0.75-1.06 of a cycle; 'nothing is planned on the host' comes from reading the code; the hostgap figures 1.36-1.46 ms are estimates; dflash-tuned at c = 64 has 8 launches after collection.
|
Reviewer 1's blocking item is fixed in 5fe9d20. The untraced head share is marked derived in both table rows and in the sentences at 9.3%, 8.5-12.8% and 7.3-12.8%. The optional items are in the same commit:
No data changed. @codex review |
|
Verdict: APPROVE at 5fe9d20 This is a delta review of f8546e5..5fe9d20. The change is README-only (
pre-commit passes on the README, |
…full cycle (line 447)
|
Codex Review: Didn't find any major issues. Swish! 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". |
Paper: the DFlash cycle split (Figure 1 bar, Appendix E.2, head ceiling; fold #192)
The DFlash attribution hold (
run_all.sh dflash, queued since #173) has run. This PR adds its evidence, the per-phase analysis of the DFlash cycle, and the fix promised on #173 for interrupted sweeps (Codex P2 atrun_all.sh:78).Results (
evidence/profiles/README.md, new DFlash section)The hold profiled the bench's two tuned DFlash arms with the flags
bench/arms.tomlresolves to:dflash-tuned-b16(block 16, Triton attention, capacity 64; the frontier's best arm at c <= 4) anddflash-tuned(block 8, FlashInfer target, FA4 draft, capacity 128). Each arm ran on an nsys server (uncollected and collected 2 s windows at c = 1, 4, 16, 64) and an untraced server (three 5 s windows each), on 2026-10-02 07:45-08:00 UTC, from repository 5bc91db and SGLang bd66ce34. Every planned window is present, every window held its batch, and the foreign CPU load was 0.12-0.71 cores. The server logs match the declared flags.Measured, per traced cycle:
dflash-tuned-b16, SGLang's Triton extend-attention kernel launches one CTA per query tile and head, so at c = 1 it launches 16 CTAs in the target and 32 in the drafter. It takes 1.45 ms of target verify and 0.96 ms of the drafter per cycle at c = 1: 30% of the cycle, falling to 14% at c = 64. The GDN verify kernel plus the commit take 40% (b16) and 45% (b8) of the cycle at c = 64.dflash-tunedthe head is 8.5-12.8% of the untraced cycle.dflash-tuned-b16has none: the host issues each graph launch 6-55 ms ahead, the GPU is busy 96.6-98.8% of the cycle, and the GPU idles 114-119 us per cycle outside graphs.dflash-tunedkeeps one. Traced, it is 1.81, 1.85, 1.64 and 1.00 ms per cycle at c = 1, 4, 16 and 64, with one blockingcudaStreamSynchronizeper cycle (call site not traced). Untraced, it is at most about 0.66 and 0.97 ms at c = 1 and 4 (derived, an overestimate), which is smaller than hostgap's 1.36-1.46 ms on the untuned block-8 arm but not gone.Scope: the client is the profile workstream's essay workload (thinking on, greedy). Acceptance there is only 2.5-3.8 tokens per cycle, against 6.18 and 5.04 on the drafter's panel, so the per-token rates are not the frontier's: block 8 beats block 16 at c = 1 here. The untraced cycle is an estimate (c x accept length / tok/s); on the collected windows it lies between 1.2% below and 5.6% above the traced cycle. The untraced windows also sit 90-700 tokens later in their generations than the collected ones. The README states both limits wherever the derived host gap appears.
New files:
dflash_cycle.json,dflash_cycle.csvanddflash_breakdown.csv. The last has the same columns asbreakdown.csv, which is unchanged, so Figure 1 is unaffected. Also new:attribution/dflash-tuned*_bs*.json, andwindows/dflash-tuned*with the server start-up logs.tables.mdandstep_share.csvgain DFlash rows.Code
run_profiles.py --check-completecompares a run directory with every window record its arguments plan, and with each collected window's report, without launching anything. It also compares the command recorded inrun_meta.jsonwith the current arguments (every option except--out-dir) and with the server command and environment they resolve to now, so a run made with other profiling options or anotherbench/arms.tomldefinition is not complete (Codex on Profile: DFlash cycle split on the tuned arms; skip only complete profile runs #192).prof()skips a run only when it is complete. An incomplete run is moved aside to<dir>.set-aside-<UTC time>and repeated whole, andVP_RERUN=1moves runs aside the same way.run_profiles.pyrefuses a directory that already holdswindows.jsonl, so one file always records one server session.check_run.pychecks a directory against the command recorded in itsrun_meta.json, andanalyze_all.shstops on an incomplete DFlash run.dflash_cycle.pywrites the phase split (draft forward, the drafter's KV from verified target features, draft head, verify forward, verify head, GDN commit, sampling and bookkeeping, in-graph gaps, host gap), the untraced window statistics, and the derived head share, ceiling and untraced-minus-traced-work. It refuses to write unless every planned window and attribution is present and valid: no partial windows file, the batch held, no request finished inside a window, complete eager records, foreign CPU at most 2 cores. An arm's traced and untraced runs must also share the repository and SGLang commits, the GPU, the server command and its environment (Codex on Profile: DFlash cycle split on the tuned arms; skip only complete profile runs #192).attribute.py:^_fwd_kernel) counts as full attention; it was landing inother_in_graph.draft_context_kv, instead of the target's GEMM and norm categories. They are the drafter's KV for the verified tokens, andsummarize.pygroups them withdraft_model.attribute.pychanges alter none of their numbers. Onlyeager_kernel_records_per_launch_callchanges (plain 0.9991-0.9996 to 1.0).eager_launch_calls_after_collectionis added, andhost_sync_callsis filled for plain B = 8 and 32, where the committed files lacked it. Every category and kernel row is byte-identical, and so are the_categories.csvfiles,breakdown.csvandplain_rerun_check.csv.Validation
tests/test_profiling_windows.py(15 tests) covers:run_meta.json);--check-completeexit codes, including a missing report and a cut-off last line;check_run.pyon a moved directory;run_profiles.pyrefusing to extend a session;run_all.sh dflashwith a stub interpreter, which skips the complete runs, moves the partial one aside and repeats only the unfinished runs, plusVP_RERUN=1;dflash_cycle.py's split and derived terms, and its refusal of a dropped untraced window, a missing attribution, a batch not held, an unknown category, a cut-off line, and run pairs with another SGLang SHA or another server command.All 15 pass.
pre-commit (ruff, mypy, codespell, shellcheck, host-identity guard) passes on every changed file.
scripts/check_host_identity.shis clean on the new evidence.The raw reports stay in
~/vp-data/profile/dflash-tuned*_nsys/; no.nsys-repis committed.Not covered: the call site of
dflash-tuned's per-cycle synchronize (no host-trace run for DFlash; hostgap's DFlash hold is queued), and acceptance on the bench's workload (this client's text accepts far less).