Repository navigation
GLM CUDA: pipeline four-bit EXL3 prompt expert tiles on SM121 - #4701
MaverickKB wants to merge 1 commit into
Conversation
Adapt Mia's AI Lab's GLM recipe patch 0078 to the shared-id prompt ABI. Keep the existing activation and output epilogues, shared-expert skip, MMA order and output layout. The source notice credits the K12 input from Aevonix. Record nvcc 13.3 resources for each target and include a two-image driver comparison at the TP2 shape.
|
We maintain the recipe patch this adapts (Mia's AI Lab), so a note from that side. The adaptation is faithful where it matters: the launch ABI is left alone (nine slots, the skip slot kept), the row-group count is chosen at compile time, and the pipeline overlaps the next K tile's trellis decode with the current tile's MMA the same way the original does. Keeping the ABI is the right call for this tree — it keeps the change inside the kernel, and it is the part of the original we would otherwise have had to argue about. We are not putting forward a competing implementation; we would rather see this land. If it helps, we have a 2× GB10 Spark pair (TP=2, |
|
5060 Ti (sm_120) kernel-contract
rc=1 is the limit-problem exit; no gate or control failures on sm_120. |
What this changes
On SM121, four-bit MCG gate/up and down prompt kernels select the number of eight-member row groups at compile time for each expert tile. They overlap the next K tile's trellis decode with the current tile's MMA operations. The existing skip ID, nine output slots, arithmetic order, rotations and activation epilogues remain in the path. GLM already runs a whole prefill pass of up to 4,096 rows through these kernels.
The pipeline adapts patch 0078 by Mia's AI Lab, licensed under Apache-2.0. That patch credits the K12 loop in Aevonix’s GLM recipe. The public source notice identifies both. TensorFold's whole-pass and mixed-width support landed separately. Original patch · Whole-pass support · Mixed-width support
Checks on this head
zig build -j2 test-exl3-prompt-host test-glm-exl3-host --summary allpassed all 23 tests. The focused registry tests passed all 10, including the new compiler-resource case. A host comparison using TensorFold's cubin parser matched all 20 measured compiler records and returned zero launch-limit problems across four kernels and five architectures.zig fmt --check build.zig zigandgit diff --checkpassed. The lean checker reported 165 findings on base and head. The comparison program builds withg++ -O2 -std=c++17 -Wall -Wextra -Werrorand a CUDA driver SDK and OpenSSL.Receipt
The direct comparison used one GB10 on Linux aarch64, CUDA 13.3.1, synthetic trellises and the GLM TP2 expert geometry. Each rank sees hidden width 4,096, intermediate width 1,024, 288 routed experts and eight picks plus the shared slot. The comparison reads complete independent trellises for every expert. Inputs in this fixture contain no prompt text or checkpoint weights.
Values below are median device kernel milliseconds, five alternating pairs at each point. The fixture times one projection per process. No speed claim uses a sum of overlapping GPU activity.
The repeatable device result is strongest for 4,096-row gate/up. It won four of five balanced pairs and all five skewed pairs. The span of the 2,048-row and down samples includes substantial variability. Peak registers on SM121 fell from 128 to 122 for gate/up and 127 to 122 for down. Both use 43,264 static shared bytes at 256 threads, with zero spill loads or stores.
The verifier compared SHA-256 digests of every contiguous 4 MiB block of raw FP16 or FP32 output against main. All blocks matched. It separately checked every ninth-slot sentinel, finite routed FP32 values, and nonzero routed output. The assignments exercised full and partial tiles, all eight row-group classes, four deliberately empty experts, and excess grid blocks. Every target layer in the measured checkpoint uses the shared gate/up input rotation exercised here. The upstream device suite also offers separate-rotation and non-finite cases. Those cases were not run on this PR head.
The comparison program and its build and run commands are in
tools/bench/exl3_prompt_gb10.cpp. Buildexl3_experts.fatbinon the two revisions with the same compiler and SM121 target, then pass those files in order to the program inguanddownmode. The 4,096-row projection fixture allocates about 1.23 GiB for gate/up and 1.20 GiB for down, plus the CUDA context.Live two-GB10 serving. Three cold SparkDash samples per size reported zero cached tokens on a GLM-5.3-Flash EXL3 TP2 worker with DFlash2. These are a production baseline against a combined downstream image, with other traffic present. The new worker was also processing a large production prompt. A post-benchmark snapshot showed one active request, zero generation and KV usage above 14%.
A separate earlier 4K best was 1,044.28 tok/s. The table uses the baseline from this comparison. These serving figures describe the combined image under mixed load. The isolated two-kernel measurement above is the performance evidence attributable to this PR.
Kernel contract
The existing
tf_exl3_prompt_guandtf_exl3_prompt_downentries replace their existing SM121 four-bit bodies. The three-bit twins have matching compiler-resource records for the shared-ID ABI. Each recorded CUDA 13.3 launch matched its compiled cubin on all five supported targets. Earlier compilers still report their prior pending status. This receipt includes the direct raw-output comparison and compiler gate 5 above. The full GPU kernel-contract numerical SUMMARY and planted controls have not been run on this head.Raw paired CUDA event measurements in milliseconds
The two lists in each row are matched by position. Launch order alternated between pairs.
Checklist