Skip to content

dsv41: plan, cut and stage the release weights; Engram packs for any world (#3527 2/5) - #3531

Draft
laudney wants to merge 3 commits into
ashhart:mainfrom
laudney:dsv41-rel-2-plan-stage
Draft

laudney wants to merge 3 commits into
ashhart:mainfrom
laudney:dsv41-rel-2-plan-stage

Conversation

@laudney

@laudney laudney commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Step 2 of #3527: plan, cut and stage the release checkpoint's weights at any world, and pack the Engram tables a rank at a time for any world.

main this PR
Release checkpoint in the CUDA plan refused planned at worlds 1, 2 and 4 with no tensor left over; 72.31 GiB a rank at world 4 (69.27 GiB experts)
Rank cuts (output groups, expert width and ids, vocabulary) partition.zig only declared once on the mesh (fabric/mesh): expert groups become a plan change
Weight images EXL3 trellises FP8 codes + UE8M0 block scales, BF16 rows, MXFP4 experts, cut from the stored bytes, never decoded
Engram packs world 2 per rank for any world (tf-dsv41-engram-pack --rank R --world W), read by row from SSD; boot checks each rank's shards

Why

Serving the checkpoint as DeepSeek released it is crucial for benchmarking and for adoption: SGLang, vLLM and TRT-LLM serve these same bytes, so comparisons are like for like with no conversion step, and users run the checkpoint they already download, with no TensorFold-specific requant (#3527).

What this changes

Adds the release plan (plan_release.zig), the mesh-declared cuts (release_shard.zig), stored-byte staging (stage_release.zig), named host tensors <base>.w / .s, the prepared-cache key's format and cuts, Engram packs and manifests for any rank and world, and the Engram shard check used at boot.

Checks on this head

  • Head commit: e3a2196
  • Lean checker on the base and on this head: 337 and 337, 0 new.
  • Tests run: zig build test test-golden test-dsv41-cuda-host test-dsv41-forward test-dsv41-device-host test-kernel-contract compile-dsv41-cuda compile-dsv41-server on the stack head: 5296/5334 passed, 37 skipped, 1 failed (cli_config_test "serve --config: expand ...", which fails identically on main e7e2424 on the same host: inherited). zig fmt --check build.zig zig and git diff --check pass at every stack head. Each commit ran the family host suites when it was made (on main 811c384). The real-pack plan test (TF_DSV41_RELEASE_PACK) plans worlds 1, 2 and 4 with zero leftovers; the world-4 Engram packs verify 200,004 rows with 0 differing a rank.
  • CI: pending on this head.
  • Not run: the full unfiltered zig build kernel-contract (the release filter dsv41_rel ran; see the kernel section); other SMs (the release images are sm_121a only).

Receipt

  • n/a for inference on its own: the release is still refused at boot until step 5; plans, cuts, staging and packs are host-tested.
  • Environment: TensorFold main e7e2424 + this stack, Zig 0.17.0, nvcc 13.5 (V13.5.37; contract records also for 13.0), four GB10 (sm_121a), driver 580.178.04, NCCL 2.30.7; deepseek-ai/DeepSeek-V4.1-Flash-1017 @ 08c8657f02291e11b6f6b63e0e16014f8e748518

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. (Drafts and concurrency: equal, receipt above. Resume: not run, sessions are off at 4 slots.)

  • No precision traded for speed. The release arithmetic is the checkpoint's own (DeepSeek-V4.1-Flash release weights (FP8 + MXFP4) on CUDA at world 4 on four GB10s #3527); EXL3 bits are unchanged.

  • Decode and prompt processing are no slower than main at one stream and the widest admitted. (n/a for the release checkpoint: main refuses it. EXL3 paths are untouched by format gating; not re-measured, no EXL3 pack on the test machines.)

@ashhart

ashhart commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Thanks @laudney. The stored-byte cuts, rank-specific Engram packs and prepared-cache separation fit the existing layout, and planning and staging stay separate from admitting the release checkpoint.

The new inline comment at zig/src/families/deepseek_v41/cuda_weights.zig:150 runs past 120 columns; that one is ours, and we have a one-line commit ready on top that moves it above the conditional. One thing from you: please keep the real-pack and per-rank row receipts at the stated checkpoint revision in the description, beside the synthetic checks.

  • Synthena

The CUDA plan typed every projection as an EXL3 group, so another
weight format would have to thread branches through every reader.
GroupPlan and ExpertsPlan now hold their stored form in a tagged union
with an EXL3 arm, readers go through it, and the expert width splits
on a per-format block (expertShare: 128 for EXL3, 64 for the release
format). EXL3 plans, emitted calls and pinned fingerprints are
unchanged; block.Options gains the checkpoint format for the release
arms to come.
The CUDA reader opens engram-l<L>-r<R>of<W>.bin, but the packer wrote
only rank 0 of 1, so a four-rank release had no tables to read from
SSD. A rank's rows are now its whole hash columns (rankRows, the
reader's headShard), the packer, verifier and manifest work on that
span with shard-relative offsets, the tool takes --rank and --world,
and checkShards validates a rank's shards against its span at boot.
DeepSeek's own checkpoint stores FP8 32x32 blocks, MXFP4 experts and
BF16 matrices that the CUDA plan could not express. The plan gains
FP8, BF16 and MXFP4 forms with the rank's rows, columns and expert
ids, cut on the mesh (release_shard over fabric/mesh), the Engram
tables are checked and left on disk, and staging uploads the stored
bytes unchanged. The real release plans at worlds 1, 2 and 4 with no
tensor left over: 72.31 GiB a rank at world 4. Serving still refuses
the format until its kernels land.
@laudney
laudney force-pushed the dsv41-rel-2-plan-stage branch from e3a2196 to 4c98783 Compare November 17, 2026 07:51
@laudney

laudney commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@ashhart rebased onto main 699094f705 (#3388 landed), head 4c98783d80 (was e3a2196bb7). No content change: git range-diff shows every commit equal. The split-rows plan commit is now dropped from the top of the stack (#3534), which takes the fix from main; checks and the 4 × GB10 receipt are in #3534.

@ashhart

ashhart commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Thanks @laudney for the patch-identical rebase and the receipts at the stated checkpoint revision. Real-pack planning at worlds 1, 2 and 4 with zero leftovers, plus 200,004 verified Engram rows per rank with zero differences, resolves the remaining evidence ask.

The mesh-declared cuts, stored-byte staging, prepared-cache cut identity and rank-specific boot shard checks are consistent. This step applies cleanly to current main and keeps release CUDA admission unchanged.

The long cuda_weights.zig comment remains our cleanup, not something you need to change. I found no remaining issue in this step.

It goes on a landing train with the other ready steps now.

  • Synthena

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.

2 participants