Skip to content

glm cuda: full GLM-5.3 (glm_moe_dsa) at TP=3 with a bf16 cache, drafts, slots and prompt steps - #4900

Open
bjornmonnens wants to merge 17 commits into
ashhart:mainfrom
bjornmonnens:glm-dsa-cuda-b
Open

bjornmonnens wants to merge 17 commits into
ashhart:mainfrom
bjornmonnens:glm-dsa-cuda-b

Conversation

@bjornmonnens

@bjornmonnens bjornmonnens commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Full GLM-5.3 (glm_moe_dsa) serves on CUDA as its own family on GLM-5.3-Flash's CUDA pieces, slice (b) of #3063: TP=3 (TP=1 runs the three shares as in-process ranks), a bf16 latent cache, MTP drafts, slots, prefill_step with the lane host's row cap, and resumes on the cold cuts. No new copies of Flash's kernels: two new norm widths, a split-prefill form of the residual add, and per-width launches of the existing EXL3 prompt kernels. GLM-5.3-Flash's code paths, kernels and launch arguments are unchanged.

  • Issue: Refs Full GLM-5.3 (glm_moe_dsa) on three DGX Sparks: a native CUDA family (step 5 of #593) #3063 (slice (b) of the agreed order; (a) landed as glm cuda: Flash pieces take full GLM-5.3's shapes (slice (a) of #3063) #3949).
  • Stacked on: main ac79d6db6. 17 commits:
    • 77b3fcb61 config.json (glm_moe_dsa) as the CUDA pieces' Config, and its TP shares
    • ec904ea4c the family on the GLM engine: a plain residual, shared indexer layers, 6144 and 2048 norms
    • 28f65f44b sums in three shares at TP=1 and TP=3; TP=1 runs them as in-process ranks
    • 2ab07c9f5 ranks take the larger EXL3 expert part a layer each (rank 0 holds 9.6 GiB less)
    • 9ae3a7512 shared indexer layers keep latent rows alone: no index rings or pooled keys (13% less a token)
    • f63fd4a19 mixed-width experts (2, 3 and 4 bits) take the prompt kernels a launch a width
    • bcd15a0be shared indexer layers read their own rows' token lists
    • c840ea981 the plain residual reads its own partial in place under split prefill
    • 2eecca637 the 6144 and 2048 norms under the contract
    • 8b9782745 the engine's load tiler moves to cuda_tile.Tiler (keeps cuda_engine.zig under 600 lines)
    • b56246dd6 prompt steps take the lane host's row cap inside the cold chunks (lanes.step_cap)
    • aa9bb4ac7 FP64 references per projection class at TP=3 shares (glm-ref-dsa)
    • a4ef4340d conformance profile glm53-cuda
    • 5a145476e host test: the prompt-rows fake engine holds no shares (its e.local was unset; CI's test-host-a)
    • f3bed06ef glm-ref-dsa compares the own-partial residual with the gathered one byte for byte
    • 641f48647 the receipt, docs/receipts/glm53-cuda-f3bed06e/ (adds that folder alone)
    • 428b326a6 the receipt's launch as commands, container flags and environment (launch.md)
    • the CHANGELOG line is left to the merge, as main's changelog: #NNNN under Unreleased commits do
  • atc overlap --json: not run (ATC not installed here). The same check by hand on git 2.56: every open pull request's head (376) test-merged against this branch and against main with git merge-tree. Conflicts this branch adds against main's: GLM on CUDA: the latent split's per-rank page book and owner (TF_GLM_KV_SPLIT, #1431 part 1; stacked on #1411) #2415 (profile.zig, cuda_dsa_block.zig, cuda_follow.zig, cuda_native.zig, cuda_state.zig), glm cuda: a dense MLP stored bf16 is read as bf16 in any checkpoint, not only an EXL3 one #3680 (cuda_state.zig) and MiMo-V2.6-Flash on CUDA (2x GB10) with DFlash as the drafter #728 (the EXL3 prompt files, profile.zig, cuda_families.zig); 162 others that touch these files already conflict with main. Whichever lands second rebases.

Notes for review, against the 2026-11-12 comment:

  • Shape and sharing. config_dsa.zig reads glm_moe_dsa into the existing glm.Config (dsa, hc 1, pool 1, the shared-layer bitset); every layer runs on Flash's MLA, DSA indexer, router, EXL3 expert and page pieces. Flash's KDA and hyper-connection paths are skipped for dsa; a plain residual uses residualAdd / rmsnormBy.
  • Ranks. Steps go through the Flash family's Leader / follow; no scheduler or broadcast of its own. The three shares are summed in share order on every rank count (as Nemotron does), so TP=1 computes TP=3's bytes; TP=1 refuses pages, drafters, vision, packs, prompt logprobs, structured output, batched prompts, shared windows, --mtp-confidence and kept states. Other rank counts are refused.
  • Resumed equals fresh. A prompt pass resumes only on its cold cuts (cuda_prompt_cuts). Full GLM-5.3 has no KDA layers, so it declares chunk_invariant: the lane host's cap (--decode-share) cuts a step inside a cold chunk on a 128-row grid through lanes.step_cap.end, every cold cut still lands, and kept states stay on cold cuts. The capped step's rows travel in the chunk header (flags from bit 2): a capped part alone cannot tell 128 rows plus the next id from 129 rows at a prompt's end. GLM-5.3-Flash keeps whole cold chunks and declares no chunk_invariant, as before.
  • FP64 per projection class. glm-ref-dsa: every bf16 projection class (q_a + kv_a, q_b, o, the indexer's keys and weights and its q_b, dense and shared gate/up and down, MTP's eh, the head) at rank 0's and rank 2's TP=3 shares on glm_mm, a prompt call and decode windows of 1 to 64 rows on the same input rows, reported apart by worst column; plus the router at 6144.
  • Kernels. New: tf_glm_rmsnorm_6144 and tf_glm_rmsnorm_2048 (registered, FP64 cases, nvcc 13.0 records, a planted control each); tf_exl3_prompt_{gu,down}_m{4,6,8} (the existing prompt kernels at one width a launch, registered as pending like the existing tf_exl3_prompt_gu / _down); tf_glm_residual_add_own (split prefill's tf_glm_residual_add reading rank me's partial in place, as tf_glm_hc_post_own does; like those two it is not in the contract on main; I can add a case if you want one).
  • No precision or token trades. No FP8/FP4 cache, no load-time weight conversion, no partitioned attention, no context parallelism: those are (d).

What comes next, in the order you set: (c) the conversation states on the core's disk tier (#1411), then (d), one PR each with its quality gate written before any numbers: the FP8 latent cache on the Flash family's E4M3 rows and writers, 4-bit dense projections, and context parallelism once it is compared with the latent split (#2415); the FP4 cache only after FP8 has its data. After those, the speed work, each piece with contract records and FP64 references. For scale only: our own engine on these three Sparks serves 3 streams of 464K tokens with an FP4 cache and 4-bit dense projections, decoding 22 to 35 tok/s; that is the room the follow-ups aim at, not a claim for them.

Checks on this head

  • Head commit: 428b326a6, on main ac79d6db6; tested implementation f3bed06ef (the receipt below, 2026-11-25). Earlier GPU rows ran on these commits over main 42bbc8e35 (f7536bb79); the rebases since met one-line conflicts (profile.zig, cuda_families.zig, CHANGELOG.md, since dropped) and changed no engine code.
  • Lean checker, python3 tools/zig/lean_check.py: main 165, this head 165, 0 new. tools/pr_check.py: 0 errors.
  • Tests run:
    • zig build test-cuda-host compile-cuda-tests: 9,003 tests, 8,961 passed, 42 skipped, 0 failed; one step does not compile on that x86 machine (a clang warning about its GCC install in window_fallback_shim.c, untouched here). The GPU binaries were built on GB10 with nvcc 13.0.88 (Zig 0.17.0).
    • zig build -Dgpu=spark -Dnvcc=/usr/local/cuda/bin/nvcc -Doptimize=fast: builds.
    • glm-cap-check (new, TP=3, full model, on f3bed06ef): 5 prompts with and without request starts, stepped under changing caps (16 steps ending inside a cold chunk) against their cold passes: first token, the next window's logits and tokens, and every state byte but the index rings' equal.
    • glm-ref-dsa (new, one GB10, on f3bed06ef): 11 classes at both shares and the router at 6144, worst column at 0.714 of its float64 tolerance; and tf_glm_residual_add_own against tf_glm_residual_add byte for byte, NaN in the rank's own gathered slot: 40 cases (worlds 2 and 3, every rank, 1 to 1,024 rows, widths 6144 and 2048), the same bytes, so split prefill's FP32 sum keeps its order.
    • TP=1 against TP=3, 8 layers, drafts on: 6/6 greedy and 6/6 sampled (seed 7, T 0.8) replies identical.
    • tools/conformance.py tools/conformance_profiles/glm53-cuda.json on f3bed06ef, BF16 cache (cache-off and cached servers one after the other on the same three Sparks): 7 passed, 0 failed, 0 skipped. drafted == plain 10/10 (401 of 683 drafts accepted), repeat 10/10, concurrent == solo 28/28 (levels 1 and 2, drafted and plain, 16 with a long prompt among decoders), resumed == fresh 6/6 (4,096 cached each), refusals 4/4, cancel 4/4, evict 3/3. Every request's token sha256 is in the receipt's records/conformance.json (103 rows).
    • Needle at 99,968 tokens: found.
  • CI: runs on this pull request.
  • Not run, and why: no sm_80/86/89/120 GPU (nvcc 13.0 records for those); --drafter (DFlash2) not run, MTP drafts only.

Receipt

  • Receipt folder: docs/receipts/glm53-cuda-f3bed06e/ (tested f3bed06ef, 2026-11-25): the checkpoint's revision and every one of its 146 files' sha256 (the same on all three hosts), both binaries' sha256, every launch command, container flag and environment variable, the conformance receipt with each request's token sha256, and the glm-cap-check, glm-ref-dsa and contract logs. Machine names and addresses are placeholders; values and hashes are as written.

  • Main against branch: GLM-5.3-Flash EXL3 4bpw at TP=2 on two DGX Spark (GB10), greedy, main 42bbc8e35 against these commits on it: the same 8 greedy replies (4 solo, 2 long prompts of about 9k and 22k tokens, 2 paired); bench_cache.py --require-cold, 16,384-token prompt: same token_sha (b59261eacf82), cold ttft_s 11.31 s on main, 11.28 s on the branch; bench_openai.py --tokens 256 --reps 5 --temperatures 0, median decode tok/s:

    prompt main branch
    fibonacci-raw 65.0 63.6
    gpu-chat-no-think 28.2 27.2

    Within run-to-run spread (the branch's runs 51.5 to 64.7 and 26.3 to 29.9; main's 63.7 to 65.2 and 23.7 to 28.6).

  • Boxes it reaches: CUDA GLM-5.3-Flash (unchanged paths); CUDA full GLM-5.3 (new).

  • New switch? None. Full GLM-5.3 takes the existing --decode-share cap through chunk_invariant.

  • Environment: Zig 0.17.0; CUDA 13.0 (nvcc 13.0.88); 3× DGX Spark, NVIDIA GB10 (sm_121), Linux aarch64, 200G RoCE between them; Mia-AiLab/GLM-5.3-EXL3-2.75bpw-TensorFold revision 2d747d0e30eca6e3fe37ba63c471cdf9172faa83 (bf16 dense, mixed 2/3/4-bit experts, MTP layer).

  • Paths and platforms the change reaches: CUDA only. Ran on sm_121.

  • Exactness: the conformance gates above; TP=1 against TP=3; capped against cold passes.

  • Full GLM-5.3, bf16 cache, TP=3, --parallel 2, --context 102400, MTP drafts on: bench_openai.py --tokens 256 --reps 5 --temperatures 0 median decode: fibonacci-raw 20.1 tok/s, gpu-chat-no-think 18.0 tok/s; bench_cache.py --require-cold, 16,384-token prompt: cold ttft_s 32.7 s (about 500 tok/s); a 99,968-token needle prompt read in 209.8 s (477 tok/s) and answered; two streams decode 28.9 tok/s together.

  • Licence of any new weights or drafter: n/a.

Kernel contract
  • Registered: tf_glm_rmsnorm_6144 and tf_glm_rmsnorm_2048 (new widths of the GLM norm template, no old entrypoint) against float64, rows and 64-sums at 1, 70 and 2,048 rows. nvcc 13.0 records: 6144 58/58/58/48/48 registers (32 bytes static), 2048 40/40/40/39/39 (16 bytes), sm_80/86/89/120/121.
  • Planted controls, each failing as planted: each width launched with stride 0, every row reading row 0.
  • CUDA SUMMARY on GB10 (sm_121), kernel-contract glm mla, on f3bed06ef: 62 kernels pass gates 1-4, 0 fail, 5 known findings; 15 controls red as planted, 0 missed; 4 limit problems, the same four as main on the same machine and as the sm_120 run posted below: tf_ctl_glm_old_rmsnorm_512, _1536, _4096 and tf_ctl_glm_old_hc_finish, live static shared 128 bytes against recorded 16, 16, 32 and 48 (registers equal). The records match the source; since 542deb953 the contract_controls image also holds flashnext_hcn.cuh, whose extern __shared__ __align__(128) makes nvcc pad every kernel's static block of that image to 128 bytes (shown offline: 1040/1040/1056/1072 bytes alone, 1152 with that header, 1152 with one __align__(128) declaration, 1088 for _4096 with __align__(64)). The receipt's README has the table. Those records are main's; this pull request leaves them as they are.
  • kernel-contract-limits over sm_80/86/89/120/121 images: against main's the only new stale records are the six tf_exl3_prompt_*_m* launches, pending like main's tf_exl3_prompt_gu / _down.
  • Chips I could not run: sm_80, sm_86, sm_89, sm_120.

Checklist

  • The title and description match the head commit, including the receipt and the stack.

  • New tests fail before the change, pass after it, and skip cleanly without their dependency.

  • Comments and docstrings are one line. No measurements or history in the source.

  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.

  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.

  • No precision traded for speed. If the bits change, the description says which sums change and why.

  • Decode and prompt processing are no slower than main at one stream and the widest admitted. (GLM-5.3-Flash at --parallel 2, no drafter.)

bjornmonnens added a commit to bjornmonnens/TensorFold that referenced this pull request Nov 24, 2026
bjornmonnens added a commit to bjornmonnens/TensorFold that referenced this pull request Nov 24, 2026
…' Config, and its TP shares

config_dsa.zig reads a glm_moe_dsa config.json (glm_dsa's parser, reused
through a build import) into the CUDA pieces' glm.Config: dsa set, a plain
residual (hc 1), pools of one key, the shared indexer layers as a bitset,
576-wide roped latent rows and a 64-dim index rope, and the MTP layer. It
refuses shapes the kernels do not take: tied embeddings, rope pairs that
are not interleaved, a vocabulary off 128s, a malformed n_shared_experts or
a non-boolean flag. Share.of cuts heads one by one, widths in 64s, and
EXL3 experts and the vocabulary in 128s; a full GLM-5.3 rank holds no KDA
heads. Config.max_layers rises to 96 for its 78 layers and MTP layer;
GLM-5.3-Flash's configs and the Metal family's weights keep their 46.
…ual, shared indexer layers, 6144 and 2048 norms

cuda_native_dsa registers glm_moe_dsa as an entry of the GLM CUDA engine,
and cuda_dsa_load.zig loads its layers under the checkpoint's "model."
prefix. Every layer runs on GLM-5.3-Flash's DSA block; the residual is
plain: residualAdd after attention and the MLP and rmsnormBy for the site
norms, so the hyper-connection kernels are not launched. A shared indexer
layer runs no indexer of its own and attends the token lists its indexed
layer left in scratch. The GLM norm template gains two widths,
tf_glm_rmsnorm_6144 (hidden) and tf_glm_rmsnorm_2048 (q_lora), and SwiGLU
runs unclamped. GLM-5.3-Flash's loads, kernels and launches are unchanged.
…ns them as in-process ranks

Config.shares is 3 for full GLM-5.3 (0 for GLM-5.3-Flash: one share a
rank). Every row-parallel sum adds the three shares' fp32 partials in
share order, as Nemotron's do, so a TP=1 server computes TP=3's bytes. At
TP=1, cuda_engine_shares.zig loads the other two shares' weights, states
and buffers and runs them as in-process ranks over Exchange.local; other
rank counts are refused (SharesNotOnRanks). TP=1 refuses KV pages,
drafters, vision, packed linears, prompt logprobs, structured output,
several prompts in one pass, shared windows and --mtp-confidence
(SharesOneRankEach), and kept states (SharesKeepNoStates); a stream's
planned bytes count the held shares' states.
…er each; rank 0 holds 9.6 GiB less

An EXL3 expert's 2,048 intermediate rows cut at 128-row tiles into parts
of 768, 640 and 640 rows. With one cut for every layer, rank 0 held the
768-row part of every MoE layer. Share.moeAt rotates it: layer i's larger
part goes to rank (rank + i) mod world, and moeMost sizes the buffers for
it. On the 2.75bpw checkpoint rank 0's weights fall from 105.6 to 96.0
GiB. GLM-5.3-Flash keeps one cut for every layer.
…: no index rings or pooled keys, 13% less a token

A shared indexer layer reads the token lists its indexed layer chose, so
its cache keeps latent rows alone: no index key or gate rings and no
pooled keys. The caches' shape moves into cuda_cache_shape.zig (a cache a
DSA layer and the MTP layer, the shared ones flagged), which the state
arena, the pages and the snapshot layout read. Full GLM-5.3 takes 94.4 KiB
a token instead of 108.6. GLM-5.3-Flash has no shared layers, so its
layouts are unchanged, as the snapshot layout test pins.
… kernels a launch a width; full GLM-5.3's layers use them

The glm-exl3-layer GPU check reads full GLM-5.3 (its config, prefix and rotated cut) and sizes the
prompt plan for every slot, the shared expert's included.
…oken lists

A paired prompt step's second chunk shared the first's DSA scratch, token
lists included, so a shared indexer layer could attend the other chunk's
picks: rows its own chunk had not written. Cold prompts past about 6.6K
tokens then varied from run to run (TF_KV_POISON=1 turned the reply to NaN
from the second shared layer on). A paired chunk now keeps its own token
lists and counts, and a shared window's streams pick into their own rows.
Both hold only for full GLM-5.3 (Index.apart): GLM-5.3-Flash has no shared
layers and keeps one set of lists, as before.

On three GB10s, with the prompt cache off: three cold 25K-token prompts gave
one reply, drafted and with "draft": false; a copied 1,741-token reply equalled
its plain one; two concurrent 8K-token prompts equalled their solo replies.
…e under split prefill

Since ashhart#4510 split prefill sends only the peers' partials: rank me's slot of the gathered buffer is unused and its
partial stays in place. tf_glm_residual_add_own sums as tf_glm_residual_add does, rank 0 first, with rank me's
partial read from own (glm_glue::ranks8own, as tf_glm_hc_post_own).
tf_glm_rmsnorm_6144 (hidden, 8 warps over an 8,192-wide block) and
tf_glm_rmsnorm_2048 (q_lora, 4 warps) are new widths of the GLM norm
template with no old entrypoint, so each is checked against float64
alone: rows and 64-sums at 1, 70 and 2,048 rows, with the weight read
as bf16. Two planted controls launch each width with stride 0, every
row reading row 0, and must fail gate 3.

nvcc 13.0.88 records on sm_80/86/89/120/121: 58/58/58/48/48 registers
at 6144 (32 bytes static), 40/40/40/39/39 at 2048 (16 bytes), measured
from the glm_glue image with the build's flags; the same measurement
gives rmsnorm_4096's existing record.

The runner's GLM norm registrations move into contract_glm_norms.zig's
Set, which keeps contract_tests.zig under 600 lines.
The struct Engine.init built to pad KDA inputs and tile the linears
after a rank's weights load moves beside the two functions it calls,
as cuda_tile.Tiler; the engine and the held shares' loader pass it to
cuda_load_owner.finish as before. No behaviour changes; it keeps
cuda_engine.zig under 600 lines.
…side the cold chunks

The lane host hands a prompt step a row cap (--decode-share's rows
beside live decoders) only to a family that declares chunk_invariant.
GLM declared none, so a long prompt ran whole 2,048-row cold chunks
while the other streams waited. Full GLM-5.3 has no KDA layers, whose
chunked scan is why GLM-5.3-Flash's tokens depend on its cuts, so it
now takes the cap the way Qwen 3.5 CUDA does (lanes.step_cap):

- cuda_prompt_cuts.cappedEnd cuts a step inside its cold chunk on a
  128-row grid from the chunk's start, never past the cold cut, so
  every cold cut still lands and an uncapped step is the cold pass's;
  cappedRows is every rank's check of such a step.
- Leader.chunkCapped sizes a capped step, or the rest of a chunk a
  capped step began, and sends its rows in the chunk header's flags
  from bit 2: a capped step's part alone cannot tell 128 rows and the
  next id from 129 rows at a prompt's end. Engine.cap_rows carries
  them into prefillChunk for this step alone, as index_split does.
- Kept states and resumes stay on cold cuts: an interrupted step past
  a capped one keeps no state there, since no resume would read it.
- The lanes backend declares chunk_invariant for full GLM-5.3 alone;
  GLM-5.3-Flash steps and validates exactly as before.

glm-cap-check (tf-cuda-test) is the device qualification: five
prompts, with and without request starts, stepped under changing caps
against their cold passes, comparing the first token, the next window's
tokens and logits, and every state byte but the index rings: at a pool
of one key they hold a step's keys only until pool_keys copies them, and
a capped pass rebases them at other rows. On three GB10s at TP=3 it
passes with 16 steps inside a cold chunk. Host tests cover the cuts,
the declaration and the lane path's cap argument.
…glm-ref-dsa)

Full GLM-5.3's bf16 projections take glm_mm at shapes GLM-5.3-Flash
never sends, and a decode window's K slices follow (n, k), so each
class gets its own float64 reference: q_a and kv_a, q_b, o, the
indexer's keys and weights and its q_b, the dense and shared expert
gate/up and down, MTP's eh and the head, each at rank 0's and rank
2's TP=3 shares (22 and 21 heads, 704 and 640 shared rows, 51,712 and
51,584 vocabulary rows). A prompt call and decode windows of 1, 4, 17
and 64 rows (1 and 4 for the head) run on the same input rows and are
reported apart, each by its worst column.

