Skip to content

Appendix E: backbone GEMM and RMSNorm microbenchmarks (#91) - #129

Merged
SamMausberg merged 4 commits into
mainfrom
paper/appendix-backbone
Oct 1, 2026
Merged

SamMausberg merged 4 commits into
mainfrom
paper/appendix-backbone

Conversation

@SamMausberg

@SamMausberg SamMausberg commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Folds #91 (evidence/backbone/) into Appendix E as isolated microbenchmarks. Every number is from the committed README, tables.md or the four JSON files. The served exactness class and the paired serving runs are pending under a new entry, D22 backbone-served.

What the appendix now says

New paragraphs in E.6 "Levers by axis", before Table tab:axes:

  • Method. Each timed call multiplies every layer's own checkpoint weight by its own input, under CUDA graphs. Times are medians of 30 timed replays in one exclusive session. They include any split-K reduction and the gap to the next kernel, and are compared only within these files.
  • What cuBLAS runs. The projections with 2,560 outputs run split-K plus a reduction kernel, up to M = 32 (128 for down). At M = 1 they reach 49% (output projections) and 68% (down) of the 3.79 TB/s read bandwidth, against 80-87% for the large projections. Turning reduced-precision reduction off changes neither time nor bits.
  • Faster kernels on the same weights.
    • M = 1: SGLang's Hopper GEMV takes 0.77 of cuBLAS's time on the output projections (8.57 against 11.20 us), 0.91 on down, 0.95-0.97 on the other large projections, and 0.51 on the 64-row GDN projection, which cuBLAS runs on one block. It is unreachable at the pin (code reading); patch 0001 makes it reachable.
    • M = 2-16: the Triton kernel pays only with PDL, at 0.88-0.92 on the output projections and 0.96-0.98 on the GDN input and MLP projections. It gives no gain on the attention QKV projection.
    • M >= 64: cuBLAS or a cuBLASLt algorithm within 2-5% of it, except down, where PyTorch's cuBLASLt choice takes 0.92.
  • Exactness of the routes. The routes change the target's arithmetic in general. GEMV and Triton are bitwise equal to cuBLAS on 99.6-100% of elements, and cuBLASLt differs on down from M = 16. So the class is pending in the levers table.
  • Derived saving. 197 us at M = 1, at most 5.7% of the 3,460 us step, and 92-120 us at M = 2-16. Labelled as derived from isolated timings, not a served result.
  • Packed GDN input projection. Bitwise equal to the separate pair in every element, at power-of-two M from 1 to 1,024, with the real weights of all 24 layers, random BF16 inputs, cuBLAS 13.1 and this GH200. This is stated as a per-GEMM result, not about served tokens. Timing: neutral to M = 16, 3% slower at 32, 5-13% faster from 64.
  • Norm and folding.
    • The stock norm takes 1.47 us per launch at M = 1, and 2.0-2.2 us at M = 4-32.
    • Folding the norm and SiLU into the GEMM is bit-exact up to M = 32 (one element in 10^5 is one BF16 step off at M = 64 and 128). As built, though, it is 13-70 us per layer slower. It is listed under "What did not work".
    • Triton+PDL saves 1.2-2.3 us per MLP layer and 1.4-1.8 us per GDN layer up to M = 16 (except GDN at M = 4), and loses at 32.

Also:

  • a "Backbone GEMMs and norms" row in Table tab:axes (class pending);
  • the H6 status row (the derived 5.7% ceiling, and served results pending);
  • the register entry backbone (the four JSON files, tables.md, README, hostload/, and the patch series as code; produced by gemm_bench.py, summarize.py and make_table.py);
  • the pins table now lists the repair/ and backbone/ patch series, which were missing.

Checks

  • latexmk -pdf: 0 warnings. The main text ends on p10 and References start on p11 (80 pages; 78 on main).
  • scripts/check_paper_references.py is clean.
  • I read the changed pages (App E levers and Table 21, the register, and the pending list).
  • The host-identity hook passes.

This PR and #121 both touch app_register.tex and paper.pdf. Whichever merges second gets rebased and its PDF rebuilt.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T15:03:13.786114Z 24e33ae Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df5c1aa5eb

ℹ️ 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".

Comment thread paper/sections/app_stack.tex Outdated

\paragraph{Backbone GEMMs and RMSNorm} The weight GEMMs' time above the head GEMM's bandwidth and the 65 RMSNorm launches are the fourth and seventh rows of Table~\ref{tab:profile-ranked}. Isolated microbenchmarks under CUDA graphs locate the slow GEMMs and test faster kernels that read the same BF16 weights~\ev{backbone}. Each timed call multiplies every layer's own checkpoint weight by its own input, so the weights stream from HBM as in the model; times are medians of 30 timed replays in one exclusive session, include any split-$K$ reduction and the gap to the next kernel, and are compared only within these files. The three projections with 2,560 outputs, the GDN and attention output projections and the MLP down-projection, run as split-$K$ kernels followed by a reduction kernel up to $M=32$ (128 for the down-projection) and reach 49\% (output projections) and 68\% (down-projection) of the measured 3.79~TB/s read bandwidth~\ev{profile-bw} at $M=1$, against 80--87\% for the large projections; disabling cuBLAS's reduced-precision reduction changes neither their time nor any output bit. At $M=1$ SGLang's own Hopper GEMV is the fastest kernel for every projection: it takes 0.77 of cuBLAS's time on the output projections (8.57 against 11.20~\textmu s per call for the GDN one), 0.91 on the down-projection, 0.95--0.97 on the other large projections and 0.51 on the 64-row GDN projection, which cuBLAS runs on a single block. At the pin it is unreachable: \code{-{}-bf16-gemm-backend gemv} loads it, but the unquantized linear layers call the dispatcher only for another backend (code reading; patch \path{engine/sglang/patches/backbone/0001} lets them reach it). At $M=2$--16 a Triton skinny GEMM pays only with programmatic dependent launch, at 0.88--0.92 of cuBLAS's time on the output projections and 0.96--0.98 on the GDN input and MLP projections, with no gain on the attention QKV projection; in this benchmark each call overlaps its successor, which in the model is a different kernel. From $M=64$ cuBLAS, or a cuBLASLt algorithm within 2--5\% of it, is best, except on the down-projection, where PyTorch's cuBLASLt choice takes 0.92 of the time. None of these routes leaves the target's arithmetic unchanged in general: the GEMV and the Triton kernel are bitwise equal to cuBLAS on 99.6 to 100\% of output elements, and the cuBLASLt choice differs from it on the down-projection from $M=16$, while all arms lie within the same distance of a float64 product. If every projection ran at its best isolated time, a plain step's backbone GEMMs would take 197~\textmu s less at $M=1$, at most 5.7\% of the 3,460~\textmu s step, and 92 to 120~\textmu s less at $M=2$--16 (derived from the microbenchmarks, not a served result).

SGLang's packed GDN input projection, one GEMM over the concatenated $12{,}352\times2{,}560$ weight instead of a $12{,}288$-row and a 64-row GEMM, gives every output element bitwise equal to the separate pair's at each tested $M$, the powers of two from 1 to 1,024, with the real weights of all 24 GDN layers and random BF16 inputs, under cuBLAS 13.1 on this GPU~\ev{backbone}. That is a statement about one isolated GEMM, not about served tokens. Against the stock pair, which runs the 64-row GEMM on a side stream, it is as fast up to $M=16$, 3\% slower at 32 and 5 to 13\% faster from 64. The stock fused add-RMSNorm takes 1.47~\textmu s per launch at $M=1$ and 2.0 to 2.2~\textmu s at $M=4$--32 inside a graph of 64 norms. Folding the norm and the SiLU into the next GEMM's prologue reproduces the stock norm bit for bit up to $M=32$ (one element in $10^5$ is one BF16 step away at $M=64$ and 128) and the stock SiLU bit for bit, but as built it makes each layer 13 to 70~\textmu s slower in MLP and GDN layer skeletons, far more than the two launches of about 1.5 to 2~\textmu s that it removes. In the same skeletons the Triton kernel with programmatic dependent launch saves 1.2 to 2.3~\textmu s per MLP layer and 1.4 to 1.8~\textmu s per GDN layer up to $M=16$, except the GDN layer at $M=4$, and loses at 32. The engine patches that route each projection by a table are committed and off by default; the exactness class of each switch, from greedy outputs against stock plain decoding compared with the noise floor, and paired serving runs against the tuned arms are \pend{backbone-served}.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Qualify the folding slowdown to M ≤ 32

For the measured M=64 and M=128 cases, the committed skeleton table shows much larger regressions than 70 µs: MLP folding adds about 149 and 543 µs per layer, while GDN folding adds about 82 and 160 µs. Because this sentence also discusses the M=64/128 exactness results, the unqualified 13–70 µs range misreports the measured timing results; either limit the range explicitly to M≤32 or include the larger losses (and update the repeated range below).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f7ee32a (head 24e33ae). I scoped the loss by M range in all three places: the paragraph, the levers-table row and "What did not work". It is now 12-90 us per layer up to M = 32, with or without PDL (the PDL variant reaches 90 us at M = 16), and 82-543 us at M = 64 and 128 (tables.md, layer skeletons: MLP +149/+543, GDN +82/+160).

Comment thread paper/sections/app_stack.tex Outdated

The host gap of the speculative cycle at low concurrency (Appendix~\ref{app:profile}) has a configuration-level lever~\ev{host-levers}. With Triton attention for the target and the draft, neither attention backend needs host-side sequence lengths, so the overlap scheduler stops copying them to the host and FlashInfer's planning leaves the cycle. MTP with three steps then gains $1.18\times$ in per-request rate at concurrency 1 and $1.14\times$ in throughput at concurrency 4, with unchanged accepted length; Triton attention for the draft alone gains $1.08\times$ and $1.06\times$ (single runs). The draft-only change is exact, because it changes only which tokens are proposed. Triton attention for the target changes the target's arithmetic, and its class is \pend{bench-equality}. SGLang's overlapped planning stream fails at the first verify on this hybrid model, whose GDN backend does not implement a call the stream needs.

\paragraph{Backbone GEMMs and RMSNorm} The weight GEMMs' time above the head GEMM's bandwidth and the 65 RMSNorm launches are the fourth and seventh rows of Table~\ref{tab:profile-ranked}. Isolated microbenchmarks under CUDA graphs locate the slow GEMMs and test faster kernels that read the same BF16 weights~\ev{backbone}. Each timed call multiplies every layer's own checkpoint weight by its own input, so the weights stream from HBM as in the model; times are medians of 30 timed replays in one exclusive session, include any split-$K$ reduction and the gap to the next kernel, and are compared only within these files. The three projections with 2,560 outputs, the GDN and attention output projections and the MLP down-projection, run as split-$K$ kernels followed by a reduction kernel up to $M=32$ (128 for the down-projection) and reach 49\% (output projections) and 68\% (down-projection) of the measured 3.79~TB/s read bandwidth~\ev{profile-bw} at $M=1$, against 80--87\% for the large projections; disabling cuBLAS's reduced-precision reduction changes neither their time nor any output bit. At $M=1$ SGLang's own Hopper GEMV is the fastest kernel for every projection: it takes 0.77 of cuBLAS's time on the output projections (8.57 against 11.20~\textmu s per call for the GDN one), 0.91 on the down-projection, 0.95--0.97 on the other large projections and 0.51 on the 64-row GDN projection, which cuBLAS runs on a single block. At the pin it is unreachable: \code{-{}-bf16-gemm-backend gemv} loads it, but the unquantized linear layers call the dispatcher only for another backend (code reading; patch \path{engine/sglang/patches/backbone/0001} lets them reach it). At $M=2$--16 a Triton skinny GEMM pays only with programmatic dependent launch, at 0.88--0.92 of cuBLAS's time on the output projections and 0.96--0.98 on the GDN input and MLP projections, with no gain on the attention QKV projection; in this benchmark each call overlaps its successor, which in the model is a different kernel. From $M=64$ cuBLAS, or a cuBLASLt algorithm within 2--5\% of it, is best, except on the down-projection, where PyTorch's cuBLASLt choice takes 0.92 of the time. None of these routes leaves the target's arithmetic unchanged in general: the GEMV and the Triton kernel are bitwise equal to cuBLAS on 99.6 to 100\% of output elements, and the cuBLASLt choice differs from it on the down-projection from $M=16$, while all arms lie within the same distance of a float64 product. If every projection ran at its best isolated time, a plain step's backbone GEMMs would take 197~\textmu s less at $M=1$, at most 5.7\% of the 3,460~\textmu s step, and 92 to 120~\textmu s less at $M=2$--16 (derived from the microbenchmarks, not a served result).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include the slow MLP-down Triton cases in the range

At M=2 and M=4, the PDL Triton MLP down-projection takes 0.993 and 0.986 of cuBLAS time, respectively, rather than falling in the stated 0.96–0.98 range. The approximately 0.98 alternatives in those cells are cuBLASLt algorithms, so attributing that entire range to Triton overstates the Triton route's gain at the small batch sizes; distinguish those algorithms or report the Triton range as roughly 0.96–0.99.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f7ee32a (head 24e33ae). The Triton+PDL range on the GDN input and MLP projections at M = 2-16 is now 0.96-0.99, which includes MLP down at 0.993 and 0.986 for M = 2 and 4. The levers-table row reports the best kernel per call, so its cuBLASLt cells are unchanged.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES

Review of the exact head df5c1aa: b9c8ae1 (Appendix E, register, H6 and axes rows) plus the rebuilt PDF.

What I verified

  • Numbers. Checked against evidence/backbone/README.md and tables.md:

    • split-K up to M = 32 (128 for down);
    • 49% / 68% / 80-87% of 3.79 TB/s;
    • no change in time or bits without reduced-precision reduction;
    • the GEMV at 0.77 (8.57 vs 11.20 us), 0.91, 0.95-0.97, and 0.51 (2.75 vs 5.43 us);
    • 0.88-0.92 with PDL on the output projections;
    • cuBLASLt's 0.92 on down from M = 64;
    • bitwise agreement on 99.6-100% of elements;
    • 197 us at M = 1, at most 5.7% of 3,460 us, and 92-120 us at M = 2-16;
    • the packed projection's bitwise equality at the eleven tested M, and neutral / +3% / 5-13% faster;
    • 1.47 and 2.0-2.2 us per norm;
    • PDL savings of 1.2-2.3 and 1.4-1.8 us per layer, with the GDN M = 4 exception;
    • the axes-row ranges.

    "Fourth and seventh rows" of tab:profile-ranked is right.

  • Rebuild in place. latexmk -g on one core finished with 0 warnings, wrote 80 pages, and its text is identical to the committed PDF. References start on p11, the committed PDF is restored, and check_paper_references.py is clean.

  • Checks. The commits are by Samuel Mausberg, with no AI lines. The hostname check is clean over the diff, the PR text and the PDF text.

Blocking: both Codex P2s on df5c1aa are valid and unanswered.

  1. The folding loss is 13-70 us only up to M = 32. The skeleton table in tables.md gives 204.28 against 55.30 us per MLP layer at M = 64 and 605.03 against 61.62 at M = 128, a loss of 149 and 543 us. For GDN layers it is 119.54 against 37.35 and 200.47 against 40.66, a loss of 82 and 160 us. The paragraph sentence, the "What did not work" entry and the tab:axes row all say 13-70 us without a range of M. Either scope them ("at M <= 32") or give the larger losses.
  2. Triton+PDL on the down-projection at M = 2-4 is about 0.99. It takes 0.993 and 0.986 of cuBLAS's time there (18.16/18.29 and 18.13/18.39 us). The ~0.98 values at those M are cuBLASLt algorithms. So "0.96-0.98 on the GDN input and MLP projections" for the Triton kernel should read 0.96-0.99, or the cuBLASLt cases should be separated.

Suggestion (non-blocking). "Times are medians of 30 timed replays": each of the 30 timings spans 10 graph replays (evidence/backbone/README.md, Timing). "Medians of 30 timings of 10 replays each" would be exact.

Fold in evidence/backbone/ as isolated microbenchmarks: what cuBLAS runs
per projection, the faster kernels reading the same weights (Hopper GEMV
at M = 1, Triton with PDL at M = 2-16, cuBLASLt picks) and their bitwise
agreement with cuBLAS, the packed GDN input projection (bitwise equal per
GEMM at power-of-two M from 1 to 1024), the norm and SiLU prologues and
the layer skeletons, where folding is 13-70 us per layer slower as built.
The derived 197 us (at most 5.7% of a plain step at M = 1) is labelled as
derived from isolated timings.

New register entry backbone, a Backbone GEMMs row in the levers table,
the folded norm under what did not work, the H6 status row, and the
backbone and repair patch series in the pins table. Served exactness and
paired serving runs are pending (new entry backbone-served).
…N input and MLP projections

Codex P2s on #129: the 13-70 us folding loss holds only up to M = 32
without PDL; with PDL it reaches 90 us at M = 16, and at M = 64 and 128
the folded MLP and GDN skeletons are 82-543 us slower (tables.md, layer
skeletons). The Triton+PDL kernel takes 0.96-0.99 of cuBLAS's time on the
GDN input and MLP projections at M = 2-16 (MLP down 0.993 and 0.986 at
M = 2 and 4), not 0.96-0.98.
@SamMausberg
SamMausberg force-pushed the paper/appendix-backbone branch from df5c1aa to 24e33ae Compare October 1, 2026 15:00
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 24e33aef3d

ℹ️ 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".

SamMausberg added a commit that referenced this pull request Oct 1, 2026
…N input and MLP projections

Codex P2s on #129: the 13-70 us folding loss holds only up to M = 32
without PDL; with PDL it reaches 90 us at M = 16, and at M = 64 and 128
the folded MLP and GDN skeletons are 82-543 us slower (tables.md, layer
skeletons). The Triton+PDL kernel takes 0.96-0.99 of cuBLAS's time on the
GDN input and MLP projections at M = 2-16 (MLP down 0.993 and 0.986 at
M = 2 and 4), not 0.96-0.98.
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE

Re-review on the exact head 24e33ae: rebased on main, with #121's appendix changes from main underneath. The PR's own new commits are f7ee32a, e4ac110 and the PDF.

  • Both blocking items are fixed and answered on their threads.
    • The folding loss is now "12 to 90 µs up to M = 32, with or without programmatic dependent launch, and 82 to 543 µs at M = 64 and 128", in the paragraph, the tab:axes row and "What did not work". From the tables.md skeleton columns (mlp_fused/_pdl against mlp_stock, gdn_fused/_pdl against gdn_stock) I get 12.0-89.7 µs at M <= 32 and 82.2-543.4 µs at 64 and 128.
    • The Triton+PDL range on the GDN input and MLP projections at M = 2-16 is 0.96-0.99, which includes down's 0.993 and 0.986 at M = 2 and 4.
  • The suggestion is taken. The text now says "30 timings of 10 graph replays each".
  • Rebuild in place. latexmk -g on one core finished with 0 warnings, wrote 81 pages, and its text is identical to the committed PDF. References start on p11, check_paper_references.py is clean, and the committed PDF is restored.
  • Codex finished on 24e33ae with no major issues.

Everything else from my review of df5c1aa stands.

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