Skip to content

qwen4_exp: serve FP4-Local at TP=EP=2 with the n-gram table resident, native MXFP8 sharding, BF16 routing - #198

Merged
AzeezIsh merged 67 commits into
mainfrom
feat/fp4-local-tp2
Oct 29, 2026
Merged

AzeezIsh merged 67 commits into
mainfrom
feat/fp4-local-tp2

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Serves nvidia/Qwen3.8-Flash-Next-FP4-Local on two GB10s (TP=EP=2) on top of #195, keeping the
checkpoint's own number formats, and holds the 28.8 GB NVFP4 PLE n-gram table in device memory on
each rank, so nothing is read from NVMe while serving.

  • MXFP8 tensor parallelism without requant. Attention q/k/v/o and GDN in_proj_qkv/z/out_proj are
    sharded by slicing the shipped E4M3 bytes and E8M0 scales: q/k/v and the GDN segments by rows,
    o/out_proj by columns on whole 32-input scale groups.
  • Shared expert counted once under EP. The MXFP8 shared expert stays replicated and is added
    once after the EP all-reduce. This also fixes two batched decode paths that blended it before the
    reduce. One of them is the generic forward_batched EP tail, so the fix reaches every EP model with
    a replicated shared expert (it now matches the contract the single-row forward already had).
  • Resident PLE table (ATLAS_PLE_RESIDENT=1, opt-in, both ranks, startup-parity checked):
    • loaded through pinned staging, then fadvise(DONTNEED);
    • boot self-check of sampled rows against the host NVFP4 oracle;
    • decoded on the GPU by the existing kernel, with slot = row id.
  • BF16 router (dtype fix). The checkpoint ships mlp.gate in BF16, but Atlas requantized it to
    NVFP4 at load. FP4-Local now routes on the shipped weight, with row-invariant decode/verify routing.
    ATLAS_QWEN4EXP_ROUTER_NVFP4=1 restores the old path (rollback).
  • TC MoE units for FP4-Local. The TC v3 plan can now run without a fused shared expert, and the
    MXFP8 shared expert runs beside it.
  • MXFP8 multi-row projections. 2..=32 rows are served in one weight pass (bucketed GEMV, plus a
    register-tiled 17..=32 tier), each row bit-identical to the 1-row kernel.
  • Decode/verify MXFP8 rows exact at any batch (mxfp8_proj_exact_rows). A batched verify passes
    every sequence's rows in one call, so at 8 sequences x 8 rows (64 rows) it used to take the prefill
    dequant + GEMM path. Decode and verify now always use <=32-row GEMV chunks; prefill keeps
    dequant + GEMM. Before this change, C8 speculative-equals-serial matched on text but was not
    guaranteed bit-identical.

Dtype contract

See docs/checkpoints/qwen3.8-flash-next-fp4-local-tp2.md §2: every output-path tensor is native or an
exact widening (GDN in_proj_a/b and index_qk_proj, ~28 MB). Draft-only paths may approximate; they can
only change acceptance. §3a lists each exactness/determinism contract and the test that proves it.

Verification (pair: reiner rank 0 + spark2 rank 1)

  • Exactness (through 37565c2): serial == speculative 8/8 at C1 and C8 after every change; resident ==
    NVMe-cached, bit for bit; cached-prefix C4 8/8; cross-contamination 8/8; tool probe 21/21; needles
    32K / 128K / 240K. Re-run on the final head: see "Final-head gates".
  • Kernel / launch tests (all pass on GB10):
    • MXFP8 shard byte-exactness incl. an off-by-one-scale negative control, and row-parallel
      reassembly dequant(shard0) || dequant(shard1) == dequant(full) bit for bit on hostile bytes;
    • batchm / rows32 rows bit-identical to the 1-row kernel at M = 1..=32; exact rows at M = 64 / 65;
    • launch recording: m = 0 refused with no launch; exact rows never dequantize; the shared expert's
      exact chain runs per <=32-row chunk with per-chunk offsets; both EP tails consume the shared expert
      exactly once;
    • BF16 router: dense_rows rows equal single-row dense_gemv_bf16 at M = 1..=32, 33, 64; prefill
      GEMM vs decode GEMV max logit difference 2^-6, same top-10 outside near ties; serial and verify
      top-k kernels agree on every exact tie (lower expert id wins), the prefill top-k on boundary ties.
  • BFCL ST-995 (golden draw): 87.64 / 87.71 on the first resident build (run-1792365985129633322);
    87.44 / 87.45 on the BF16-router + TC-MoE build (run-1792406664787105023).

