Skip to content

The checkpoint subcommands dispatch before the driver opens, and --version prints the build's version - #576

Closed
eleqtrizit wants to merge 5 commits into
ashhart:mainfrom
eleqtrizit:cuda-checkpoint-cli
Closed

eleqtrizit wants to merge 5 commits into
ashhart:mainfrom
eleqtrizit:cuda-checkpoint-cli

Conversation

@eleqtrizit

@eleqtrizit eleqtrizit commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Wires the checkpoint subcommands (models, info, pull) into the Linux CUDA tensorfold binary, dispatching them before the driver or GPU opens, and adds a GPU-free --version that prints the build's version on stdout. This is how the Metal side already dispatches the same shared modules (zig/src/cli/cli.zig over the platform's engine families); on Linux the CUDA build never reached them, so README commands like tensorfold pull … failed with a bare error: FileNotFound. Also closes the traversal sinks the pull path now exposes on this binary: a hub tree path with traversal segments is refused before any link lands, and only a 40-hex git sha or a well-shaped revision is ever joined into a cache path or a URL (the same gates applied to the serve side's ref resolution).

Receipt

  • Environment, with the TensorFold commit, MLX or PyTorch version, machine and GPU, checkpoint and revision: Linux x86_64, zig 0.17.0, nvcc 13.1, CUDA runtime, RTX 5090; TensorFold commit 9b4aebe on cuda-checkpoint-cli, atop 0d83398 (main). Checkpoint TensorFold/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit, revision d9d758fb83953437f7263256b0d96157e2a348b8; no MLX or PyTorch in the loop (the change is Zig CLI only).
  • Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false:
  • Decode speed before and after, from tools/bench_openai.py:
  • Prompt speed before and after, from tools/prefill_cold.py:
  • Tests run, with pass, fail and skip counts: zig build test-cuda-host exit 0 (repo unit tests, no GPU work); smoke_cuda_checkpoint_cli.sh 16/16 PASS (build; --version on stdout with no driver/GPU; strace proof models performs 0 libcuda opens vs run 6; argument handling; --version ergonomics post-fix); version_stdout.sh PASS; pull_traversal.sh + the mock hub → polite refusal (SnapshotPath), nothing escapes the cache; r3_linkIntoSnapshot_traversal 2/2, r3_cachedSnapshot_ref_traversal 2/2, r3_negative_controls 1/1 — 0 fails, 0 skips.
  • Not run, and why: bench_openai.py, prefill_cold.py and bench_concurrent.py — this change touches no engine or kernel path (CLI dispatch, pull validation and ref checks only; run/serve behavior is unchanged), so GPU decode and prefill speeds and token hashes cannot move; the wheel's engines are untouched.

Checklist

  • 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.
  • No precision traded for speed. If the bits change, the description says which sums change and why.
  • Prompt processing is no slower than the last release.
  • The description says which platforms I ran, Metal M1 to M5 and CUDA, and which I could not.
  • 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. No AI attribution lines.

…nds dispatch before the driver opens, and --version prints the build's version
…s is refused before any link, a 40-hex git sha or a well-shaped revision is the only string joined into a cache path or URL, the resume prefix hashes in chunks, and --version reaches stdout with the usage covering extra args and leading flags
…write-up and the post-fix resolution, and the traversal harness keeps the mock hub alive until the pull returns
@ashhart ashhart mentioned this pull request Oct 10, 2026
@ashhart

ashhart commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thank you, @eleqtrizit. The checkpoint commands on the CUDA build and the pull hardening are in main as 55c23ca and 80a2f3c, under your name. Your commits came with a personal email address, so we re-authored them to your GitHub noreply address, which is why GitHub shows this pull request as closed rather than merged.

Our follow-up is ce7aa86:

  • The fake hub in pull_test.zig named its revisions rev1sha, wholesha and so on, which the new 40-hex check refuses, so zig build test-cli failed two pull tests. It names 40-hex shas now, as the hub does.
  • pull.zig uses hub.zig's hexSha instead of its own copy, and revisionOk's comment says what it allows.
  • New host tests cover a revision as one URL path segment, a sha's length and digits, a hub tree path that must stay inside the snapshot, and a refs/main that isn't a sha. With the check removed, that last test fails.
  • checkpointCli had picked up nativeServer's doc comment in build/cuda.zig; each has its own again.

One change to know about: a revision with a slash, such as refs/pr/1, is now refused. Before, it went into the URL unencoded, so it most likely failed then too; URL-encoding it would be the way to allow it. It ships in the next release. Thanks again!

@ashhart ashhart closed this Oct 10, 2026
BobClawblaw pushed a commit to BobClawblaw/TensorFold that referenced this pull request Oct 10, 2026
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
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