Repository navigation
Backbone: served exactness of each switch and paired plain serving of the routing table - #153
Conversation
… reports insitu_gemm.py labels each target decode-graph replay of a plain-decoding nsys window with the profiling workstream's attribute.label_all and splits every weight-GEMM kernel by implementation (cuBLAS, the backbone Triton kernel, the Hopper GEMV). It reports the median replay span and summed GEMM time per projection, so the served engine's routes can be compared with the layer skeletons' prediction.
Greedy outputs on the state-safety prompt set against stock plain decoding: with every switch off and with the packed GDN input projection the outputs are bitwise equal on all 320 prompts at concurrency 1; SGLang's Hopper GEMV backend (3.75 divergences per 1,000 tokens) and the routing table lever v1 (3.40 at c = 1 and 3.82 at c = 32, pinned pools, cap 8) are exact up to rounding, every first divergence a tie, one BF16 step or near. Paired B A A B serving against tuned plain decoding in one exclusive hold: lever v1 is 3.4% faster at c = 1 and 1.0% at c = 128 (the packed projection's predicted 81 us per step against 86 us served), and 0.4% at c = 8, about a tenth of what the microbenchmarks predict for the Triton route there; why is not yet traced. The GPU tests of PR #91 pass on the GPU (25 of 25), and the scaled-norm and SiLU-only folding variants lose at every M from 1 to 16.
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. |
|
Verdict: REQUEST CHANGES (3347ec2, 1 blocking: the "bitwise" claims rest on a drift statistic that does not cover every top-5 logprob) Checked: everything else is right.
Blocking: "bitwise" (off, merge, and the two stock servers with different pools).
Suggestion (PR body only). "111-257 us against 33-52 us" misses the SiLU fold's 102.6-110.4 us at M = 2-16 and the GDN Triton rows' 30.8 us. The README's table is right. Write "103-257 us against 31-52 us". Codex is still running on 3347ec2. Pre-commit runs in the CPU window on the fix head. |
compare.py's logprob drift covers only shared top-k entries above -4 nats, so it cannot show that two runs return equal top-5 logprob arrays. bitwise_runs.py compares the output token ids and the full top-k arrays of every prompt and fails on a missing run or mismatched prompt sets.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3347ec2875
ℹ️ 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".
| for i, corr in enumerate(kept['corr']): | ||
| seq = in_graph[in_graph['corr'] == corr] |
There was a problem hiding this comment.
Exclude partial boundary replays before summarizing
When Nsight collection begins or ends in the middle of a graph replay, kept still includes that truncated replay; the existing experiments/profiling/check_labels.py explicitly drops boundary replays for this reason. If the first replay is partial, the i == 0 branch publishes incomplete kernel counts and names, while the span and timing aggregates also include partial data, potentially misreporting which implementation the served engine dispatched. Filter to complete replays before this loop and select the count exemplar from that filtered set.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 9f9f878. complete_replays() keeps only replays with the graph's full kernel count, then drops the first and last of them, as check_labels.py does. The count and name exemplar is taken from the kept set, and the medians use only kept replays. tests/test_backbone_served_tools.py covers a replay cut at each end and a missing replay.
|
Update to my verdict on 3347ec2 (still REQUEST CHANGES): Codex's comment r4159430831 is valid. Add it to my one item.
Filter to complete replays before summarizing, take the exemplar from that set, and add a test with a truncated first and last replay. No evidence from this script is committed yet, so this is the moment to fix it. |
…tools Codex on 3347ec2: a replay cut by the nsys window could set the kernel counts and names and enter the medians. complete_replays keeps only replays with the graph's full kernel count and then drops the first and last, as check_labels.py does; the exemplar comes from the kept set. pandas is now imported only where a report is read, so the filter and bitwise_runs.py have CPU tests (tests/test_backbone_served_tools.py).
Reviewer on 3347ec2: identical tokens with zero drift do not show equal top-5 logprobs, since compare.py's drift ignores entries below -4 nats. bitwise_runs.py now compares the full output_ids and top_logprobs arrays: off, merge and the stock fresh-server repeat are equal on all 320 prompts at concurrency 1; gemv and lever v1 keep the tokens of 146 to 159 prompts but no prompt's full logprob arrays. The README scopes each bitwise claim to that comparison.
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. 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: APPROVE (provisional, on a76bc4c: Codex has not yet reviewed this head, and pre-commit and the new tests are queued in the CPU window. I will confirm or withdraw once both finish.) a76bc4c resolves both items from my review of 3347ec2.
Optional: a few rewritten lines in |
Appendix E: backbone switches served, exact up to rounding; 3.4% at c = 1 on tuned plain decoding (#153)
PR #91 added the backbone microbenchmarks and the opt-in engine patch series (
engine/sglang/patches/backbone/0001-0008), but left two things pending: how each engine switch changes served outputs, and what the routing table does to served throughput. This PR adds both for plain decoding, plus the hold-2 GPU tests and the last two norm-folding variants. Results and commands:evidence/backbone/README.md, "Served results".Exactness of each switch (greedy outputs against stock plain decoding)
The setup is the state-safety runner with 320 prompts, 256 tokens and top-5 logprobs (radix cache, overlap and CUDA graphs on).
compare.pyclassifies each prompt's first divergence.SGLANG_BACKBONE_MERGE_IN_PROJ=1(packed GDN in_proj from 64 rows)--bf16-gemm-backend gemv(SGLang's policy)These are compared with the same runner's reference pairs:
"Bitwise" is checked on the raw runs by
experiments/backbone/bitwise_runs.py(served/bitwise_*.json): each prompt's fulloutput_idsandtop_logprobsarrays are compared. The stock fresh-server repeat at c = 1 is also bitwise on 320/320. Gemv and lever v1 keep the tokens of 146-159 prompts, but no prompt keeps all its logprob values. No run commits a token that is not its own top-1, and the largest margin at a divergence is 0.25 nats. The unpinned servers' KV pools ranged from 93,544 to 160,610 tokens. No prefill reused a cached prefix, and two stock servers with different pools return the same token ids and top-5 logprob arrays on all 320 prompts at c = 1, so at c = 1 pool size did not enter.The lever's first run in shared1 never started. With other shared servers resident, the old unpinned runner got running caps of 15 and 3 and retried while holding the lock. The rerun uses main's pinned runner with its 52 GB start gate, under
timeout --foreground, with a trap that stops the server's own session.Paired serving, lever v1 against tuned plain decoding
The c = 8 gap, a tenth of the microbenchmark prediction for the Triton + PDL route, is stated but not explained. The pending in-situ trace is meant to explain it.
Also in this PR
experiments/backbone/insitu_gemm.py(committed before its evidence) labels each decode-graph replay of an nsys window. For each projection it reports which implementation ran (cuBLAS, Triton or GEMV), the summed kernel time and the replay span. It keeps only replays with the graph's full kernel count and drops the first and last (Codex r4159430831; same rule ascheck_labels.py). It was tested on two of the profile workstream's stock reports; no evidence from it is committed yet.tests/test_backbone_served_tools.pytests the replay filter andbitwise_runs.pyon the CPU (6 passed).gpu_tests_hold2.log:tests/test_backbone_gemm.pyat Backbone GEMMs and RMSNorm: microbenchmarks, a skinny GEMM and an opt-in engine patch series #91's head, 25 of 25 passed on the GPU. This includes the merge-cutoff and Hopper-gate tests that had not run on a GPU before Backbone GEMMs and RMSNorm: microbenchmarks, a skinny GEMM and an opt-in engine patch series #91 merged.chain_fold_variants_microbench.json: the scaled-norm prologue (patch 0005) and the SiLU-only fold. Every variant loses at every M from 1 to 16 (103-257 us against 31-52 us per layer, except the SiLU fold at M = 1, which ties). Folding is closed as a negative result.README.md,evidence/README.mdandengine/sglang/README.mdnow give these results instead of "pending".Not covered
Hold 3's results (MTP serving and the trace) will come in a separate pull request, so this one can be reviewed as it stands.
Review rounds
bitwise_runs.pychecks the full arrays, and the README and PR scope each bitwise claim to that comparison (which prompts, concurrency, pools).insitu_gemm.py: fixed in 9f9f878, with a test.