Architecture review (Qwen3.8-Max, requested)

First pass: approve MXFP8 slicing, TC MoE with a separate shared chain, multi-row GEMV, exact prefill
default and merge mechanics; resident PLE approved as opt-in only; changes required on the shared
expert one-copy proof, router determinism proof, and the slow tensor-core MXFP8 tier. Follow-up on the
remediation hunks: every item cleared (resident table as opt-in; batched prefill top-k diverging only
on a fully degenerate 512-way tie accepted as prefill-only). Follow-ups it suggested, not in this PR:
startup refusal threshold and metrics for the resident table, debug assertions on shared-expert
dimensions.

Final-head gates (864c81f; the commits after it are docs only)

On the pair, rc16 profile, resident table (receipts and fingerprints on reiner under
~/code/fp4l-tp2-runs/final-864c81fb3/):

  • Exactness: speculative == serial greedy 8/8 at C1 and C8, identical to the earlier references;
    behind a shared ~4.4K-token prefix (4,448 / 4,480 cached tokens) the cached speculative C1 and C4
    outputs equal serial uncached output 8/8; cross-contamination 8/8; tool probe 21/21. Router rollback
    arm and NVFP4-pack arm: speculative == serial 8/8.
  • Long context (4x262k): needles at 9K / 35K / 66K / 128K / 240K tokens all found; 77K needle + warm
    follow-up and 4 concurrent 100K prompts all answered.
  • BFCL ST-995: 87.04 / 85.75 (run-1792557711972352834), above the MLPerf floors 83.64 / 85.32. vs the
    previous build (87.44 / 87.45): 1-2 items lower in small subsets (live_parallel 2 of 16; irrelevance,
    live_irrelevance, live_simple 1 each), non_live higher (85.95 vs 84.91). Single run.
  • MLPerf edge agentic perf leg (2.5 h dataset): 1,007 / 1,007 turns, 0 failed, 4,027 s; TTFT p50 / p90
    / p99 364 / 609 / 1,179 ms; TPOT 24.2 / 26.4 / 28.2 ms; inline action score 0.587 (harness reference:
    Qwen3.6-27B Q4_K_M on Jetson Thor, 2 h 37 m, 0.634 - a different model, not a gate).

Performance (two GB10s, rc16 profile, resident PLE)

V5 binary (37565c2) This head (864c81f)
decode-floor (1500 tok), 3 runs (accept) 84.0 / 83.9 / 83.9 (4.27) 83.7 / 83.6 / 83.6 (4.27)
short chat decode, first token 63.5 tok/s, 0.166 s 63.1 tok/s, 0.166 s
~18K agent turn decode, first token 43.8 tok/s, 5.83 s 43.3 tok/s, 5.82 s
total at 1 / 2 / 4 / 5 / 8 users (512 / 2048-token prompts) 65 / 109 / 131 / 161 / 207 65 / 108 / 130 / 161 / 206
Same-session A/B on fresh boots: within 1% at the same acceptance.

sparkDash (the harness TensorFold / SparkQwen publish with; 400 forced tokens, aggregate tok/s at
1 / 2 / 4 / 8 requests, mean of 3 runs; other engines are published numbers from other GB10 pairs, so
observations, not A/Bs):

