Skip to content

build: the CPU server graph gives the server module core, as the Metal, CUDA and fuzz graphs do - #2363

Merged
ashhart merged 2 commits into
ashhart:mainfrom
Whq02:mercury/server-cpu-build
Nov 6, 2026
Merged

ashhart merged 2 commits into
ashhart:mainfrom
Whq02:mercury/server-cpu-build

Conversation

@Whq02

@Whq02 Whq02 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

What this changes

zig build server-cpu (the CPU-only fake server and the engine-less CLI that zig/tests/server/build.sh installs) does
not compile on main at 53311e7:

$ zig build server-cpu
server-cpu
+- install fake_serve
   +- compile exe fake_serve fast native 1 errors
zig/src/server/slide_model.zig:4:20: error: no module named 'core' available within module 'server'
const st = @import("core").safetensors;
                   ^~~~~~
referenced by:
    readShard: zig/src/server/slide_model.zig:72:19
    scan: zig/src/server/slide_model.zig:50:18
    23 reference(s) hidden; use '-freference-trace=25' to see all references
error: 1 compilation errors
...
Build Summary: 4/7 steps succeeded (1 failed)
$ echo $?
1

Since 0a83dd5, slide_model.zig imports core, and that commit gave the core module to three of the four build
graphs that root zig/src/server/root.zig: the Metal build's server tests (zig/build/metal_targets.zig), the CUDA
host tests (zig/build/cuda.zig) and fuzz-cortheon (zig/build/cortheon_fuzz.zig). The fourth, plain in
zig/build/server.zig, builds the fake server's server module for server-cpu and was left without it, so
fake_serve no longer compiles; the engine-less CLI beside it roots main.zig directly with its own core and
still builds.

After this change plain carries core/root.zig over its own tokenizer module, the shape metal_targets.zig gives
the server tests, and cpuArtefacts takes core from the import table as it already takes engine_api, tokenizer
and template, so the fake server and the engine-less CLI share one core instead of the CLI's separate one. One
file, 3 insertions, 1 deletion.

$ zig build server-cpu --summary all
Build Summary: 7/7 steps succeeded
server-cpu success
+- install fake_serve success
|  +- compile exe fake_serve fast native success 57s MaxRSS:2G
+- install tensorfold-native success
   +- compile exe tensorfold-native fast native success 1m MaxRSS:2G
      +- options cached
      +- WriteFile exlr8_alias.zig cached
$ echo $?
0

Reproduced with Zig 0.17.0 on macOS arm64, without the Metal toolchain; server-cpu needs no Metal compilation.

Checks on this head

  • Head commit: 2b92ced
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: both exit 1 with 5616 files, 252 problems, using the identical checker. The 252 findings are inherited; python3 tools/zig/lean_new.py BASE.txt HEAD.txt exits 0 with lean: 252 problems, 252 on the base, 0 new.
  • Tests run, with the command and pass, fail and skip counts:
    • The build step is the regression check: zig build server-cpu exits 1 on 53311e7 with the error above, 4/7 successful steps and 1 failed compile. zig build server-cpu --summary all exits 0 on this head, 7/7 steps, 0 failures. No new test file: these commands directly exercise the affected build graph.
    • zig build test-golden --summary all: exit 0, 5/5 steps; 322/335 and 55/55 equal to the server goldens, 13 known differences, 0 unexpected differences, 0 skipped cases. It builds its own fake_serve from the macOS server-tests module, not plain, so this is the tree's golden gate rather than the regression check for this change.
    • zig fmt --check build.zig zig: exit 0, no files reported. git diff --check and git diff --check origin/main..HEAD: exit 0, no whitespace errors.
    • zig-out/server/fake_serve serve zig/tests/server/fixtures --port 0 selected free port 59858. GET /health returned 200 (curl exit 0, status: "ok", model: "fixtures"); SIGTERM drained and stopped the server with exit 0. Three assertions passed: health, fixture identity and graceful stop; 0 failures, 0 skips.
    • zig-out/server/tensorfold-native --version: exit 0, tensorfold-native 1.2.3.
  • CI: not run on this head; the branch has not been pushed. The local checks above are not a hosted CI result.
  • Not run, and why: zig build test and zig build native on macOS compile Metal shaders; no Metal compiler is available (xcrun -f metal exits 72). zig build test-grammar-tools -Dxgrammar=DIR, which builds tool_grammar_xgrammar_test through the other call to plain, needs an xgrammar checkout, which was not supplied; it gains the same core import but was not exercised. zig build grammar -Dxgrammar=DIR was not run either, and the golden and health runs warned that libtfgrammar.dylib is absent. No Linux or Windows build was run. ATC's direct overlaps and incomplete coverage are recorded above; no combined EXL3-series tree was built.

Receipt

n/a: this changes module wiring for the fake server, the engine-less CLI and the grammar tool tests, not an inference
engine or kernel. The built CPU server's /health and SIGTERM checks above exercise the changed graph's artifact;
no checkpoint, token-exactness or performance result is claimed.

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. (No new test file: the build step itself is red on the base and green here; it requires no optional backend.)
  • 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.

@ashhart

ashhart commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Thanks @Whq02, that's a real break on main, and the fix is the right shape: the plain graph now builds core once with tokenizer and cpuArtefacts reuses it, as the other graphs do. zig build server-cpu passes 7 of 7 steps here on your head. It's in the landing queue, right behind another build fix (#2362), with a CHANGELOG line we'll add at landing.

Whq02 and others added 2 commits November 6, 2026 13:20
…l, CUDA and fuzz graphs do

Since 0a83dd5 the Living Weights view reads a shard's header with core (zig/src/server/slide_model.zig), and that commit gave the core module to the three graphs that root zig/src/server/root.zig: the Metal build's server tests, the CUDA host tests and fuzz-cortheon. The fourth, plain in zig/build/server.zig, builds the fake server's module for zig build server-cpu without it, so the step fails at slide_model.zig:4 with no module named 'core' available within module 'server'. plain now carries core/root.zig over its own tokenizer, as the Metal graph's server tests do, and cpuArtefacts takes it from the import table as it takes engine_api, tokenizer and template, so the engine-less CLI and the fake server share one core.
@ashhart
ashhart force-pushed the mercury/server-cpu-build branch from 2b92ced to 012ec0d Compare November 6, 2026 13:20
@ashhart
ashhart merged commit 5fa2dc4 into ashhart:main Nov 6, 2026
7 checks passed
@ashhart

ashhart commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Thank you @Whq02. 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.

2 participants