Repository navigation
glm: SparkGLM on four Sparks (TP=4 ring or chain), native MTP and the rest of 0.2.0 - #321
Merged
Merged
Conversation
The trait surface of the four-rank RDMA transport, stable for the model layer: gather, broadcast, reduce-scatter (plain, FP8, fused), all-to-all, collective channels, and the kernel a backend expects. Every method defaults to unavailable; the chain itself follows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ATLAS_RDMA_ALLREDUCE=1 with three or four ranks now brings up the switchless chain (ATLAS_RDMA_LEFT_RAILS, ATLAS_RDMA_RIGHT_RAILS), closed into a ring with ATLAS_RDMA_TOPOLOGY=ring. Gather, broadcast, reduce-scatter (plain, FP8, fused), all-to-all and the command ring run over relaying proxies and rdma_chain_bf16. Multi-rank completion words follow the payload's parity slot, so a newer flag on another QP cannot overtake an older payload. Two ranks stay as they were: the pair keeps its region layout, its 14-argument launch and its head, and the chain is reached only after the pair's branches. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port the appended GLM predictor from SparkGLM 0.2.0 (Enntity/atlas c87f279): the rank-zero Glm5MtpHead proposer with its private BF16 KV, prompt and repair writes, confidence stop, prefix snapshots and joint KV budget, the factory capability checks, the canonical target hooks in decode/verify, the prefix agreement and warm follower probe, the scheduler's bootstrap, K2/K-gamma repair and native admission, and the launch preflight. Every path is gated on the rank-symmetric native_glm_mtp capability or ATLAS_GLM_STRICT_NATIVE_MTP. hc_bf16_for and the FFN lane check keep their short-circuits so Qwen pays no environment read. Also carried: ATLAS_PROFILE_PREFILL's MLA steps (layers::prefill_profile), and the TP4 chunk alignment (prefill_row_multiple, chunk_align, sp_final_cut); at a row multiple of 1 chunking matches main exactly. Hardware: none of this ran on a GPU here. Host tests only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h to four ranks The model now hands the chain its kernel at any world size above one; it sat inside the two-rank block, so four ranks never left NCCL. The bench drives the chain and ring through the serving backend. Chain NIC loopback, topology and bootstrap tests come across with the code, split to the size cap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ATLAS_GLM_PACKED_PREFILL=1 (default off): every new short prompt of a tick in one target traversal, one EP command (0xFFFFFFE8). glm_packed_scope pins each row-count dependent kernel choice while a pass runs, so a prompt's output does not depend on its company. Off, packed_prefill_capacity is (0, 0) and only a cached thread-local read is added to the prefill kernel choices it pins. ATLAS_GLM_PACKED_PREFILL_CHECK and _MAX_TOKENS come with it, and scripts/dev/packed_check_compare.py compares the check lines between runs. Also from the reference: - ATLAS_TAIL_SPLIT_MIN_TOKENS (SparkGLM ENGINE.md opt-in), in startup parity. - ATLAS_GLM_DET_DUMP and the DFlash verify det-trace taps (v_out, v_final, v_logits), and scripts/dev/det_dump_compare.py. - ATLAS_HOST_SYNC_TRACE (spark_runtime::host_sync_trace). - The tool guard's bound on unreleased raw tool syntax, which main had only through the detector's pending_tool_bytes accessor with no caller. - ATLAS_PROFILE_PREFILL's KDA core steps and TTFT_TRACE's pack= field. Split from the reference for the 500-line cap: model/glm_packed_prefill/compute.rs, det_trace_dump.rs, and try_dflash_capture_all into dflash_capture_batch.rs. Hardware: the packed exactness claim needs PACKED_CHECK on a GPU. Unverified. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…LM 0.2.0 glm_fp4l_native_bench (split into support/gate for the 500-line cap), glm_sparse_heads_check and w4a16_kda_shard_check, behind gpu-examples. All three compile on this host; they need a GB10 to run. glm_sparse_heads_check's 16-head launches and w4a16_kda_shard_check's TP4 shards pair with the TP-4 GLM bundle's kernels. Co-Authored-By: Claude Opus 5.5 <[email protected]>
prefill_mla_kv_only indexes on the attached BF16 sparse MLA capability rather than the long-context switch, as the reference does, so a native predictor with the toggle off still keeps its semantic index. Packed prefill declines under native MTP: a packed pass does not feed the predictor its prompt, so the first proposal would fail with no target boundary. can_batch_glm_long_verify and decode_is_canonical_verify read the lane switches after the model and canonical checks, as main did, so other models and lanes pay no extra environment read. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A verify row on the vocabulary-split head holds only this rank's shard of the logits, so requested logprobs on that path read a partly stale row. Fetch the full rows first, as SparkGLM 0.2.0 does, and refuse a logprob request before dispatch when the exchange cannot serve it. Only requests with logprobs on the split head change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The piecewise KDA verify path gates on TP2 or TP4, as the reference does. It needs ATLAS_GLM_VERIFY_GRAPH, so nothing changes at TP2. Pairs with the comm bundle's captured one-shots; not exercised on TP4 hardware here. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port the four-rank lane from Enntity/atlas f4d95a1 (AGPL-3.0-only) onto main, over the chain transport of sg/tp4-comm: - Preflight: the long-context lane resolves the TP4/EP4 chain, and two-rank lanes that cannot run beyond a pair are refused or logged at startup (preflight/glm_chain.rs). - Prefill: sequence-parallel rows over four ranks, the two-half pipeline (ATLAS_GLM_PREFILL_PIPE2), quantized gathers for MoE, MLA and KDA, the o_proj all-to-all and ahead lanes, the MoE output seam, and the chain's KV shard. - Decode: vocabulary-split head, sampled verify, dense TP split, shared expert split and rank-split drafter over 1/n shares; owner verify up to 64 rows; dead rows (ATLAS_DFLASH_DEAD_ROWS) and the chain's priced widths. - Native sparse attention: an in-tree 16-head entry of NVIDIA's single-group kernel, in place of the out-of-tree library's dispatch. - Scheduling: row multiples for SP chunks, ATLAS_TAIL_SPLIT_MIN_TOKENS. - Loading: 1/ep expert slices at EP4, TP2 NVFP4 scales for TP4 shards, the whole KDA/MLA tensors the gathers need, per-lane cuBLASLt/CUTLASS scratch. - ATLAS_MOE_PREFILL_ROW_BOUND and ATLAS_HOST_SYNC_TRACE. TP2 and Qwen keep their paths: chain lanes are gated on more than two ranks or an off-by-default switch, and owner verifies without dead rows allocate nothing new. Native MTP and packed prefill stay with their own bundle. Host tests only: kernels are not compiled here, and nothing has run on a GB10. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reconcile native MTP and packed prefill with the TP4 lane: the owner-verify, sparse decode and independent gates take the chain, the pipelined half-chunk pass captures native MTP rows, and packed prefill pins the TP4 quantized gathers off. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The launcher's flags for each serving mode resolve the four-rank topology before GPU init, and four ranks without the RDMA chain refuse at the gate. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 9d8728f)
(cherry picked from commit a894faf)
(cherry picked from commit 90195f3)
The native tower sized itself from `max_pixels`, which GLM's processor config does not declare, so it held 6400 patches and 16384 rows. The preprocessor sizes from the token budgets (8000 tokens a still, 30000 a video), so a 1080p photo passed admission and failed at encode. SparkGLM 0.2.0 holds the budgets. From Enntity/atlas 6e400b3 and f4d95a1, for worlds past the pair: - GlmCapacity::budgets: 120000 patches a sequence, the largest item plus 16384 neighbouring rows. The token-local stages (patch embed, block MLPs, merger) run in 4096-row launches, so their scratch stays bounded; attention still reads the whole sequence. - A worker holds only the row buffer: no vision weights, no ViT scratch. Rank 0 encodes every item. `Glm5WeightLoader::dead_namespaces` skips the tower, using main's existing skip. A pair keeps its bounded capacity (GlmCapacity::bounded) and one launch per stage. It shares the tower's reworked buffer layout, which holds about 310 MiB less scratch at the same capacity and computes the same rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
From SparkGLM 0.2.0's decode path: - ffprobe's rate parses in f64. GLM picks frames and floors timestamps from `index / fps`, so 30000/1001 rounded through f32 could move a frame across a boundary the reference does not. - The probe drains stderr on its own thread and bounds both pipes at 64 KiB, killing a child that overruns. - A decode that hits its output cap kills ffmpeg before draining stderr, as the comment there already said; it was waiting for the watchdog. A timeout now reports as a timeout rather than as the read it cut short. Tests also pin main's GLM frame sampler against the serving processor's indices and the index decode against a full decode. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pieces of SparkGLM 0.2.0 that the two-Spark series and the TP-4 ports left out, none of them on a probe's path: - An owner with dead rows (ATLAS_DFLASH_DEAD_ROWS, on in the shipped profiles) judges fewer drafts than it verified rows. verify_dflash_tail told commit_accepted_prefix the drafts it judged, not the rows it ran. - build_model never installed the store ATLAS_DFLASH_WARM_CTX=restore reads, so warm turns silently fell back to the seeded window. - Native-MTP sequences leave the shared prefill capture alone. - A serving mode with no calibrated local experts is refused instead of warned past. - vLLM's spec-decode counters, for benchmarks that read its `/metrics`. - The CUTLASS workspace is prewarmed where the FP8 prefill GEMMs use it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ests A blocking completion can now return the exact generated IDs, before text stripping and without an echoed prompt; streaming refuses the option. A client asking for them got a success with no IDs. Off by default, and the wire is unchanged without it. Tests from 0.2.0: the Anthropic error-type table, guard_stop on both stream finish layouts, the vision pixel bound in rank parity, and a deterministic clock for the warm-chunk budget in place of a sleeping one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLM-5.3's MODEL.toml pins `top_n_sigma = 0.0`: sampling follows generation_config.json and nothing else, as vLLM serves it and as SparkGLM 0.2.0 does. The card's value only reached `min_p`. With `use_sampling_presets_for_core` off, every GLM request that names no sigma fell through to the CLI default, 1.0, which cuts temperature 1.0 sampling to near-greedy (the Qwen cards say as much). Greedy probes never see it. This changes sampled output on every GLM world, the pair included, towards what 0.2.0 serves; greedy output and other models are unchanged. Other cards' `top_n_sigma` keeps governing their presets alone (`server_default_preset`), as before. --reference-mode already got 0. From Enntity/atlas f4d95a1, with its tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The tests SparkGLM 0.2.0 carries that main's port left behind, all passing on main's code: image and video sizing against the serving processor's own numbers, the prompt-tail reasoning rules, a server with no thinking budget, and literal tool markup in both parsers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A 1080p still passed admission on a pair and then failed at encode, which 0.2.0 served. Pair workers now hold no tower either. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Under dash, sh -c yes forks yes, and the orphan held the pipes open after sh was killed, so the test hung on Linux CI. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…1091) The branch added 40 ATLAS_* names; the ratchet allows none. 31 go, with no behaviour change under the shipped profiles (4x1m-tp4 at TP4; 4x1m, 4x512k, 8x128k at TP2; Spark and Strict through install/serve.py): - TP4 tunables the four-rank profile always sets are now the chain's behaviour, each still gated to more than two ranks so the pair is untouched: the SP KDA/MLA/MoE quant gathers, the MLA o_proj ahead, the MoE output seam with a 32-CTA unpermute and one-block gather groups, the index split's compact rows gathered beside, dead verify rows, the chain reduce-scatter's 24-block grid (16 under the NIC loopback tests, which share one GPU) and its 16 MiB fused segment. - Tunables no launch sets keep their default as a constant: the 4 MiB chain all-reduce split, the 32-row owner-verify budget, the packed prefill's 512-token prompt bound, the always-on per-block MoE gather; ATLAS_TAIL_SPLIT_MIN_TOKENS (default 0) reverts to main's split rule. - Strict native MTP's 0.95 confidence stop follows ATLAS_GLM_STRICT_NATIVE_MTP; the HEAD / FINAL_NORM / NVFP4_EH guards checked values no code reads. - Unset opt-in arms go with their code: the not-bit-exact wg2 sparse pipe, the MoE prefill row bound, the native MTP zero first embedding. - Diagnostics: the host-sync trace (a branch on every sync) and the det-trace byte dump go; the PIPE2 trace logs at DEBUG; PACKED_CHECK runs under ATLAS_GLM_DET_TRACE. Test-only names become constants, the serving ATLAS_KV_NVME_DIR, or a direct topology check. Kept: the four-rank rails and topology the launcher passes, and six opt-in features too large to drop here (packed prefill, two-half prefill pipe with its second chain channel, the KDA and MLA all-to-all o_proj, the E4M3 routed down). Nine of main's diagnostic names that nothing sets (the launcher strips ambient ATLAS_* anyway) go to pay for them; the GEMM-shape and thinking-decode traces move to RUST_LOG=debug. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd path's eligibility A panic in the proxy left every broadcast spinning, since only an error failed the relays. The forward path now refuses a reduce-scatter or all-to-all below four ranks, as the send path does. From the review. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The MoE seam's fused reduce-scatter cuts each rank's segment into the reduce-scatter's 8, 4 or 2 pieces, and its producer writes whole hidden-size rows. A prefill chunk whose rows a rank are not a multiple of that count (1356 at TP=4: 169.5 rows a piece) passed rs_fused_begin, which checked only 16-byte alignment, and then failed the seam's tiling check, terminating every rank mid-request. SparkGLM 0.2.0 has the same code. rs_fused_begin now takes the producer's row size and returns None unless every piece is whole rows (fused::split), before it takes a sequence number, so the seam falls back to its reduce-scatter a block on every rank alike. Shapes that tiled before take the fused op exactly as before. The copy producer in the loopback test and comm_pair_bench passes 16 bytes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
Gated this head (
Merging on green CI. The main sentinel checks the merged main afterwards. |
4 tasks
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.
Summary
This brings the rest of SparkGLM 0.2.0's engine to main. #309 carried the two-Spark path. This PR adds everything else:
--strict-mtp.On main today, a four-rank GLM launch stops before GPU init with
resolved long-context GLM topology mismatch.Like #309, this is one PR because the parts were built and checked together. The
Enntity/atlasbranches show them by topic:sg/tp4-commCommBackend: sum, broadcast, gather, reduce-scatter (BF16, FP8, fused), all-to-all and the command ring. Includes the ring's cross-QP completion fix. Two-rank pair paths are unchanged.sg/tp4-mtp--strict-mtp), packed multi-prompt prefill, and the split head's full-vocabulary verify rows.sg/tp4-glmChanges beyond the ports, each its own commit:
commit_accepted_prefix. On hardware this showed as lower, non-deterministic draft acceptance at C2 (4b6c43c).top_n_sigma = 0.0from MODEL.toml now reaches the server defaults. Main read it only for presets, so GLM ran sampled requests at the CLI default of 1.0. This changes sampled output at TP2 too, to match 0.2.0. Greedy output is unchanged (66e7fe4).rs_fused_beginnow takes the producer's row size and returnsNonefor such a split before it takes a sequence number, and the seam reduces a block at a time instead. SparkGLM 0.2.0 has the same bug (1259f31).return_token_idson/v1/completions(d80bc8e).The env-name ratchet (#117)
The branch is at 1091 / 1091:
ATLAS_RDMA_TOPOLOGY,ATLAS_RDMA_LEFT_RAILSandATLAS_RDMA_RIGHT_RAILS.ATLAS_SNAP_LOOKUP_DBG,ATLAS_SSM_H_FP16_DEBUG,ATLAS_LOAD_TIMING,ATLAS_DUMP_EMBED,ATLAS_RESET_COL_PROFILE,ATLAS_ATTN_DBG,ATLAS_GLM_KDA_MS_PROFILE(this one was read on every decode step),ATLAS_GEMM_SHAPE_LOGandATLAS_THINKING_DECODE_TRACE. The last two moved toRUST_LOG=debug.If you'd rather keep main's names and drop the six opt-in features, say so and I'll cut them.
Part of #220.
Test plan
cargo fmt --all -- --checkRUSTFLAGS=-Dwarnings ATLAS_SKIP_BUILD=1 cargo clippy --locked --workspace --testswith the pinned 1.93.1 toolchainpython3 scripts/check_spdx.py,python3 scripts/check_env_budget.py(1091 / 1091), and the file-size capcargo test --workspace --lockedon Linux arm64 withscripts/ci_gpu_stubs.sh. Everything passes except three tests that fail identically on unmodified main 9c45191:cli::bench_selfstart::tests::a_baseline_declared_serve_pin_reaches_the_rendered_serve_args_without_cli_flagstui::bench_variants::tests::entering_the_agentic_benchmark_opens_the_variant_steptui::bench_variants::tests::the_agentic_gate_declares_both_variants_in_this_treevideo_decode_ffmpeg::hour_tests::probe_timeout_covers_a_blocked_stdout_readfailed once under a full parallel run and passes alone, on main and here. It's a flake that predates this PR.typos: not run, not installed here.Hardware results
Four DGX Sparks cabled as a ring (each link two 200 GbE rails), and a pair for TP2 and Qwen, all on 2026-11-02:
ghcr.io/enntity/atlas-sparkglm:f48791456d03, engine5b00c8fc7(this tip less the merge of main).3bf64a4d04c9, enginespark-sharedc87f279.nvidia/GLM-5.3-Flash-FP4-Localandincoai/GLM-5.3-Flash-DFlash2.Output, against 0.2.0 on the same hosts. Greedy covers 8 prompts, and the logprob check compares 20,705 prompt tokens:
Speed, TP4 ring, Spark. Medians are over boots, each boot taking the median of its repeats.
The four-rank transport was also stress-checked on the ring and the chain with
comm_pair_bench --world 4: 1,500 stress rounds plus gather, reduce-scatter (BF16, FP8, fused), all-to-all and the command ring, with 0 wrong values.🤖 Generated with Claude Code