prose code json
Atlas TP2, FP4-Local (this PR) 71.2 / 107.5 / 148.4 / 266.4 92.3 / 137.1 / 208.6 / 275.2 78.0 / 130.6 / 187.7 / 314.4
Atlas TP2, NVFP4 pack (same binary) 72.0 / 116.9 / 160.7 / 283.9 91.7 / 142.2 / 218.9 / 291.0 83.7 / 143.8 / 202.2 / 350.9
TensorFold dual v1.0, NVFP4 67.4 / 98.9 / 152.2 / 231.2 - -
vLLM v0.30 TP2+EP MTP3, NVFP4 61.0 / 95.9 / 148.2 / 238-241 72.2 / 120.9 / 190.8 / 291-307 66.4 / 115.7 / 201.2 / 331-339
SparkQwen RC16 (Atlas fork), NVFP4 72.7 / 112.5 / 170.5 / 260.3 93.8 / 147.9 / 214.3 / 296.9 84.5 / 141.4 / 217.7 / 333.0

On the NVFP4 checkpoint Atlas leads TensorFold dual at every published point and vLLM v0.30 except
code at C8 (inside vLLM's spread) and json at C4 (equal); it trails SparkQwen RC16 by 6-7% at C4 on
prose/json and leads it at C8 except code. SGLang publishes no sparkDash numbers for this model (its
TP2 NVFP4 results on other harnesses: 47.5 / 87.6 / 158.2 tok/s at 1 / 4 / 8 requests). Without
speculation, FP4-Local reads 36-37 tok/s at C1. Full table, structured prompts and caveats: doc §4a.

CI (head 0164cce, on main)

Green: fmt, clippy, cargo test (the #195-era dflash_pools_size_h_intermediates_uniformly failure is gone on
main), coverage, file-size cap, license, typos. Red, not from this PR: cargo deny (RUSTSEC-2026-0381 / 0382 /
0386, dependency advisories; this PR changes no dependencies), kernel shadow structure and the PR benchmark
gate. All three are red on every open PR against main today (#206, #207, #208, #210).

Update onto main (2026-10-27)

#195 was squash-merged (6b09b40), so this branch was merged forward instead of rebased (no force-push):
53d51e6 takes #195's last two commits (BENCH.toml only), d62b05b records the squash commit as merged
(-s ours; its tree is byte-identical to #195's final head), and 0164cce merges main 504063a (#200-#203).
No conflicts. The diff against main is this PR's own 61 files. Main's #200-#203 were gated on main, so the
gates above were not re-run; CI covers the merge.

Recipe

Tried, not in this PR

  • MXFP8 W8A8 prefill for the projections (ported from Enntity's fidelity release): exact where required (speculative == serial, cached == uncached, row invariance 0 diffs), but cold TTFT only 4-7% lower on our pair. It stays on wip/fp4-local-tp2-w8a8; doc §5a has the prefill profile showing where the rest of the gap is (mHC, MoE, QSA prefill).

Removed from this PR

The opt-in tensor-core MXFP8 tier (ATLAS_QWEN4EXP_MXFP8_TC): exact within its own family but 32%
slower at decode. Kept on branch wip/mxfp8-tc.

Scope

No GLM-5.3-Flash files. Shared MoE/ops files are touched only behind FP4-Local load-time flags or
checkpoint formats, except the generic EP shared-expert fix above.

Not in this PR

Head-sharded PLE table (frees 14.4 GB/rank), shared-expert TP split, mHC split, W8A8 prefill.

Base: main (#195 merged 2026-10-21).

Open follow-ups (tracked in the PR comments)

Generated with Devin

AzeezIsh and others added 30 commits October 18, 2026 15:34
CSF-compressed NVFP4 block scales (lossless, per the layout vLLM's
csf_scales.py specifies), exact MXFP8 -> BF16 expansion, and NVFP4 rows
-> BF16 for row-gathered tables. Pure arithmetic, no env lookups in the
hot loops.

Checked on nvidia/Qwen3.8-Flash-Next-FP4-Local with examples/fp4local_decode:
CSF bytes identical to a numpy port of the vLLM reference decoder on four
expert tensors (81-762 exceptions each); dequantized experts cos 0.994,
MXFP8 projections cos 0.9996 and PLE rows cos 0.995 against the NVFP4 pack.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L4aUGgtiZX94pLr63HXQzn
…ssed tensors resident

- U32 maps to a raw 4-byte container (CSF exception streams); the fast
  loader's header now defers to the shared dtype table instead of a copy.
- The fast loader defers CSF streams and the weight/scale pair of every
  module in host_decode_modules, so the build expands them from disk.
- is_ngram_table also takes the per-shard NVFP4 block scales of the PLE
  table, which are row data like the weight.
- An index that names shards under a directory (tensors/model-*.safetensors)
  routed zero tensors to every shard; match shard paths, not file names.
- DeferredTensor::read_bytes / WeightStore::undefer for build-time consumers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L4aUGgtiZX94pLr63HXQzn
The pack differs from the NVFP4 one only in how it stores tensors:
- weight_map::modelopt_local decodes the 73,728 CSF expert scales into
  plain E4M3, expands 438 MXFP8 projections and 56 vision NVFP4
  projections to BF16, and rounds the 100 F32 norms (hc_norm, PLE norms)
  to the BF16 the kernels read. Left F32, those norms produced NaN logits:
  every request answered with one empty token.
- The PLE table is NVFP4: a second row cache serves the block-scale rows
  and the gather decodes both on the host, the trellis path's contract.

Verified on a GB10 (sparky): boots in 65 s, coherent chat, correct tool
call, needle passes at 4.4k prompt tokens, 16.9 tok/s decode without MTP
(the NVFP4 pack measures 16.14 without it). MTP experts are per-expert
NVFP4 here and are not wired yet, so --speculative is not supported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L4aUGgtiZX94pLr63HXQzn
nvidia/Qwen3.8-Flash-Next-FP4-Local quantizes mtp.layers.0.mlp.experts as
W4A16 NVFP4 with plain block scales, the trunk experts' own format, so a
PerExpertNvfp4 layout loads them through quantized_any as shipped. The
load log now names the detected layout instead of always claiming a
stacked BF16 requantization. mtp.rs's tests move to mtp_tests.rs.

Verified on a GB10: --speculative --num-drafts 1 boots, K2 acceptance
73-75%, decode 18.9-19.8 tok/s (16.9 without), outputs coherent and the
tool call unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L4aUGgtiZX94pLr63HXQzn
…FP8 bytes

nvidia/Qwen3.8-Flash-Next-FP4-Local ships the GDN in_proj_qkv, in_proj_z and
out_proj (36 layers, 2.08 GB) as MXFP8: E4M3 plus one E8M0 scale per 32
inputs, QAD-trained that way. They were expanded to 4.15 GB of BF16 at load
and read by dense_gemv_bf16 — 44% of a decode token's GPU time.

- kernels: mxfp8_proj.cu — mxfp8_proj_gemv (1 row), mxfp8_proj_batchm (2..8
  rows, one weight pass, every row bit-identical to the 1-row kernel) and
  mxfp8_proj_dequant (exact BF16 expansion for prefill).
- ops::mxfp8_proj picks by row count; prefill expands one projection at a
  time into a single 84 MB scratch shared by all GDN layers, then bf16_gemm.
- materialize uploads native_mxfp8() modules byte for byte;
  ATLAS_FP4LOCAL_EXPAND_MXFP8=1 restores the BF16 expansion for A/B.
- qwen4_exp::gdn_mx8 builds the layer on those bytes; Qwen3SsmLayer::mx8 is
  the only copy of both projections and is checked first at every dispatch
  site (serial decode, batched verify, multi-seq decode, prefill).

Measured on GB10 (sparky):
- microtest: dequant byte-identical to modelopt_codec::mxfp8_to_bf16 over
  42M values; GEMV vs f64 rel_l2 1.7e-3; batchm M=1..8 0 mismatches;
  230 GB/s, 1.89x dense_gemv_bf16 on [16384, 2560]; M=8 costs 1.09x M=1.
- serve: pre-KV 97.6 -> 95.0 GB; decode with --speculative --num-drafts 1
  18.9-19.8 -> 24.2-28.6 tok/s; coherence prompts and tool call correct.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L4aUGgtiZX94pLr63HXQzn
FP4-Local ships the 12 full-attention layers' q (with its interleaved
gate rows), k, v and o as MXFP8. The generic builder expanded them to BF16
and then requantized BF16 -> NVFP4 for decode: a second, lossy quantization
of weights NVIDIA's QAD trained in MXFP8, plus a BF16 copy for prefill.

- QuantWeight::Mxfp8(Mxfp8Proj); Mxfp8Proj moves to weight_map so the
  variant carries its geometry. quant_gemv/quant_gemm refuse it by name.
- Qwen3AttentionLayer::set_mx8_projections installs q/k/v/o as the only
  copies (BF16 slots NULL, no NVFP4/FP8 twin) with the kernels and the
  shared prefill scratch; try_mx8 is checked first at every projection
  site: serial decode Q (gated + ungated) / K,V / O, the multi-sequence and
  verify path (qkv_mx8.rs: one weight pass per 8 rows, then the per-row
  scatter, as qkv_fp8.rs does) and its O, and the three prefill
  projections through try_unpacked_prefill (MXFP8, then packed Q2_0).
- ops::mxfp8_proj: up to 32 rows run as 8-row GEMV chunks (bit-identical
  to single-token decode per row), more rows expand + bf16_gemm.
- qwen4_exp::attn_mx8 builds the layer; mx8_common holds the checked
  weight/scale lookup and one scratch sized for the largest projection of
  either layer kind. native_mxfp8() now covers self_attn.{q,k,v,o}_proj.

Measured on GB10 (sparky), --speculative --num-drafts 1: pre-KV 95.0 ->
93.4 GB; decode 24.5-26.3 tok/s (the MXFP8 q/k/v/o read 0.6 GB a token vs
0.3 GB for the lossy NVFP4 requant); coherence prompts, tool call, and the
~4.4k-token passcode recall all correct.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L4aUGgtiZX94pLr63HXQzn
The FP4-Local pack ships the 100 hyper-connection hc_norm and PLE
norm_conv/norm_key/norm_query weights as F32 (the only release that does).
modelopt_local rounded them to BF16 because every consumer kernel was
declared __nv_bfloat16* — measured lossy on all 100 tensors.

The kernels already compute (1 + w) in FP32, so change the norm-weight
arguments to const float* (hyper_connection.cu: hc_pre, hc_head,
hc_pre_stage, hc_pre_stage_bf16, hc_post_stage_bf16, hc_pre_stage_vec,
hc_post_stage_vec; ple.cu: ple_gate; strix-hip mirror), load every site's
norm through dense_keep_f32 — F32 native for FP4-Local, exact (bits << 16)
widening for the NVFP4 pack — and delete the BF16 rounding. NVFP4 stays
bit-identical; FP4-Local keeps its full precision.
The FP4-Local checkpoint ships every main-layer mlp.shared_expert
{gate,up,down}_proj as MXFP8 (E4M3 + E8M0 scales). The loader used to
expand them to BF16 and requantize them to NVFP4 for the fused routed
kernels -- an 8-bit -> 4-bit loss on the one expert every token goes
through.

Generalize the Laguna BF16 seam into a separate shared-expert enum
(Bf16 | Mxfp8): fused routed kernels run with a NULL shared expert and
the native chain (mxfp8_proj + silu_mul) fills shared_out afterward.
Gate and up are row-concatenated into one [2*inter, h] projection so
the <=32-row bands take one pass plus fused_silu_mul; larger prefills
use the unfused trio. Covers decode, MTP K=2 verify, C>1 batched decode
(forward_rows, qwen4exp_fast, atomic_c4) and prefill. The MTP block's
BF16 shared expert is installed through the BF16 arm.

Tracked weight memory: +0.15 GB vs the NVFP4 shared copy.
gate_proj and up_proj are now views into the halves of the [2*inter, h]
gate|up weight (and scale) buffer the fused small-row arm already needed;
the store originals are reclaimed at load. Tracked weight memory drops
~0.16 GB. Also drop a dead local in helpers_shared.
FP4-Local's PLE table ships as packed E2M1 rows + E4M3 block scales on
NVMe. Every gather used to copy both to the host, decode to BF16 there,
upload, and synchronize the stream. Now the block-scale rows fault into
the same cache as the weight rows (new segmented scale source on
NgramRowCache) and a new batched_embed_nvfp4 kernel decodes them in
place -- bit-identical to the host oracle, no per-gather synchronize,
no copy_slot.

Bookkeeping scales to tens of millions of slots: u32 row ids, O(pins)
end_batch, and ATLAS_PLE_CACHE_GB sizes the arena (slot count stays an
env override, the span-derived floor still applies). Adds a 30 s
residency/hit-rate/fault-time line plus a shutdown summary.
FP4-Local ships the ViT's attn.qkv/attn.proj as MXFP8 and the MLP/merger
linears as NVFP4; materialize used to host-expand all of them to BF16.
They now upload as shipped (NVFP4 tensors stay deferred, uploaded
verbatim by the vision loader; visual MXFP8 joins the native list) and
VitWeight expands them into an encoder-owned BF16 scratch per GEMM --
mxfp8_proj_dequant and dequant_nvfp4_to_bf16, both bit-identical to the
host codec. Every other checkpoint keeps raw BF16 weights on the same
call path. Tracked weight memory drops ~0.5 GB.
…e open speed gap

Adds docs/checkpoints/qwen3.8-flash-next-fp4-local.md: what the checkpoint
ships, what Atlas now runs natively, how exactness was proven, why the n-gram
table stays disk-backed, the serve configuration that was benchmarked, the
results with their run ids, a same-box comparison against NVIDIA's vLLM recipe,
and the ranked list of what is left. The four scripts under
bench/qwen4_exp/fp4local/ are the non-in-tree harnesses those results used.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
CI's fmt job runs the latest stable rustfmt (1.10), which lays out several
of this branch's new expressions differently from the pinned 1.93 toolchain
they were formatted with. Formatting only.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…hed path

Under ATLAS_QWEN4EXP_DECODE_FUSE `ep_blend_zero_row` returns NULL (the blend
kernel reads it as zeros), so testing the pointer sent EP rows back to their
own shared output and the shared expert entered the reduce on both ranks.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Replace the qwen4_exp-shaped name lists with ModeloptQuantPlan: the
checkpoint's quantized_layers map (config.json or hf_quant_config.json)
yields a per-module ModuleFormat { algo, group_size, scale_encoding },
accepting both group_size and weight_block_size spellings and the
FP8_PB_WO tile form. Which modules host-expand and which stay native now
come from the plan's algo intersected with a per-model NativeConsumers
registry; CSF streams decode only for weight_scale_encoding == "csf",
any other encoding fails the load naming it. A model with no registered
consumers gets the exact-but-unoptimized BF16 expansion with no names
needed. FP4-Local loads byte-identical to the name-driven path.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…FP4-Local record

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Main moved since this PR's last merge-forward (504063ad4 → 87df79b2f: integration trains #212/#217, #187/#188/#197, the #180 vision 400, and FP4-Local decode #219/#228), and GitHub now reports this PR as conflicting. A trial merge conflicts in only 2 files: moe/mod.rs (#198's init_ctor split vs main's init_batched) and moe/init.rs (main edited new_with_hash, which #198 moved into init_ctor.rs). I'm preparing a merge-forward commit (no force-push). A targeted gate on the merged head comes next: speculative == serial vs refs, canonical NLL, ssm gate, decode-floor.

Conflicts resolved:
- moe/mod.rs: keep both mod init_ctor; and mod init_batched;
- moe/init.rs: keep #198's split layout (init_ctor.rs); all main changes
  applied to the moved new_with_hash in init_ctor.rs (f16 twins tuple,
  BatchedKernels/TRowsKernels resolution, s64 w4a16_gemm twin, batched.*
  and t_rows.* fields); set_row_invariant_bf16_router kept
- forward_rows_t.rs: run_separate_shared_expert gained exact=true like
  forward_rows.rs / forward_atomic_c4.rs
@AzeezIsh

AzeezIsh commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

@maplepaladin73, following up on your Oct 22 C4 numbers (this PR about 30% behind your production Enntity build at 4 concurrent tool requests): SparkQwen's MTP drafter series and queued first chunks are now ported and stacked on top of this PR as default-off opt-ins (#224, #226). On our pair, the MLPerf agentic leg at 4 concurrent trajectories went from 49.35 to 58.90 tok/s (+19%) with both enabled vs this PR's head. TTFT p99 dropped 16% and TPOT 17%; median TTFT rose 12%. That's a different harness from your OpenClaw-style test and a single run per arm, so it's an observation, not a closed gap. A run of your test on #226's head would tell us how much of the 30% remains.

On the conflicts you flagged: this PR was merge-forwarded onto main on 10-27. Main has moved again (#219/#228), and a second merge-forward (2 conflicted files) is being gated now. Separately, the code pointer from maplepaladin73 (drafted by Emily) on #218 matches the cache-exactness fix that's now in this PR.

@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Merge-forward 2 pushed: 2906e74db = merge of main 87df79b2f (2ae23d7de) + 2906e74db, which keeps main's router-GEMM comment in the moved new_with_hash. No force-push. GitHub reports it mergeable again.

  • Conflicts: 2 files. moe/mod.rs keeps both init_ctor and init_batched. moe/init.rs: all of main's new_with_hash edits are applied to the copy this PR moved into init_ctor.rs; I diffed it line by line against main's version and nothing is dropped. Main's run_separate_shared_expert gained an exact argument, now passed from the rows-T path.
  • Gate on the merged binary (c5f7c619, two GB10s, rc16 resident), vs this PR before the merge:
    • serial, speculative C1/C8 and cache-hit C4 equal the final serial references 8/8; prefix C4 8/8;
    • tools 21/21; cross-contamination passes; ssm-state-poisoning-gate 12/12;
    • at 1K chunks, the cached replay equals the uncached reference;
    • canonical NLL 1.0843027707, bit-identical (27,033/27,033);
    • decode-floor 83.2 / 83.4 / 83.3 tok/s at acceptance 4.27. Before the merge: 83.7–84.4. That's within tonight's session-to-session spread, an observation and not a measured difference.
  • Host tests: spark-model lib passes. spark-server: 2729 pass, 3 fail (tui::bench_variants ×2, cli::bench_selfstart ×1). The same 3 fail identically on plain main 87df79b2f, and the merge doesn't touch those files, so they predate this PR.

AzeezIsh added a commit that referenced this pull request Oct 28, 2026
#198's host-decode set scooped every module with no registered native
consumer into mxfp8_to_bf16. On glm5_next (no registered consumers) the
FP8_PB_WO shared experts — E4M3 weights with 128x128 FP32 block scales —
hit that codec and failed its per-32 E8M0 shape check at build:
GLM-5.3-Flash FP4-Local would not load on port/199-on-198.

Restrict host_decode_modules to MXFP8 plus NVFP4-family modules without a
native consumer, and have expand_module require the declared MXFP8 algo
before calling mxfp8_to_bf16. FP8_PB_WO tensors stay resident for the
model's own loader (#199's shared_expert_requantizes_from_fp8_blocks
path). Qwen FP4-Local unchanged (byte-identical).
@AzeezIsh
AzeezIsh merged commit 8bfe850 into main Oct 29, 2026
25 of 26 checks passed
@maplepaladin73

Copy link
Copy Markdown
Contributor

@AzeezIsh our C4 rerun, as you asked, now on main 26e0b20bc (#198 + #224 + #226 merged). Two GB10s, TP=EP=2, FP4-Local, our production profile (8×262K, util 0.80), OpenClaw-style concurrency test (long prompts, total tok/s), one boot per arm:

arm T1 tools T2 tools T4 tools P4 no tools tool check
main, switches off 41.2 39.8 63.4 67.0 24/24, 0 bad, 0 unwanted
main + MTP_ABSORB=1 MTP_PREFILL=16384 MTP_DEEP_WINDOW=16 PREFILL_QUEUE_FIRST_CHUNK=1 42.0 69.0 69.7 67.8 24/24, 0 bad, 0 unwanted
Enntity production build (4618128c570b), same session, after restore 49.9 74.2 107.5 102.4 24/24
  • The switches clearly help at C2 (+73%) but only about +10% at C4. Main is still ~35% behind Enntity at 4 concurrent tool requests on our test.
  • 0 ERROR/panic lines on either arm.
  • Single run per arm, so treat it as an observation. Our guess is that the gap at C4 lies outside the drafter/queue ports (batched decode or verify), since the levers barely move C4 while C2 jumps. I'm happy to run any extra arm you want on the next window.

AzeezIsh added a commit that referenced this pull request Oct 30, 2026
…nd EP-split MXFP8 shared expert on FP4-Local (opt-in)

Pair-gated on main + #265 + #266 (wave1a, #220): switches unset -> C1/C8 == #198 refs 8/8, tools 21/21; all four switches on -> decode-floor 89.3 vs 84.1 tok/s (n=3), cold TTFT -13..-15%, tools 21/21. CI green except the PR benchmark gate.
AzeezIsh added a commit that referenced this pull request Oct 30, 2026
…t scales (ATLAS_QWEN4EXP_PREFILL_W4A4, opt-in)

Pair-gated on main + #265 + #266 (wave1a, #220): switches unset -> C1/C8 == #198 refs 8/8, tools 21/21; all four switches on -> decode-floor 89.3 vs 84.1 tok/s (n=3), cold TTFT -13..-15%, tools 21/21. CI green except the PR benchmark gate.
AzeezIsh added a commit that referenced this pull request Oct 30, 2026
…he chained flag WRITE inline

Pair-gated (#220): main + #270 alone gives C1 8/8 == #198 refs; decode-floor with the default-on proxy pin 84.03-84.18 vs ATLAS_RDMA_PROXY_PIN=0 84.20-84.34 tok/s on this pair (no measurable decode change; observed, one boot each). CI green except the PR benchmark gate.
AzeezIsh added a commit that referenced this pull request Oct 30, 2026
…d row file (ATLAS_PLE_PACKED_DIR)

Pair-gated (#220): main + #269 alone with ATLAS_PLE_PACKED_DIR unset gives C1 8/8 == #198 refs (split read unchanged). The packed-dir path itself was not exercised on this pair. CI green except the PR benchmark gate.
vcruz305 pushed a commit to vcruz305/atlas that referenced this pull request Nov 11, 2026
…aths

Config: QuantLayerSpec keeps our Option<String> + weight_block_size
(their String folded in; test sites adapted). vision_weight keeps the
native VitWeight::Nvfp4 arm for qwen FP4-Local; GLM gets
vision_dense_auto (expands to BF16). MoeLayer: our
set_row_invariant_bf16_router + their new_with_hash already lived in
init_ctor (identical bar route_fuse/separate_shared_expert init).
fast_weights: their by_shard filter supersedes our tensors_routed_to
(same lookup keyed by model_dir.join); CSF U16/U32 arms + our generic
table coexist; helpers_shared and helpers_shared_only both kept.
docs/ports/199-on-198.md has the per-file table.
vcruz305 pushed a commit to vcruz305/atlas that referenced this pull request Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Conflicts with main — its green checks are NOT real (GitHub skips merge-commit workflows)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants