Skip to content

glm: native prefill and FP4-Local for dual DGX Spark (#199 by @Mango-kid, rebased onto main + #198) - #242

Closed
AzeezIsh wants to merge 140 commits into
stack/vision-probefrom
port/199-on-198
Closed

AzeezIsh wants to merge 140 commits into
stack/vision-probefrom
port/199-on-198

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Replaces #223. GitHub marked #223 as merged automatically: during a restack, its base branch was briefly pushed to a commit containing its head (an accident, reverted within minutes). A merged PR can't be reopened. Nothing reached main. The branch is the same (port/199-on-198, credited to @Mango-kid); #223 has the history and receipts.

Summary

Test plan

Tracking: #220. Supersedes #199 only if @Mango-kid prefers; happy to push this to his branch instead.

Generated with Devin

Mango-kid and others added 30 commits October 15, 2026 02:30
Extract the model-independent compiler flag and closure-attestation prerequisite from native GLM integration. No GLM kernel sources or model registration are included.

Provenance: exact patch from d8bef5fc1e540707a6af58c32f78534e92ef8464 by Reiner Schmidt; underlying Atlas build and provenance machinery retains its original contributors.
Extract the generic arena accounting and hybrid dense/MoE reader-sizing fixes. Existing latent and normalization allocations now contribute to the reservation total. Dense models retain their sizing, while hybrid models reserve the activation formats their enabled readers consume.

Provenance: selected exact final hunks from65706c9b; sizing work by Jason McCartney in536dde355f622bb9ffede185d24f832451b4e974 and imported history e0bdf666. Original Atlas buffer implementation retains its contributors.

Validation: total-byte tests failed on the two missing allocations; hybrid test failed on absent scratch. All19 buffer tests pass with CI fail-fast GPU link stubs.
Extract reusable positional record I/O, reserved files, exclusive owner-only creation, filesystem classification and stale-file cleanup. Keep cache/model policy out of this storage prerequisite.

Provenance: exact atlas-tier subtree delta from Jason McCartney,361e54ecaa02071e916cdf3dd3a27c7d68e89e40, preserved at65706c9b. Existing Atlas storage authorship remains intact.

Validation: atlas-tier unit/integration/doc tests pass, including concurrent runs and direct I/O on the local filesystem.
Expose process-owned memory growth using NVML and the allocation ledger, plus anonymous and pinned host memory accounting. Keep GLM admission and KV budgeting policy in the dependent model change.

Provenance: runtime-only hunks from63fc8c473fefe6489fb1cb3d351fe0832c3eb701 by Jason McCartney; only patch context was adapted to omit unrelated PDL wiring. Existing Atlas allocator authorship remains intact.

Validation: spark-runtime CPU unit suite passes324 tests with4 ignored GPU tests, using CI fail-fast GPU library stubs.
Extract the complete generic communication subsystem: per-rail GID discovery, bootstrap agreement and deadlines, peer lifetime monitoring, host command ring, and graph-capturable one-shot collectives. No GLM model code is required by this prerequisite; dependent model code supplies optional kernel handles.

Provenance: exact final spark-comm and atlas-rdma subtrees and common rdma_oneshot.cu from 65706c9b. Jason McCartney source series includes dad333c8, b9a3b2a8, 380ff734, 6bee4a38, 9a89b8db and 2987a78f. Preserve in-source attribution to Jason Cook/local-inference-lab b12x RoCEnante and mmastrac arx for protocol ideas; no code imported from unlicensed sources.

Validation: default-profile CPU tests pass (26 atlas-rdma, 47 spark-comm); real verbs Rust paths type-check under explicit cfg without linking. All six prerequisite crates pass clippy --tests and fmt. NIC, CUDA execution and C verbs compilation remain untested on this host.
Extract the checked native ABI, source build, canonical layout and preload
contract before GLM model wiring so numerical and allocation requirements
can be reviewed independently. No external GLM engine or adapter is used.

Source: cf4bcc705934742f05fb876d345681e32f545495, 0404448f69a5882f30532b1cb413e0123cb76f5c,
59295a453401772e90eada42e4419fd2f4935920, 147cf69b450c1050a4d7ffe17275ff80aa25fe08.
Device code: MoonshotAI/FlashKDA at 1ce47ea3bb22c84eb9cc665028399cf35e8ffb0b;
MIT license, copyright, source hashes and modifications retained in vendor/.
Integration prior art: Jason McCartney / Enntity and Atlas contributors.

Validation: spark-runtime CPU unit/integration/doc tests, clippy and fmt.
This extraction has not been independently GPU-qualified.
Extract Jason McCartney / Enntity compiler changes from 5f5e8e9 and 4030dd6 as an independent prerequisite. Preserve source bytes and attribution; leave server rejection policy and GLM scheduling to later changes.
Keep Poolside function headers buffered until validation and flush pending
content consistently when streaming generation finishes. Add parser and
sanitizer regression coverage independent of model-specific call sites.

Extract exact source from corrected native core 65706c9b. Credit Jason
McCartney / Enntity for 8d260cb8 and upstream 1f98cd0 (import e0bdf666),
and Reiner Schmidt for c7cc091a. Existing licenses and notices are retained.

Validation: 2408 server tests passed, 12 ignored; spark-server clippy --tests;
workspace fmt. Earlier unrelated TUI environment/timing failures are retained
in the local extraction audit. No GLM runtime or scheduler wiring is included.
Route remote video through the video MIME policy, carry media for every
independently scheduled blocking choice, and honor raw-completion context
budgets and explicit request deadlines. Cover request decoding, remote media,
and real blocking dispatch with model-independent fixtures.

Extract source from corrected native core 65706c9b. Credit Jason McCartney /
Enntity for upstream 1f98cd0 (import e0bdf666) and Reiner Schmidt for the
pre-existing multi-choice media fix 5e483b06. Preserve original license notices.

The vision regression uses the original test path with a local generic app
fixture instead of the native core's GLM fixture. Its baseline witness fails
on choice 1 losing media; the production fix passes. The native-core stage
will restore its original consolidated fixture and test registration.

Validation: API and completion regression tests, parser/grammar coverage,
spark-server clippy --tests, and workspace fmt. GPU qualification applies to
the integrated source receipts only, not this independently derived branch.
Load the NVIDIA NVFP4 checkpoint and execute GLM attention, KDA, routed
experts, native sparse prefill and optional DFlash through Atlas. Keep
replicated KV in this first model stage; restore token sharding and NVMe
prefix caching separately. Retain SSM spill agreement and anonymous-file
cleanup, allocation rollback, numerical tests and native source notices.

This is a dependency-aware extraction of corrected core65706c9b, derived
from the Enntity candidate and reconciled with Atlas base7ffd183f. Shared
compiler, transport, memory, storage, KDA and server fixes are prerequisites.
Developer performance harnesses follow separately. The generic blocking
media regression fixture now shares the qualified GLM fixture again.

Credit: Jason McCartney / Enntity for the imported GLM architecture,
communication, context and verification work; Atlas contributors for the
base runtime; NVIDIA and MoonshotAI for credited native device sources.
Full original commits, licenses and source pins remain in docs/porting,
docs/glm-prior-art.md and vendor provenance manifests.

Source:65706c9b045cdc3569ddb0b1857406a683528017.
Context extraction:8e2ea922de58c52b497223935f41867dc58938b8.
Historical GPU measurements do not independently qualify this boundary.

Co-authored-by: Jason McCartney <[email protected]>
The retained BF16 GEMM and FP8 split-K probes share this module. Keep the exact helper from65706c9b with its current consumers; the optional MoE benchmark will reuse it in the following stage. Credit: Jason McCartney / Enntity and Atlas contributors.
Restore initial context features after the replicated-cache native core.
Keep shard geometry, ownership, sparse attention, prefix records, disk I/O,
configuration and their tests together. Shared SSM agreement and anonymous
file safety already remain in the core; consolidate them with the full
context helpers here. Performance-only developer harnesses follow separately.

Source: Jason McCartney / Enntity commits361e54ecaa02071e916cdf3dd3a27c7d68e89e40
and8b07f620d1f1dd496bc1dd6d2914919a658bbcc3, reconciled in corrected
native core65706c9b045cdc3569ddb0b1857406a683528017. Native Atlas prefill
and subsequent allocation/safety fixes remain intact. The exact feature
restore patch is checked against the preserved source tree.

Co-authored-by: Jason McCartney <[email protected]>
Restore the standalone performance examples, paired communication probe,
and CUDA microbenchmarks after their native runtime dependencies. Keep
correctness oracles, bit checks and native qualification tests with the
implementation. The example declarations and optional NCCL feature travel
with the examples they enable.

Source: corrected core65706c9b045cdc3569ddb0b1857406a683528017.
Credit: Jason McCartney / Enntity and the Atlas contributors named in the
preserved source history and prior-art documentation.

Co-authored-by: Jason McCartney <[email protected]>
Restore RC2 canonical verification, copy drafts, sharded disk prefixes and
context optimizations on the explicit initial context prerequisites.

Exact staged source: cb74ee4af8b968b86b9c41dc994776b6043f24bd.
Original imported source credits, license notices and history maps remain
in docs/porting and native device-code provenance. Original human work by
Jason McCartney / Enntity and Atlas contributors is retained. This is a
local dependency stack; historical receipts retain their measured revisions.

Co-authored-by: Jason McCartney <[email protected]>
Carry the previously reconciled native RC4 optimization and context work
without merging external engine adapters.

Exact staged source: 7b2bfe516d609053e9b9cd9b0603b74ed6fffb06.
Original imported source credits, license notices and history maps remain
in docs/porting and native device-code provenance. Original human work by
Jason McCartney / Enntity and Atlas contributors is retained. This is a
local dependency stack; historical receipts retain their measured revisions.

Co-authored-by: Jason McCartney <[email protected]>
Update the locked TLS dependency for RUSTSEC-2026-0346 through RUSTSEC-2026-0349. Keep all other dependency versions unchanged.
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Upper-stack functional check. One commit, the top of #242 ← #245 ← #243 ← #244 ← #246 (9ffd63551), built for both targets. Receipts are in reiner's ~/code/night1027/out/upper-9ffd63551/ and glm-rerun/.

AzeezIsh and others added 9 commits October 29, 2026 08:02
…hape)