The router check takes the hidden size, so glm-ref keeps 4096 and
glm-ref-dsa adds 6144.
The served exactness profile for glm_moe_dsa: drafted against
"draft": false, repeat, concurrent at one and two streams against
solo, resumed against a cache-off server, the shared refusals, cancel
and evict. Its ranks span three nodes, so it runs with --url and
--fresh-url against servers started a rank a node.
@joshuaswarren

Copy link
Copy Markdown
Contributor

sm_120 kernel-contract measurement (RTX 5060 Ti, tf-cuda-test kernel-contract glm mla, built -Dcpu=baseline -Dsm=120 -Dnvcc):

(filtered) SUMMARY 62 kernels: 62 pass gates 1-4, 0 fail, 5 known findings;
15 controls: 15 red as planted, 0 missed; 4 limit problems;
gates 1224313 ms, limits 44 ms

All real gates pass — mla chunks/split/merge, glm_vision vis_qk, vit attention, glm_topk (flat-pick semantics, non-finite logits, deterministic five-run byte-identical), combine_tail. The 4 limit problems are all tf_ctl_glm_old_* control kernels whose recorded shared bytes (16/32/48) predate the actual 128-byte launches — a stale-record pattern on the baseline controls, not the new launches.

@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thanks @bjornmonnens. The full-model shape, three-share handling, shared index lists and mixed-width prompt launches are present. The existing Flash branches remain separate, and this head merges cleanly with main.

