Skip to content

native: the execution witness's stamps, weight read and hash thread move to weights_witness.zig, and CUDA keeps its kernels, GPU and components - #4907

Merged
ashhart merged 3 commits into
ashhart:mainfrom
kotevcode:execution-witness-core
Nov 25, 2026
Merged

ashhart merged 3 commits into
ashhart:mainfrom
kotevcode:execution-witness-core

Conversation

@kotevcode

@kotevcode kotevcode commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

The execution witness's backend-neutral half moves out of cuda_witness.zig into weights_witness.zig, a Witness(B) that a backend fills with its own domain, stamp, keep and tail. The neutral half is the stamps before the load, every shard byte read once the server is ready, the hash thread and its reasons. CUDA keeps its kernels, GPU facts and kept-state components in a Cuda backend, and its digest is the same bytes, so nothing a user sees changes. This is the base the Metal path (#4630) builds on.

  • weights_witness.zig (202 lines): Witness(B) with open, openOrFailed, start, wait, close, release, sourceOf and digest, plus wanted(api.Open), the conditions every path shares (the flag, one rank, text, no drafter, --slide, --record, --learn, --recall or MTP drafts). It also has field, the length-prefixed update both backends hash with.

  • cuda_witness.zig goes from 247 lines to 101. wanted(F, o) keeps its dense-Qwen check and then asks weights_witness.wanted. Cuda.keep calls cuda_disk.components as before, and open, openOrFailed, bind, set, bound, release and source keep their meaning. cuda.zig changes one call (cuda_witness.openOrFailed).

  • New test: a fixed checkpoint, captured kernel set, device and profile pin the CUDA digest to c1692f38…, the value main's single-file witness gives. I computed it on 2558607 and on 3993128 before the move, and checked it is the same on both. Host builds hash no embedded images, so the pin holds there; a build with nvcc or prebuilt fatbins skips it, because the images go into the digest.

  • Issue: Refs Execution witness: Qwen3.5-2B on Metal #4630 (part 1 of 2: the shared half; the Metal path is the next PR).

  • Stacked on: main at ea57d96; this PR adds 1705275.

  • atc overlap --json: run on this head against main; complete: false (otherPullRequestsLimit, pullFilesUnavailable, pullRequestsLimit, timeLimit). MoE route tap: optional TF_ROUTE_TAP trace of global top-k #1886 and Unlimited-OCR-2 on CUDA: the family's steps on NVIDIA GPUs (sm_89 and up) #2077 share cuda.zig and report unknown.

Checks on this head

  • Head commit: 1705275
  • Lean checker and python3 tools/pr_check.py --base upstream/main --pr 4907: lean 165 and 165 on the base and this head, 0 new; 0 errors.
  • Tests run, with the command and pass, fail and skip counts (macOS 26.6, M5 Max):
    • zig build test-execution-witness-cuda-host: 22 passed, 0 failed, 0 skipped, including the pinned digest.
    • zig build test-execution-witness-host: 54 passed. zig build test-disk-identity-host: 39 passed. zig build check-native-cuda-host: 8 of 8 steps.
    • The pinned test passes on main too: it guards the move rather than testing new behaviour. With digest hashing the tail before the kept components, it fails, and it passes again with them restored.
  • CI: passes on this head (Zig format, No GPU; 10 pass, 2 skipped).
  • Not run, and why: a CUDA GPU run. No CUDA box here; the CUDA serve path changes by one call, and the pinned test checks the digest bytes.

Receipt

  • Main against branch: n/a. No inference path changes: the CUDA digest is pinned to main's bytes, and every other path is untouched. The Metal PR on top carries the Mac receipt.
  • Licence of any new weights or drafter: n/a.

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. The pin passes on main by design and skips when fatbins are embedded.
  • 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.

@AIFlowML

Copy link
Copy Markdown
Contributor

I tested 170527589c1bde0e01f7e7f923f2754001c84483 in a clean trial merge onto main 4c79cfe346d3c239ff7dfd7aa694df799755bafa on Apple silicon with Zig 0.17.0:

zig build test-execution-witness-cuda-host test-execution-witness-host test-disk-identity-host -Dfixed-cpu --summary all

All 117 tests passed: 22 CUDA witness, 55 execution witness and 40 disk identity. The CUDA host run included the pinned c1692f38… digest from before the split. This confirms the checked-in compatibility fixture still agrees on the trial merge. It uses the host test without embedded images and did not run inference or a CUDA device.

Igor Lessio - AIFLOW LABS

@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thank you, @kotevcode. The extraction retains the CUDA digest field order and lifecycle, and the compatibility fixture remains covered by the recorded host results. The default path still avoids witness file reads and workers. This looks ready to land.

  • Synthena

@ashhart
ashhart force-pushed the execution-witness-core branch from 1705275 to b376ecc Compare November 25, 2026 14:10
@ashhart
ashhart merged commit 8e0548f into ashhart:main Nov 25, 2026
@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thank you @kotevcode. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

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.

3 participants