The test encoded the old 40M cut's verdicts. With the cut at 0 (s104: the
single-LDS twin wins at all seven measured shapes), every shape keeps the
twin. Other handles still pass through.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…flight rows (503 + Retry-After) (ported from Enntity)

Pair-gated (#220): over-cap -> 400 vision_input_too_large (non-stream, stream, Anthropic); in-flight budget -> 503 vision_capacity_busy + Retry-After 2; malformed headers 400 before decode; C1 == refs 8/8. CI green except the PR benchmark gate (red on main too).
…ixel-bound parity (ported from Enntity)

Pair-gated (#220): vision-fidelity PASS against the reference smart_resize model this PR moves the benchmark to (half-to-even rounding, shortest_edge floor); opt-in pre-decode video reservation (--video-max-pixels) serves the clip with identical text and refuses an over-budget video before decode; C1 == refs. CI green except the PR benchmark gate.
…he deadline bounds a blocked stdout read (Enntity/atlas 8fe99bf shape)
strix-hip: F16 m128 twin on every shape (drop the 40M N·K cut) — Flash-Next prefill -3%
…837e76/8fe99bfe)

Pair-gated (#220): with --video-max-pixels the 10-min and 60-min clips are served within the encoder window (16494/16442 prompt tokens) where #237 alone refuses them; the 4 s clip text is identical. Opt-in. CI green except the PR benchmark gate.
@AzeezIsh AzeezIsh closed this in #309 Nov 1, 2026
AzeezIsh pushed a commit that referenced this pull request Nov 1, 2026
AzeezIsh added a commit that referenced this pull request Nov 1, 2026
…series; data-angel)

Qwen-side KL + bench gate on reiner + spark2 (#220, receipts on the PR) at fa528fc: KL 0 vs main over 34,245 x2 + 36,765 positions incl. vision, BFCL 87.54/86.85 = main, greedy 8/8, tools 21/21, bench neutral. 354da21 = fa528fc + main (only the #310 conflict area changed). GLM-side results are data-angel's (see the PR). CI green except the PR benchmark gate.
@Mango-kid

Copy link
Copy Markdown
Contributor

@AzeezIsh I recovered the original receipts and launch settings. First, a correction to the comparison: 97.19 C1 and 168.85 C4 came from different checkpoints and context profiles. They are not a matched FP4-Local C1/C4 pair.

These are the random-token results with the four prefill switches on, all measured on runtime 5d652f8e0835231ead3bcac91d66e22632c08cbe:

Checkpoint Pool / session cap C1 input → output C1 decode C4 input → output per stream C4 aggregate decode
nvidia/GLM-5.3-Flash-NVFP4 32,768 / 32,768 10,000 → 512 106.25 tok/s 1,000 → 512 168.85 tok/s
nvidia/GLM-5.3-Flash-FP4-Local @ 76348ddb 32,768 / 32,768 10,000 → 512 94.75 tok/s 1,000 → 512 163.68 tok/s
Same FP4-Local checkpoint, separate 64K smoke 131,072 / 98,304 65,536 → 512 97.19 tok/s Not run —

The paired switches-off FP4-Local results were 95.14 C1 and 164.38 C4. Each random-token cell is one run; the two-repeat medians in the report apply to the synthetic chat workloads, not these cells. Original report, FP4-Local receipt, 64K receipt.

Hardware and libraries: two ASUS GX10 / GB10 systems, 128 GB unified memory per host, complete checkpoint copies on each node's local storage, TP2/EP2 over RoCE. Both ranks used image sha256:2d7ee3e9ca756014c57e84eb777b78a66278505fe9d378d1abb7d90da5744cd2. I checked the retained image's package database: libcublas-13-0=13.0.0.19-1, libnccl2=2.32.3-1+cuda13.4. That cuBLAS differs from the 13.0.2.14 in your A/B; I haven't isolated its effect.

Serving profile: the three environment files in the pinned recipe, in order: qualification.env, rc2-candidate.env, rc4-candidate.env. Then ATLAS_KV_MAX_BLOCKS=2048 for the 32K runs, with ATLAS_GLM_KDA_SIDE_PROJ_LT, ATLAS_GLM_KDA_CONV_PLANES, ATLAS_GLM_HC_PREFILL_FUSE2 and ATLAS_GLM_SP_GATHER_OVERLAP all set to 1. General PDL stayed off. Relevant CLI settings:

--world-size=2 --tp-size=2 --ep-size=2
--max-prefill-tokens=4096 --max-seq-len=32768
--max-batch-size=4 --max-num-seqs=4 --block-size=16
--kv-cache-dtype=fp8_g128 --ssm-h-dtype=f32 --ssm-rollback-mode=records
--gpu-memory-utilization=0.88 --oom-guard-mb=12288
--ssm-cache-slots=0 --ssm-checkpoint-interval=0 --enable-prefix-caching=false
--swap-space-gb=0 --no-auto-swap --lm-head-dtype=bf16
--dflash --dflash-gamma=8 --dflash-window-size=2048 --mtp-gate=force

The draft was incoai/GLM-5.3-Flash-DFlash2. The 64K test changed only the pool to 8192 blocks and session cap to 98,304; it retained four server slots but issued one request.

Requests and timing: streaming /v1/completions, uniformly sampled valid base-token IDs excluding all added tokens. Python prompt RNG seed 20261020 + stream_index, API seed=42, temperature=0, max_tokens=512, ignore_eos=true, and repetition_detection={"min_pattern_size":1,"max_pattern_size":32,"min_count":1024}. C4 requests start at a barrier. C1 decode is (output_tokens - 1)/(last_content_time - first_content_time). C4 uses sum(output_tokens - 1) over the shared earliest-first-token to latest-last-token interval; it is not the sum of per-stream speeds or end-to-end throughput.

Your same-pair interleaved A/B is the stronger evidence about the rebase itself. These receipts clarify the historical workloads; they do not establish a new regression or identify the cause of the remaining absolute-speed difference.

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.

2 participants