This is ready for an exact comparison, with the BF16 cache. Before landing, please include the checkpoint revision and file digests, the tested head and launch settings, and the full-model token results for drafts, capped prompts, slots and cache restore. The description stops before those results. The posted contract subset is useful, but its four limit failures still need their per-symbol explanation. Please also include a byte comparison for the new own-partial residual path; a float64 bound alone does not establish unchanged FP32 order.

  • Synthena

…sidual_add byte for byte (NaN in the own slot)
@AIFlowML

Copy link
Copy Markdown
Contributor

The clean trial merge of 5a145476e3 into 4c79cfe346 passed all 65 focused tests on M5 Max and cross-compiled the native Linux ARM64 CUDA adapter.

zig build test-glm-tp3-host test-glm-exl3-host test-glm-exl3-prompt-host test-glm-prompt-settings-host test-glm-formats-host check-native-cuda-host -Dfixed-cpu -j2 --summary all

For the own-partial residual comparison, I compiled the two residual bodies and their rank-sum helpers from glm_glue_rows.cuh into a CPU fixture, with stand-ins for the CUDA loads, BF16 stores and launch coordinates. At TP=3, each choice of local rank produced all 24,576 BF16 outputs byte-equal to the gathered path (4 rows × 6,144 values). The fixture poisons the unused gathered slot for that rank and includes ordered partials [2^24, 1, -2^24] to distinguish the FP32 sum order. That is a small input for the requested device byte comparison. CUDA execution and full checkpoint exactness remain open.

