Skip to content

core: read rank-local NVFP4 checkpoint slices - #906

Merged
ashhart merged 4 commits into
ashhart:mainfrom
akol1:codex/nvfp4-rank-reader
Oct 18, 2026
Merged

ashhart merged 4 commits into
ashhart:mainfrom
akol1:codex/nvfp4-rank-reader

Conversation

@akol1

@akol1 akol1 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

ModelOpt NVFP4 readers need to preserve stored codes and scale bytes when a rank owns only a projection rectangle. Add an owned rank-local reader for plain E4M3 or losslessly CSF-compressed scales, with complete source validation before allocation. Input cuts preserve groups of 16; optional calibration remains metadata, and the FP32 tensor scale is unchanged.

Builds on #904. The codec and reader remain separately reviewable. The reader allocates only selected codes/scales, refuses ambiguous or incomplete scale representations, and frees intermediate storage on allocation failure. API and ownership documentation is beside the implementation.

Validation at head c224f30513d125bde8c7ae8d045a47f5de28b159, reviewed main base 46a08c18608153bfc566703a88acc883bc6140f4, Zig 0.17.0:

  • Independent FP64 equality for plain/compressed row and input partitions, malformed metadata/cuts, allocation failures, and a synthetic safetensors checkpoint through the reader.
  • macOS arm64 host/golden/kernel-contract suite: 211/211 steps succeeded; 3,005/3,015 tests passed, ten skipped.
  • Frozen server corpus: 309/319 equal, ten known differences, zero unexpected differences.
  • Lean: 517 inherited findings, zero added. Diff whitespace check passed.
  • Complete publication tree, outgoing history and approved public identity inspected; original contributor history preserved.
  • Linux x86_64 exact-source test test-golden test-kernel-contract -Doptimize=safe: 91/91 build steps, 1406/1413 tests passed, seven explicit platform/library skips. Frozen server corpus: 309/319 equal, ten known differences, zero unexpected differences.

Qualification scope is host format loading. Device arithmetic, family admission and tensor-parallel execution require their own integration evidence. This change adds no GPU kernel.

Public CI at this exact head: Zig format, No GPU host/contracts/goldens/fuzz, desktop and mobile checks all passed. Complete tracked-tree and outgoing-history privacy inspection found zero new private-data matches.

@ashhart

ashhart commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Thank you, @akol1, for materializing only a rank's NVFP4 rectangle while preserving packed codes, scale bytes and the stored global scale.

We checked 0a0bb86 with its #904 parent. core/nvfp4_slice.zig validates the original tensor geometry, keeps complete 16-input groups, rejects ambiguous plain/compressed scales and cleans up either allocation failure. It belongs in #847's common loader rather than a family-specific copy.

We'll take #904 first, then run the slice and failure cases and compare plain versus compressed scales on a real checkpoint. Reassembling row and input partitions should recover the original bytes, including the global scale. The subsequent projection checks will keep NVIDIA's default activation and rounding behavior.

We'll handle small integration fixes at landing and qualify the actual family calls after the loader checks, including drafted/plain, resumed/fresh and concurrent/solo replies.

Posted by Ash's AI Assistant Synthena

@akol1
akol1 marked this pull request as draft October 16, 2026 10:43
@akol1
akol1 marked this pull request as ready for review October 16, 2026 13:54
@ashhart ashhart mentioned this pull request Oct 17, 2026
@ashhart
ashhart merged commit bffdebe into ashhart:main Oct 18, 2026
4 checks passed
@ashhart

ashhart commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thank you, @akol1, for exact rank-local NVFP4 slices through the common reader.

We merged your work for 1.1.0 in bffdebe, after #904. Plain and compressed scale planes use the same bounded slice path, with allocation-failure coverage. Stored codes, scales and the global scale remain unrounded.

This keeps rank loading on the shared codec while each model retains its checkpoint-math and rank-equality gates.

Posted by Ash's AI Assistant Synthena

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