Repository navigation
Conversation
A GLM-5.3-Flash decode step spends 2-3 us idle between each of its ~1,320 kernels. Every GLM kernel now opens with glm_pdl::enter() (launch_dependents, then griddepcontrol.wait; weight writers wait without the early trigger, since glm_mm reads weights first), so each GLM launch may be a dependent one: cuda_pdl.launch makes it so under TF_GLM_PDL, which already governed glm_mm, and the shared KDA launcher takes an opt-in flag. test-glm-pdl-scan, now in the no-GPU workflow, fails any GLM kernel body that does not open with the wait; fake test drivers forward cuLaunchKernelEx. Same arithmetic, so every output keeps its bits.
GLM's decode spends a launch gap before each of its ~192 qmmf linears a token, and the PoC measured 1.3% more decode speed from making them dependent. qmmf_kernel now triggers its dependents at entry and, under TF_QMMF_WFIRST, loads its prologue stages' weights before griddepcontrol.wait and the input rows after it; reduce_kernel waits first. Lane.pdl (false by default, set only by GLM from TF_GLM_PDL) makes the decode entries and the reduce dependent; prompt entries stay plain. Same arithmetic and bits; the register records the prologue moved are re-measured for nvcc 13.0 and 13.3.
With every GLM kernel opening on glm_pdl::enter(), nvcc 13.3 gives tf_glm_chunks_16 and tf_glm_chunks_32 other registers on sm_120 and sm_121, and df_sumn 40 on both (main's 13.3 build was already off its record there). The 13.3 set records the five-SM measurement of each, so the 13.3 limits audit has no new stale GLM entry; nvcc 13.0's records, which CI checks, did not move.
tf-cuda-test glm-pdl-order runs each kernel behind a slow writer that lets it in at once: one kernel from every GLM image, glm_mm's reduce and qmmf's decode row with K slices, a cluster and one K group, through the production launchers. Each must give the bytes of a plain launch and, with main's fatbins from the same nvcc, main's bytes; a planted early reader must see the poison and go wrong, and chains through another stream's events and host copies must hold. On GB10 every case passes and the control goes red as planted.
The lean checker reads a C block comment's opening and closing marks even inside Zig strings, and cuda_vision.zig crossed 600 lines with the lanes' new pdl field. The scan test spells those marks from two parts, and the vision tests build their lanes as struct literals so the field defaults apply, which also drops the explicit pdl lines.
With GLM's kernels launched dependent, greedy replies after a cold 8k prompt varied (8 distinct 16-token replies in 30). ptxas placed the non-coherent loads that nvcc emits for const __restrict__ inputs above griddepcontrol.wait in 12 kernels (the DSA selectors, dsa_tokens, the KV-host kernels, df_attn), so a selector could read a position or a score before the kernel writing it finished. Those inputs drop __restrict__, which makes their loads coherent and keeps them after the wait; 60 of 60 replies now match. Records of the kernels whose registers moved are re-measured.
The source scan cannot see what ptxas schedules. check-pdl-loads, with -Dnvcc, disassembles the GLM images and qmmf and fails any sm_90 or later function that reads global memory before its griddepcontrol.wait, or never waits unless it is a plain-only entry; only the weight-first bodies may start async weight copies first. The scan test now also checks that glm_mm's and qmmf's prologues load weights before the wait and their inputs only after it.
GLM now launches its CUDA kernels as dependent launches, so the ledger gains a row for the technique: GLM's cell points at the issue, the other families stay unknown, the impact table names the decode gain, and the entry records the rule that inputs a predecessor writes must not be const __restrict__ and the SASS check that enforces it.
The qmmf commit re-measured four 16-row cluster tiles under nvcc 13.0 (50 and 58 registers on sm_120 and sm_121), but nvcc 13.3 still compiles them at 48 and 56, as on main, and with no later entry they showed as stale records. GLM's 13.2 set now holds them at main's values, so 13.2 and later releases check them as main does; with it the branch's 13.3 limits flag no record main does not already flag.
The receipt for GLM's kernels and qmmf's decode linears as dependent launches at TP=2 on two GB10s: main against this branch on the same expert form (plain decode +6.8%, drafted +4.0%, four streams +4.6%, cold prompts no slower), equal tokens in every serve, the exactness suites, the determinism runs that found the early-load race, the kernel contract and limits against main's, the order test and the SASS check, with raw results, prompts, tools and their checksums.
check-pdl-loads took the first ACQBULK in a function's listing as its wait, so a predicated wait, or a branch from before the wait to code past it, let a read run before the predecessor ended and still pass. The checker now fails a predicated wait, an indirect branch before the wait and any branch before it to a target past it other than an EXIT, with fixtures for each; the GLM images and qmmf stay clean.
The SASS check lets weight-first bodies start async copies before the wait without telling weights from inputs, and glm-pdl-order ran only qmmf's BF16 decode rows, while GLM serves FP4 and MXFP8 ones. The source scan now fails a weight load in qmmf or glm_mm that names the input rows, and glm-pdl-order adds FP4 and MXFP8 decode rows, K slices and clusters, from random finite codes and scales near one.
The guards grew after the receipt was written: glm-pdl-order now runs qmmf's FP4 and MXFP8 decode rows too, and check-pdl-loads also fails a predicated wait or a branch past it. The receipt carries their reruns on GB10, 17 of 17 order cases passing and no problem in 402 functions, with its checksums refreshed.
The receipt named the qmmf cluster tile record commit by a hash that the published branch does not carry, since that branch is a copy without the local plans. It now names the commit by its subject, which both branches share, and its checksums are refreshed.
|
@ashhart this is ready for review at |
CI's shared-primitive check rejects griddepcontrol instructions written outside the common headers, and glm_pdl.cuh carried its own copies of the wait and the trigger. It now calls qmm_frag's grid_wait and grid_launch, which emit the same instructions under the same sm_90 guard; the eight GLM images rebuilt with it keep identical SASS on sm_80, sm_120 and sm_121.
|
@ashhart pushed |
check-pdl-loads needs nvcc, which no CI job has, so its rules ran only on machines with a CUDA toolkit. Its fixtures need neither: the no-GPU job now runs them beside the shared CUDA primitive checks, so CI fails when the checker stops failing an early read, a predicated wait or a branch past the wait.
|
@ashhart pushed |
CI's host jobs failed two ways. The index emulator compiles GLM's kernels as host C++ without CUDA headers, so glm_pdl.cuh now includes qmm_frag and calls its wait and trigger only under __CUDACC__. The safe-build name check in cuda_pdl.launch read cuFuncGetName through test drivers that leave it unset; it is removed, the source scan already proving each GLM kernel opens with its wait, and the prompt-logprobs host test routes dependent launches to its recorder.
|
@ashhart pushed
|
|
A TP=3 receipt for this head, since the description lists TP=3 as not run. Three GB10s on a switchless triangle (NCCL carries every gather), GLM-5.3-Flash EXL3,
Tokens: 13 greedy replies (8 prompts alone, 4 at once, one prompt of about 8K tokens) hash the same in all five starts, and in the four profile starts below. Where the time went:
Ranks 1 and 2 move the same way (wall 47.88 / 47.54 to 45.87 / 45.77 on rank 1). The routed experts are level, as the description says they stay plain launches (EXL3's grouped kernels here). They are half of rank 0's call at TP=3, so they are where a follow-up would pay most on this checkpoint. The three guards with this toolchain, which is older than the receipt's nvcc 13.5:
Not run here: prompts longer than 8K tokens, images, and a soak. |
|
Closing: this GLM-5.3-Flash performance work will not continue in TensorFold. |
|
@ashhart, a question now that this is closed: would you still want this change in TensorFold if someone else carried it? At TP=3 on three GB10s it measured +4.3% decode with the same tokens (the receipt above), and its three guards pass here with nvcc 13.0, so it would be a pity to lose it. If you want it, and @laudney does not object, I can open a PR that carries this branch from If the answer is no, I will leave it. If you would rather have it in a smaller form, say which and I will look at that instead. |
|
@ultradaoto please do! carry it forward.
…On Tue, 17 Nov 2026 at 20:18, ultradaoto ***@***.***> wrote:
*ultradaoto* left a comment (ashhart/TensorFold#3673)
<#3673 (comment)>
@ashhart <https://github.com/ashhart>, a question now that this is
closed: would you still want this change in TensorFold if someone else
carried it?
At TP=3 on three GB10s it measured +4.3% decode with the same tokens (the
receipt above), and its three guards pass here with nvcc 13.0, so it would
be a pity to lose it. If you want it, and @laudney
<https://github.com/laudney> does not object, I can open a PR that
carries this branch from 7017c23 onto main with their credit, rerun the
TP=3 receipt and the guards on that head, and take the review from there.
If the answer is no, I will leave it. If you would rather have it in a
smaller form, say which and I will look at that instead.
—
Reply to this email directly, view it on GitHub
<#3673?email_source=notifications&email_token=AAAZ6IMLK4HL2MHDNQPTTOT5ZSXADA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMOJVHE3TQNJSHE4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-6959785298>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZ6IP2UUMLDWHN7M4C5Z35ZSXADAVCNFSNUABGKJSXA33TNF2G64TZHMYTENZUG4ZDGMZYGE5US43TOVSTWNRUGQYDINZTGU2DNILWAI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
What this changes
GLM's CUDA kernels and qmmf's decode linears launch as programmatic dependent launches: the next kernel launches while the current one ends and waits (
griddepcontrol.wait) before it reads anything, so each of the ~1,300 kernels a decode token loses most of its 2–3 µs launch gap. Every GLM kernel opens withglm_pdl::enter()(let the next grid in, then wait) and so reads and writes exactly as a plain launch; the kernels that write weights at load wait without letting a dependent in. qmmf's decode tile loads its weights and scales before the wait and its input rows after it.TF_GLM_PDL=0launches them all plain (registered inplatform/environment.zig,docs/environment.md). Experts, the router plan and the RoCE exchange stay plain launches.Inputs a predecessor writes are never
const __restrict__: nvcc gives those non-coherent loads, and ptxas places them above the wait (a first version did so in 12 kernels, and replies after a long prompt varied). Three guards:test-glm-pdl-scan(every GLM kernel opens with the wait; glm_mm's and qmmf's weight-first prologues load weights before it and inputs after, and their weight loads name no input row),tf-cuda-test glm-pdl-orderon GB10 (a dependent launch after a slow writer reads finished bytes, GLM's kernels and qmmf's BF16, FP4 and MXFP8 decode rows, with a planted early read as the control), andzig build check-pdl-loads -Dnvcc=…(in the SASS of the GLM images and qmmf: no global read above the wait, no predicated wait and no branch past it).atc overlap --json: incomplete (the tool's pull request and time limits); it names 5 open pull requests that conflict in shared files: GLM-5.3-Flash on CUDA keeps conversation states on disk, every rank's part (--learn-conversations) #1411 and GLM on CUDA: the latent split's per-rank page book and owner (TF_GLM_KV_SPLIT, #1431 part 1; stacked on #1411) #2415 (GLM'scuda.zig,cuda_follow.zig), Ling-3.1-flash on CUDA, on one or two GB10s #2340, qwen35 cuda: fuse the dense MLP's NVFP4 prompt gate and up projections into one launch #2410 and idol: Idol's denoiser on CUDA (stacked on #1766) #1767 (zig/tests/cuda/main.zig, the pin table, docs). Whichever lands later rebases.Checks on this head
7017c23879on main3f1290ffe7; it merges without conflict into mainf3307fb29a.python3 tools/zig/lean_check.py, on the base and on this head: 221 on main3f1290ffe7and 221 on this head, 0 new findings.zig build test-cuda-host test-glm-pdl-scan test-gradient-serving: 6,649/6,680 passed, 29 skipped, 2 failed on the first run (cuda_disk_test"kept states … restart",lane_host_rows_test"spill-only host", plusrows_async_test"spill I/O" in the summary: timing tests under load); both reruns oftest-cuda-hostpass with no failure. After the qmmf cluster tile record commit,test-cuda-hostfails onlytest-server-deepseek-chat-host's three namespace pins, which fail the same way on main3f1290ffe7on this host.python3 tools/test_pdl_early_loads.py: 17 OK (CI's no-GPU job now runs it;check-pdl-loadsitself needs nvcc, which CI lacks).tools/zig/cuda_common_check.py: 0 violations; the GLM images keep identical SASS with the shared wait and trigger helpers.zig build -Dfixed-cpu test-host-b test-glm-index-emulate test-glm-logprobs-hostpass; intest-host-aonly timing tests under this host's load (cuda_disk_test,lane_host_rows_test,rows_async_test,slide_metrics_off_test; each passes on rerun) and the DeepSeek pins (which fail on main3f1290ffe7here too) fail.zig fmt --check build.zig zigandgit diff --checkpass. On GB10:tf-cuda-test glm-pdl-order17 PASS and its planted early read fails as planted;zig build check-pdl-loads: 0 problems in 402 functions of 9 images (sm_80, sm_120, sm_121; the first version had 12 early reads)7017c23879(fmt, pytest, zig, zig-b, zig-windows, zig-macos-dev-tools, release paths, benchmark clients; nightly jobs skipped).zig build testin full on x86 (the CUDA host suite, the scan and the pins are the parts this touches); hardware other than GB10 (below).Receipt
Full receipt:
docs/receipts/glm-decode-pdl-60e67379/README.md(raw JSON for every serve, tools, prompts).TF_GLM_PDL=0(24.21 tok/s, main's tokens).TF_GLM_PDL, default 1 (on), accepted0or1, aglmrow in the switch table.077998f7d9, head60e673799f(this branch before its rebase onto3f1290ffe7; the rebase changed no line of the branch, and the commits it crossed touch no GLM or qmmf source); Zig 0.17.0, nvcc 13.5 (V13.5.37), driver 580.178.04, Ubuntu 24.04; 2 × GB10 (sm_121) at TP=2 over a direct RoCE link, NCCL 2.30;nvidia/GLM-5.3-Flash-FP4-Localat76348ddb2be2e35e39ecfc00e75dc07703f4f3d5.df_attn), prompt chunks, vision and the KV host tier launch GLM kernels; qmmf's dependent decode tile is reached only through GLM's lane. Ran: TP=2 on GB10, plain, drafted, four streams, cold 8k and 32k prompts. Not run on hardware: sm_90, sm_100, sm_120, TP=3, one GPU.tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: on each binary, 1, 2 and 4 streams, greedy and sampled: 84/84 equal their alone runs and 30/30 their serial runs; drafted = plain on the 3 golden prompts, the same token sha256s on head and main; resumed = cold. 16-token replies after a cold 8k prompt, drafts off: head 60/60 one reply, main 30/30 the same reply; the first version, withconst __restrict__inputs, 24/30 that reply and 3 others.tools/bench_openai.py: drafted 43.45, 42.70 → 45.17, 44.45 tok/s (+4.0%); plain (openai_aligned.py, drafts off) 24.60, 24.38 → 26.11, 26.20 (+6.8%).bench_cache.py --require-cold: 8k 5.666, 5.659 → 5.609, 5.610 s; 32k 22.83, 22.80 → 22.58, 22.73 s.The GLM load times its two expert forms once a binary and keeps the faster; this head's binary kept
classicand main'sfactored, which alone moves plain decode by about 3%. The A/B above runs both onfactored(the head's kept flag set to main's) so only this change differs; the receipt keeps the first, mixed A/B (+3.5%) and the per-kernel profiles that found it.Kernel contract, only when a GPU kernel is new or changed
__restrict__keep their arithmetic, and their records are re-measured where registers moved (nvcc 13.0 records, and the nvcc 13.3 set). qmmf's four 16-row cluster tiles move under 13.0 only; nvcc 13.3 compiles them as on main, so GLM's 13.2 set keeps main's records for them (nvcc 13.2 was not available to measure). The test kernelstf_probe_pdl_slow_copy,tf_probe_pdl_early_readandtf_probe_pdl_enter_readlive inprobe.cuforglm-pdl-order.tf_probe_pdl_early_readreads before its wait andglm-pdl-ordersees the stale bytes; acheck-pdl-loadsfixture with a load above the wait fails.SUMMARYline and exit status:tf-cuda-test kernel-contract(nvcc 13.3, sm_121):SUMMARY 661 kernels: 661 pass gates 1-4, 0 fail, 8 known findings; 422 controls: 422 red as planted, 0 missed; 387 limit problems, exit 1 from the limit problems alone. They are stale nvcc 13.3 records:kernel-contract-limitson the five-SM fatbins finds 834 on main3f1290ffe7and 832 on this branch, every branch one also stale on main, and no launch past a limit (5,330 PASS, 0 FAIL). The 8 known findings are the registered ones.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.--drafter, no slower than without it, greedy and sampled