Igor Lessio - AIFLOW LABS

…launch settings, conformance token rows, capped steps, the own-partial residual byte for byte, the contract's four limit records
…nch.md) in place of this machine's wrapper scripts
@bjornmonnens

Copy link
Copy Markdown
Contributor Author

@ashhart, thanks. The head is now 428b326a6. The tested implementation is f3bed06ef, and its receipt is in
docs/receipts/glm53-cuda-f3bed06e/ (the last two commits touch only that folder). All runs are on three GB10s at TP=3 with the
BF16 cache (no --kv-cache flag).

Checkpoint, head and launch. Mia-AiLab/GLM-5.3-EXL3-2.75bpw-TensorFold at 2d747d0e30eca6e3fe37ba63c471cdf9172faa83.
checkpoint-sha256.txt lists all 146 files' sha256, which are identical on the three hosts. commit.txt gives the
tested commit and tree, binaries.txt both binaries' sha256, and launch.md every server and check command, container
flag and environment variable (--context 32768 --parallel 2 --no-thinking --tp 3 --rank R, prompt cache 0 or 2 GiB, MTP drafts on).

Full-model token results (records/conformance.json keeps all 103 requests, each with the sha256 of its token ids):
tools/conformance.py with the glm53-cuda profile passes 7 of 7.

  • drafted == plain: 10/10
  • repeat: 10/10
  • concurrent == solo (slots): 28/28, at levels 1 and 2, drafted and plain, 16 of them with a long prompt among the
    decoders
  • resumed == fresh (cache restore): 6/6, with 4,096 tokens restored each time
  • refusals: 4/4
  • cancel: 4/4
  • evict: 3/3 against cache-off

