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.
Main's 450d5d8 added ledger rows 30-32 (Flash Next HIP fusion, stream-tile prefetch and the filled-item prompt grid), so the previous commit's "30. Dependent launches" rows and entry take the next free number, 33. Nothing else changes.
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.
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.
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.
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.
…ision HIP's config path divided by num_attention_heads (hidden / heads without head_dim) and by num_key_value_heads / linear_num_key_heads (checks.products) before any check, so a 0 panicked; a linear_num_value_heads of 0 was admitted. Metal 27B, Metal 2B and CUDA already refuse a count below 1 in their readers; the host test pins all four.
…ad count of 0 before dividing Each reader took 0: nemotron divided hidden / heads without head_dim (and admitted heads 0 with it), gemma4's Metal drafter config took heads % kv_heads, DeepSeek V4.1's Metal vision tower took dim / heads. Each now refuses with its family's word.
…so its refusal tests run
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI for a landing train: #3776 #3777 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.