Skip to content

feat(server): a backend's std options reach the server binary - #696

Merged
ashhart merged 1 commit into
ashhart:mainfrom
BlivionIaG:server-std-options
Oct 12, 2026
Merged

ashhart merged 1 commit into
ashhart:mainfrom
BlivionIaG:server-std-options

Conversation

@BlivionIaG

Copy link
Copy Markdown
Contributor

What this changes

The server's root (server/main.zig) now takes std.Options from the backend when the backend declares std_options, and the defaults otherwise (server/std_options.zig, one function and its test). The Metal and CUDA backends declare none, so their binaries are unchanged.

The HIP backend's RCCL path needs it: RCCL and HIP start threads of their own, and Zig's per-thread alternate signal stack leaves them too little room to start (pthread_create() failed at --tp 2). With this change the HIP build can declare signal_stack_size = null for its own binary. That declaration lands with the RCCL slice (#655); this PR only lets a backend's options through.

It is split out of #655 because it touches the shared server.

Receipt

  • Environment: base main at e7c523e, head c240bb9. Zig 0.17.0, on macOS (Apple silicon) and Linux 7.1.7.
  • Exactness: "a backend's std options pass through, and a backend without them keeps the defaults" checks both sides with two stand-in backends. It fails with the pass-through taken out. The Metal and CUDA builds have no std_options, so they keep std.Options{}.
  • Tests run:
    • macOS zig build test test-golden -Dcpu=apple_m1: 143/143 steps, 256/256 tests; golden 309/319 equal, 0 unexpected.
    • Linux zig build test: 39/39 steps, 452/452 tests.
    • zig fmt --check is clean.
    • lean_check.py: 534 problems, the same as main.
  • Not run, and why: device runs (no engine on main declares options).

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 engine behaviour changes.)
  • No precision traded for speed.
  • Prompt processing is no slower than the last release.
  • The description says which platforms I ran 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.

The server's root takes std.Options from the backend when the backend
declares them (server/std_options.zig), and the defaults otherwise, so
Metal and CUDA builds are unchanged. HIP's RCCL path needs this: RCCL and HIP
start threads that a per-thread alternate signal stack leaves too little
room to run, so the HIP backend will declare signal_stack_size = null.
@ashhart

ashhart commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Thank you, @BlivionIaG. Splitting this out of #655 made it easy to land on its own. Your commit c240bb96a landed in 1.0.8 under your name, so GitHub shows this PR as merged.

What we checked:

  • Your test passes, and with the pass-through taken out it fails on the RCCL case (expected null, got the default stack size), so it guards the right line.
  • zig build test on Linux passes 599/599 with this and four other PRs in, against 587/587 before. On a Mac, every host suite passes apart from the Neural Engine test our sandbox always blocks.
  • Metal and CUDA builds with and without your change are not byte-identical, which surprised us. Declaring std_options in the root makes Zig analyse the engines module earlier, so functions land in a different order and anonymous constants are renumbered. Compared function by function with branch targets and page offsets normalised, the Metal server's 3,619 functions and the CUDA server's 2,771 have the same instructions, and the strings in their read-only data are the same. So the code is unchanged and only the layout moved.

We added a CHANGELOG line that points at the RCCL work in #655. Looking forward to that one.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Thank you, @BlivionIaG. Splitting this out of #655 made it easy to land on its own. Your commit c240bb96a landed in 1.0.8 under your name, so GitHub shows this PR as merged.

What we checked:

  • Your test passes, and with the pass-through taken out it fails on the RCCL case (expected null, got the default stack size), so it guards the right line.
  • zig build test on Linux passes 599/599 with this and four other PRs in, against 587/587 before. On a Mac, every host suite passes apart from the Neural Engine test our sandbox always blocks.
  • Metal and CUDA builds with and without your change are not byte-identical, which surprised us. Declaring std_options in the root makes Zig analyse the engines module earlier, so functions land in a different order and anonymous constants are renumbered. Compared function by function with branch targets and page offsets normalised, the Metal server's 3,619 functions and the CUDA server's 2,771 have the same instructions, and the strings in their read-only data are the same. So the code is unchanged and only the layout moved.

We added a CHANGELOG line that points at the RCCL work in #655. Looking forward to that one.

Perfect, we are getting closer to RDNA2/3 support 🔥

BobClawblaw pushed a commit to BobClawblaw/TensorFold that referenced this pull request Oct 12, 2026
BobClawblaw pushed a commit to BobClawblaw/TensorFold that referenced this pull request Oct 12, 2026
@ashhart ashhart mentioned this pull request Oct 14, 2026
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
ashhart#696 landed above as 1d7fd39c6 (the author's commit, rebased onto this candidate). This keeps the PR's own head commit in the history, with no change to the tree.
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