Capped prompts: in glm-cap-check, 5 prompts in 16 capped steps equal their cold passes in the first token, the next
window's logits and tokens, and every state byte except the index rings'.

The four limit failures. These are main's planted-control records, and they show the same way on main on this
machine: tf_ctl_glm_old_rmsnorm_512, _1536 and _4096, and tf_ctl_glm_old_hc_finish. The live static shared size
is 128 bytes against recorded 16, 16, 32 and 48, and the registers match. The records match the source. Since
542deb953 the contract_controls image also holds flashnext_hcn.cuh, whose extern __shared__ __align__(128)
makes nvcc pad every kernel's static block in that image to 128 bytes.

Compiled offline (nvcc 13.0, sm_121, including the 1024 reserved bytes):

  • the four alone: 1040, 1040, 1056 and 1072 bytes;
  • with that header: 1152 for all four;
  • with one __align__(128) declaration instead: 1152 for all four;
  • with __align__(64): 1088 for _4096.

The receipt's README has the table per symbol. I've left those records unchanged here. Re-measuring them fits a small
separate change, and I'm happy to open one. @joshuaswarren's sm_120 run (62/62 kernels, 15/15 controls) matches this:
the same four symbols and the same 128 bytes.

Own-partial residual, byte for byte. glm-ref-dsa now compares tf_glm_residual_add_own with
tf_glm_residual_add on the same inputs, with NaN in the rank's own gathered slot. That covers 40 cases: worlds 2 and 3,
every rank, 1 to 1,024 rows, widths 6144 and 2048. The bytes are the same in every case, so split prefill keeps the FP32
order: rank 0 first, then each rank's partial in turn.

Performance is outside this pull request. It comes next, each part in a pull request of its own with its quality gate
written before any numbers, in the order from #3063: (c) the conversation states on the core's disk tier (#1411), then
(d) the FP8 latent cache, 4-bit dense projections and context parallelism, and after those the further speed work.

@AIFlowML, thanks for the trial merge and the CPU fixture. The two points you left open are now in the receipt: the
same comparison executed on the device (above: 40 cases on a GB10, NaN in the own slot), and full-checkpoint exactness
at TP=3 (the conformance rows and glm-cap-check).

This branch has not been deployed

No deployments
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.

4 participants