Skip to content

cluster: serve --cluster brings a GB10 and a Mac up as one cluster over ConnectX and agrees on a disaggregated model's plan, before any tokens run (#1594, step 2a) - #2088

Merged
ashhart merged 19 commits into
ashhart:mainfrom
ThinkOffApp:pr/1594-step2a
Nov 7, 2026

Conversation

@ThinkOffApp

@ThinkOffApp ThinkOffApp commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Step 2a of #1594. Step 1 (#1957) let the MCDMA endpoint take a ConnectX link. This PR connects those endpoints to the cluster layer. Each host opens a real MCDMA endpoint over the links the cluster file declares and wraps it in the cluster's existing fabric_link.Link. Each node then settles membership over that link on the real clock, and every node agrees on the plan and its digest before anything else happens. The first model it brings up is a disaggregated one (a GB10 prefills, a Mac decodes), as agreed on the issue. No model rounds run yet and no KV moves: the KV hand-off and the first tokens are step 2b, engine work, in their own PR. A converged model on real hosts stays refused, and the message now names the missing piece (a real backend.Shard). Nothing changes arithmetic.

Base: main at 45876f5, with step 1 (#1957) landed. This PR's diff is 45876f5..961b52c: 38 files, +2430 / -107, about half of it tests and test data. Sixteen commits:

Three commits near the end are repairs, not the feature. tools/zig/test_fabric.sh lists its modules by hand and stopped building on main at a46c9dd, which moved the fabric's bf16 rounding onto the bf16_round module and wired the build only. CI does not run the script, so nothing failed. Before the fix the script exits 1 on clean main at its first compile; with it, the script passes here. zig/build/cluster_cuda.zig holds the cluster's CUDA module, so zig/build/cuda.zig stays at 600 lines. And main's fix for models that cannot be planned ran before this PR's refusal of a converged model on real hosts, so serve now names the missing Shard first, and a dry run still fails when the plan does.

Receipt

  • Environment: TensorFold 961b52c for the test suites and c1cfa670d for the hardware gate (see "The hardware gate"), Zig 0.17.0, default build options. The Mac node: MacBook Pro, Apple M5 Max, macOS 27.0.1 (26A434), ConnectX-5 in a Thunderbolt PCIe enclosure, MCDMA's native kext 0.1.18. The GB10 node: ASUS GX10 (GB10), Ubuntu 24.04.5, kernel 7.0.0-1019-nvidia, ConnectX-7 on mlx5_core, firmware 28.45.4028. libmcdma-fabric from MCDMA e725b45, built on each host. No checkpoint: this step brings the nodes up and agrees on the plan. It loads no model.
  • Exactness: no arithmetic change, and no model rounds run in this step. On the hardware both nodes compute the same plan digest from one cluster file and agree on it before anything else. Two files that differ in a link's path MTU connect, then refuse each other's plan by name. bench_concurrent.py and token_sha do not apply: no token path changes.
  • Decode speed before and after: n/a. No inference or token path changes. The new code runs only under serve --cluster and node, and it stops at the agreed plan (rounds come with step 2b).
  • Prompt speed before and after: n/a, for the same reason.
  • Tests run, with pass, fail and skip counts: on the M5 Max (macOS 27.0.1, Zig 0.17.0), from a clean git archive of 961b52c with an empty cache for each suite, niced, each suite's own exit code 0.
    • zig build test: 10305 passed, 0 failed, 84 skipped (10389), 669 of 669 steps.
    • zig build test-cluster: 115 passed, 0 failed, 6 skipped (121).
    • zig build test-tp: 71 passed, 0 failed, 3 skipped (74).
    • tools/zig/test_fabric.sh with TF_MCDMA_SRC at MCDMA e725b45: 41 passed, 0 failed, 1 skipped (the opt-in verbs smoke test) in the fabric module and the verbs root; MCDMA's stub suites 21 of 21; and the new cluster bring-up on MCDMA's stub verbs 3 of 3.
    • On the hardware (the MacBook Pro and one ASUS GX10 on a direct cable): preflight, up, stop-gb10, stop-mac, pair, mismatch, the 8 refusals and a cable pulled by hand pass, all on 3 Nov with both binaries built from c1cfa670d (see "The hardware gate"). Not rerun at 961b52c. Since c1cfa670d the differences are main's commits, which include step 1 as it landed, and the three repair commits above; the serve order change touches only a converged model, which the gate refuses either way. The GB10 binary was rebuilt at 961b52c.
  • Not run, and why:
    • A Thunderbolt link on hardware for the cluster path (it needs two Thunderbolt Macs). For Thunderbolt, the config defaults are MCDMA's own, and the tests pin that a file without links parses as before.
    • Through a switch, only preflight and up ran (see "The hardware gate"); the stops, pair, mismatch and cable rows ran on the direct cable.
    • TF_FABRIC_VERBS=1's opt-in verbs smoke test.
    • The GB10's CUDA device code. Its tensorfold runs only the cluster commands here, which need no driver and no GPU.
    • CI does not run test-cluster, test-tp or tools/zig/test_fabric.sh, so those ran locally only. They carry most of this PR's tests (see "Tested").

Checklist

  • Every token still goes through the lane rounds. No rounds run in this step; it brings nodes up and agrees on the plan.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. Not touched by this change.
  • No precision traded for speed. No sums change.
  • A new or changed GPU kernel is registered with the kernel contract. No kernel changes.
  • Prompt processing is no slower than the last release. Not touched.
  • The description says which platforms I ran: Metal on an M5 Max, and CUDA as a GB10 (ASUS GX10) running the cluster commands. Its device code is built but not exercised. M1 to M4 not run; the cluster layer has no per-chip code.
  • New tests fail before the change and pass after it. The launch test pins the exact remote command with the background job in braces, which the old command fails. The tests for unknown flags, a GB10 without a memory figure, the Linux probes, a plan mismatch, a wrong peer and a lost peer cover behaviour that did not exist before. The MCDMA stub bring-up runs in tools/zig/test_fabric.sh when TF_MCDMA_SRC names MCDMA's source.
  • Comments and docstrings are one line. tools/zig/lean_check.py: 424 problems, the same as the base, 0 new.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.

1. The cluster file: a node's library, and each link declared once

config.zig, cluster.schema.json, launch.writeJson, config_test.zig.

  • A node may name library, libmcdma-fabric's absolute path. MCDMA's library is loaded from no other place, so a relative path, or one with a NUL, is refused.
  • A new top-level links array: the data plane's MCDMA links, each declared once for both ends. A link has name, kind (tb5 or cx5; absent takes whichever connects) and mtu (1024, 2048 or 4096, default 4096), shared by both ends. Per end it has node, device, via, port and gid. An end's peer port is the other end's port, and a Thunderbolt bond's devices take consecutive ports from each end's port and pair by position. So the two ends of a link cannot read different names, kinds, path MTUs or ports, which step 1 found nothing else checks.
  • Checked by name before anything opens, as mcdma.zig and tp_settings check them:
    • a ConnectX end needs its GID index, and on a Mac it must be 0 (the MCDMA kext has index 0 only);
    • no bonds on a ConnectX link; a CUDA host takes no Thunderbolt link;
    • one link per pair of nodes and one per device (what mcdma.Endpoint takes);
    • the via is an interface, a slash and the other end's address, one for all devices or one per device;
    • ports from 1 to 65535, room for every member of a Thunderbolt bond, link names unique and 1 to 20 characters.
  • Defaults are MCDMA's: path MTU 4096, no kind, GID 1 (or -1 to scan a Thunderbolt bond of more than two devices). A file without library or links parses as before, and the fake path (--probes) needs neither.
  • Both fields are optional, and a file without them means what it did, so the schema stays tensorfold-cluster/1. An older tensorfold ignores them; it never opened real links.
  • cluster init's writer keeps the library and every link, and its output parses back the same.
  • Every refusal of a model's layout is unchanged. A test pins one: declaring a link between a Mac and a GB10 does not let Metal and CUDA into one tensor-parallel group.

2. A node's rank, links and window from the file: mcdma_link.zig

New file, +225, and its tests, +222.

  • Ranks every node derives alike. A disaggregated model's ranks are its prefill nodes, then its decode nodes, each as listed; a converged model's are its node list. The order of nodes in the file never moves a rank. So in the first run the GB10 is rank 0 and the Mac rank 1.
  • This node's links. For each other rank, the declared link between the two, taken from this node's end: device, via, port, GID, and the other end's port as peer_port; the link's name, kind and path MTU as both ends read them.
  • The window is fabric_link.Layout (a step channel and one message pipe per ordered pair of ranks, self included, for membership) rounded up to MCDMA's alignment, with 1 MiB of staging a rank. That is 884736 bytes for two ranks.
  • Refused by name before anything opens: a node outside the model, a node listed twice, a missing link, more ranks than membership keeps links for (16), no library, and, on a Mac, a ConnectX window and staging past the kext's 64 regions (ported from tf-mcdma-pair, which refuses the same as TooManyRegions). Two ranks need 2 regions.
  • Open creates the mcdma.Endpoint from that config and wraps it in fabric_link.Link.init(gpa, ep.rdma(), layout), unchanged. Its deinit flushes, so the peers hear MCDMA's goodbye.
  • planDigest hashes what every node must read alike: the model and its mode, budgets and layout, every rank's name and backend, and every link between them (name, kind, path MTU, and both ends' node, device, via, port and GID, in rank order so the file's end order does not matter). A cluster file that differs in any of these gives another digest.
  • libraryError tells MCDMA's library missing or unusable (the CLI's exit 3) from a link or peer failure.

3. Bring-up on the real clock: bringup.zig

+240 / -4, tests +148, and zig/tests/cluster_mcdma_stub.zig +192.

  • Live runs one node's membership on CLOCK_MONOTONIC over any transport; on a real host that is the cluster's Link over the MCDMA endpoint. simulate (every node in one process over the fake net) is unchanged and still drives the fake path.
  • up() returns once every node in the file is in one settled view, all computed this plan, and all marked themselves planned. The last step means no node leaves before the others have seen the agreement.
  • Failures name the node:
    • a peer that computed another plan is PlanMismatch, with its digest (for example, two cluster files with different path MTUs connect, then refuse each other instead of running);
    • the node at a link's other end must be the one the file puts there (WrongPeer);
    • a peer that never comes is NeverSettled at the settle time (60 s);
    • after agreeing, watch() returns the first member to leave or fall silent past membership's dead time (3 s), with MCDMA's reason for the link when the library gave one.
  • leave() says goodbye on every link and lets the links drain for 300 ms before they close.
  • onHost() does all of it for one node from mcdma_link's spec, and prints the links it opened and the agreement.
  • zig/tests/cluster_mcdma_stub.zig runs a Mac node and a GB10 node in one process over MCDMA's offline stub verbs, each from the same cluster file to its own endpoint: they agree and part, different path MTUs refuse each other's plan, and a stopped node fails the other's hold by name.

4. The CLI

cli.zig and cli_test.zig, launch.zig and launch_test.zig.

  • The real path. On real hosts a disaggregated model's nodes open their MCDMA links from the cluster file, settle one view and agree on its plan (mcdma_link's digest), then hold. serve holds for --hold seconds (default 0) before saying goodbye; node holds until a node says goodbye. A node found dead, a plan that differs, a wrong peer or a view that never settles fails by name, exit 1. This replaces the "this build does not link the MCDMA endpoints" refusals (exit 3).
  • Everything that can refuse does so before serve starts any node. serve checks every node of the model as that node will check itself (a Metal node as a Mac, whatever host runs serve): a node outside the model, a missing link between any two nodes, a Mac's window past the kext's 64 regions, and a node with no library. Only each node can look for its library's file on its own host. A dry run shows each node's rank, links and plan.
  • Exit 3 stays for MCDMA's library: no library, no file there, or not libmcdma-fabric ABI 1.
  • A converged model on real hosts stays refused, now before any node starts and naming the missing piece: "model X is converged: its rounds on real hosts need a real backend.Shard (cluster/backend.zig) on every node, and only the toy shard exists, so it is refused and no node was started". serve exits 1 (it was 3), and a dry run prints the same line and exits 0.
  • The fake path no longer plans a disaggregated model as one tensor-parallel group. It reads no model files, starts only the prefill and decode nodes, and agrees on the same digest the real nodes would.
  • Membership knows a node by its name in the file, not its probed hardware id, so two nodes on one host do not take each other for themselves.
  • serve MODEL checks only the model it serves, so another model in the file cannot stop it (cluster check and status still check --model or every model). A disaggregated model without "nodes" asks a per-node path only of its prefill and decode nodes.
  • A node's "bin". serve started each node with a bare tensorfold node over ssh, and a non-interactive ssh session's PATH holds only the system directories (a GB10's, for one), so the launch could not find it. A node may give "bin", the absolute path of its tensorfold. The launch runs that, and tensorfold from the PATH as before when it is absent. A relative path, or one with spaces or other shell syntax (it goes into the remote command as written), is refused by name. The schema and cluster init's writer keep it.
  • The launch backgrounds only the node. The remote command was mkdir ... && printf ... > cluster.json && nohup BIN node ... >> node.log 2>&1 < /dev/null & echo started $!, where the & backgrounds the whole && chain, whose shell keeps ssh's stdout open until the node exits. So serve's ssh never returned while the node waited for serve. The fix braces the background job, and a test pins the exact command. No test could see it before (the fake hosts' runner runs no ssh); the first up on hardware found it.
  • Unknown flags are refused. node and serve looked their flags up by name and ignored the rest, so node ... --dry-run (node has no dry run) opened the real MCDMA endpoint and waited for its peer. Both now refuse, before reading the cluster file, an unknown flag, a flag missing its value, a value given to a switch and a stray argument, each by name, with the usage (exit 2).

5. The GB10's tensorfold

probe.zig, launch.zig, wire.zig, zig/build/cuda.zig, zig/src/cli/cuda_main.zig.

  • A Linux inventory. A CUDA node was read with the macOS probes, so a GB10 failed them. It is now read with meminfo, nvidia-smi, ibv_devinfo -v, df and machine-id. nvidia-smi is asked only for name and memory, so a GB10 stays "NVIDIA GB10"; a memory column of [N/A] leaves gpu_limit 0, and a declared gpu_limit_gb still fills it. A missing nvidia-smi or ibv_devinfo is an empty report, not a failed probe.
  • The ConnectX GID index. ibv_devinfo keeps each port's first RoCE v2 GID (index 1 in the captured ibv_devinfo -v output, now testdata/gb10-ibv.txt, with its GUID, GIDs and addresses replaced by made-up values), ::ffff:a.b.c.d parses as the same GID as the colon form, and vendor_part_id 4129 is ConnectX-7. The inventory's wire version goes to 2, because each port now carries that index.
  • The fake bring-up cables the declared links. A CUDA host probed this way reports no Thunderbolt peers, so the probed topology never joins a Mac to a GB10, and serve's fake bring-up of a disaggregated model (serve --cluster --probes) could not settle. It now cables the links the file declares, as the real nodes open them, and uses the probed topology only when the file declares none. Its test feeds the GB10's Linux probe output and checks both.
  • A GB10 with no memory figure is refused. A GB10's nvidia-smi prints [N/A] for memory (its memory is unified), so a probed GB10 had gpu_limit 0 and used to plan anyway: the fit treated 0 as one byte, then failed with a Mac wired-limit sentence. launch.inventory now returns GpuLimitMissing before any plan, naming the node: "refused: NAME is a GB10 and nvidia-smi printed no memory. Set gpu_limit_gb for NAME in the cluster file". init, check, serve and node exit 1 with that line and no stack trace. A declared gpu_limit_gb is kept (an explicit 0 is still refused), and MemTotal is not used as a stand-in.
  • The cluster commands in the GB10's tensorfold. zig/build/cuda.zig builds the cluster module against CUDA's core, lanes and fabric, and cuda_main.zig dispatches cluster init|check|status, serve --cluster and node before it looks for a model; they need no driver and no GPU. The CUDA binary's node takes the same MCDMA path, through the library each node names in the cluster file.
  • One file, one module. The CUDA binary is one compilation, and Zig allows a file in only one module. canon.zig stays the canon module GLM already uses (cluster imports it), and verbs.zig and verbs_abi.zig stay the verbs module TP already uses (fabric imports it). So those modules' tests no longer run inside cluster or fabric: test-cluster roots the canon module, and zig build test and test_fabric.sh both root the verbs module, so those tests stay in the suite CI runs. The verbs.h size check is the arm64 macOS table, so it skips elsewhere (Linux rdma-core's layout differs; that is separate work).

The hardware gate

Mac node (rank 1) GB10 node (rank 0)
host MacBook Pro, Apple M5 Max, macOS 27.0.1 (26A434) ASUS GX10 (GB10), Ubuntu 24.04.5, kernel 7.0.0-1019-nvidia
NIC ConnectX-5 in a Thunderbolt PCIe enclosure, port mcrdma0, GID index 0 ConnectX-7 (vendor_part_id 4129), port rocep1s0f0, firmware 28.45.4028, RoCE v2 GID index 1, active MTU 4096
driver MCDMA's native kext org.mcdma.cx5.native 0.1.18 mlx5_core from that kernel
library libmcdma-fabric from MCDMA e725b45, built on the host the same, built on the host
tensorfold tf-cluster (the Mac's cluster commands) from a clean git archive of c1cfa670d tensorfold built on the GB10 from a git archive of c1cfa670d with -Dnvcc and -Dsm=121

One direct cable, no switch, RoCE v2 at path MTU 1024, which the gate's cluster file sets; it is not a port limit (the ports run at 4096). The nodes meet over Wi-Fi. One cluster file on both hosts declares the link once. The GB10 node gives "gpu_limit_gb": 100 (its nvidia-smi prints no memory) and "bin", the absolute path of its tensorfold. The GB10 is rank 0 and the Mac rank 1 (prefill nodes first). Every node prints its rank, the window (884736 bytes, 1 MiB of staging a rank) and plan digest e24a8bf66267a535.

run what result
preflight both hosts read-only (kext, ports, active MTUs, GIDs, both static neighbours, libraries); cluster check and serve --dry-run of the file PASS
up serve on the Mac starts node on the GB10 over ssh; the same plan digest on both; the GB10 leaves on the Mac's goodbye PASS: serve's launch returned at once; links up in 323 ms (Mac) and 1180 ms (GB10); both agree on the plan and view 22b2dc386f3c6683 after about 200 ms; the Mac held 20 s and said goodbye, and the GB10 left on it ("this node said goodbye and closed its links")
stop-gb10 the GB10's node stopped (SIGSTOP) after agreeing: the Mac fails naming it, not a hang PASS: the Mac failed 3.63 s after the stop, naming the GB10's node as dead (membership's 3 s dead time; a stopped process leaves the link up)
stop-mac the Mac's serve stopped (SIGSTOP) after agreeing: the GB10 fails naming the Mac PASS: the GB10's node failed within 4.60 s of the stop, naming the Mac's node as dead
pair node on both hosts from one cluster file, no serve: both connect and agree; then the GB10's node is stopped PASS: links up in 313 ms and 1131 ms; both agree on the plan and view 22b2dc386f3c6683 after about 200 ms; the Mac failed 4.48 s after the stop, naming the GB10's node as dead, with MCDMA's "a flush failed"
mismatch the Mac reads path MTU 2048, the GB10 1024 PASS: the link came up at both MTUs (2048 on the Mac, 1024 on the GB10), and each refused the other's plan by name with both digests (e24a8bf66267a535 and 80a909bb2d0e047f)
refusals on the Mac: converged refused naming the Shard; no library exit 3; a Mac gid 1, a relative bin and unknown flags refused PASS 8 of 8
cable the cable pulled by hand at the Mac's end after agreeing: both fail by name PASS: the GB10's carrier dropped; each node then failed naming the other's node as dead, with MCDMA's "a flush failed" (status 5, PEER), about 3.9 s after the drop on each side (log write times; the clock offset between the hosts was not measured)
up, through a switch the same up with both nodes on a MikroTik CRS812 switch instead of the cable, on other ports than the table above: the Mac's mcrdma1 at 100G (the port renamed after the enclosure was power cycled) and the GB10's rocep1s0f1 at 200G, path MTU 1024 PASS: links up in 336 ms and 1235 ms; both agree on the plan after about 200 ms; the GB10 left on the Mac's goodbye

Before the launch fix, up failed on the hardware: serve's ssh held until the node exited, so the GB10's node timed out after 300 s (MCDMA TIMEOUT, ConnectFailed) before the Mac opened its endpoint. That is the launch bug in section 4, now fixed and pinned by a test.

What a reviewer needs to know

  • Ranks are not the file's order. Prefill nodes come first, so the GB10 is rank 0. --leader only picks the host that runs serve and starts the others over ssh; membership elects its leader by id.
  • The path MTU must match on both ends (step 1). Declaring each link once makes it one value, and the plan digest covers it, so two hosts with different files refuse each other by name instead of running at different MTUs.
  • At most 64 memory regions per context on a Mac (step 1). The control-plane window here needs 2 for two ranks. The KV windows of 2b will not fit as they are; that is 2b's problem, and the check is already in place.
  • GID 0 on a Mac. The config step refuses any other value.

Open points

  • metal_link.zig's ConnectFailed advice is still Mac-to-Mac wording (left from step 1).
  • The verbs.h size check runs on arm64 macOS only; a Linux table is separate work.
  • The two ends of a Thunderbolt bond are not yet checked for the same number of devices. No Thunderbolt link ran on hardware here.

Tested

What CI shows and what it does not. The no-GPU workflow (.github/workflows/no-gpu.yml) runs zig build test, test-kernel-contract, test-golden, the security steps and the fuzz targets. It never runs test-cluster, test-tp or tools/zig/test_fabric.sh, and those three carry almost all of this PR's tests (the cluster config, mcdma_link, the bring-up, the CLI, the launch, and the MCDMA stub bring-up). They ran locally, with the counts below; CI will not show them. test-cluster is registered with the Metal targets, so today only the workflow's macOS job could run it; the Linux job needs that registration moved first. test_fabric.sh could join where MCDMA's source is present.

Where and how every count was taken:

  • Machine: MacBook Pro, Apple M5 Max, 128 GiB, arm64; macOS 27.0.1 (26A434). Zig 0.17.0 (aarch64-macos). MCDMA e725b45 for test_fabric.sh.
  • Build options: the defaults. -Dhip and -Dvulkan off; no -Dnvcc or -Dfatbins, so no CUDA device code is compiled. Test binaries compile Debug for the native target (zig's default for tests). The CUDA host tests (test-cuda-host, part of zig build test) build and run on the Mac.
  • Caches: a clean git archive of 961b52c, an empty cache for each suite (--cache-dir and ZIG_GLOBAL_CACHE_DIR for zig build, ZIG_LOCAL_CACHE_DIR and ZIG_GLOBAL_CACHE_DIR for test_fabric.sh), niced, and each suite's own exit code (not a pipe's).
  • Per step: the full suite's run is kept per step (passed, skipped, failed, total), and any step that printed "cached" or no pass count is named below.

At 961b52c:

  • zig build test (what CI runs): exit 0, 669 of 669 steps, 10305 passed, 0 failed, 84 skipped (10389).
    • Per step: 238 run-test lines summing to exactly 10305 / 84 / 10389.
    • One run step printed "cached": its compile was a cache hit inside the empty cache dir, so the same binary had already been built and run earlier in the same build, and zig skipped the identical second run. No tests are lost.
    • Two test-cuda-host runs succeeded without a pass count (they ran, but do not report through zig's test protocol). The other "cached" lines are build inputs (options, written files, shader compiles).
    • canon.zig's three tests and verbs.zig and verbs_abi.zig's four each run exactly once: canon's in the CUDA host "shares" test (canon_glm_test.zig imports canon.zig), verbs' in the verbs root this PR adds.
    • The log carries stderr from tests that exercise failure paths, which zig prints with a "failed command" header; every step succeeded.
  • Local only (not in CI): zig build test-cluster 115 passed, 0 failed, 6 skipped (121). zig build test-tp 71 passed, 0 failed, 3 skipped (74).
  • Local only (not in CI): tools/zig/test_fabric.sh with TF_MCDMA_SRC at MCDMA e725b45: exit 0. The fabric module 38 passed; the verbs root 3 passed and 1 skipped (the opt-in verbs smoke test); fabric_handoff 5, fabric_vectors 2, fabric_collective 4, fabric_sendrecv 1, fabric_library 4 and fabric_mcdma_stub 5 (21 of 21, as in step 1); and cluster_mcdma_stub, new here, 3 of 3. 0 failed.

@ashhart

ashhart commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Thanks @ThinkOffApp, this is thorough: one declaration per link so both ends read the same path MTU, a plan digest both nodes must agree on, every failure by name, and a hardware gate that includes pulling the cable. The launch fix and the unknown-flag refusals are good finds too. One thing before it lands: the captured ibv_devinfo file in cluster/testdata/ and the GID tests in probe.zig carry real hardware identifiers, the NIC's GUID, its MAC-derived GIDs and private LAN addresses. Please replace them with made-up values, a dummy GUID, fe80::1-style GIDs and 192.0.2.x addresses, as the rest of the cluster tests already do, and check the parsed results still pin the same cases.

@ThinkOffApp

Copy link
Copy Markdown
Contributor Author

thanks @ashhart! The hardware identifiers in #2088 have been replaced with made-up values (dummy GUID, fe80::1-style GIDs, 192.0.2.x addresses), in every commit of the branch. The older test GIDs from step 1 are replaced too. The same tests still pin the same cases, with the same pass counts. Head is 961b52c.

@ashhart

ashhart commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Thanks @ThinkOffApp. Every address, GID, GUID and UUID in the tests and the captured ibv_devinfo file is now a made-up or documentation value, across the whole branch, which is what we asked. This is ready to land.

@ashhart

ashhart commented Nov 6, 2026

Copy link
Copy Markdown
Owner

/atc exchange eedaa1c76c9a35ad0ebbbabccf7409f5cb3b80c2763751d22eaef88252f19249

@ashhart

ashhart commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Rebased onto main (6604b4201c), with your commits under your name and one small commit of ours on top. Main had reworded cluster/config.zig's file comment to one line, and your step 2a adds MCDMA links to it, so the two now share one line within 120 columns. The other conflict resolved the same way as last time. It's back in the landing queue. The push gate had also stopped on the test fixture's /home/tf/.local/bin/tensorfold, which is a made-up node path, so we've allowed that exact string. Nothing for you to do unless CI says otherwise.

…o both ends read the same path MTU (ashhart#1594 step 2a)

A node may name its libmcdma-fabric (an absolute path), and the file may
declare the data plane's MCDMA links. Each link is declared once, with its
name, kind (tb5 or cx5) and path MTU (mcdma.path_mtus, default 4096) shared
by both ends, and per end the node, device, via, exchange port and GID
index. An end's peer port is the other end's port, so the two cannot
disagree. Checked as mcdma.zig and tp_settings check them, by name and
before anything opens: a ConnectX end needs its GID index, a Mac's is 0,
no bonds on ConnectX, a CUDA host takes no Thunderbolt link, one link per
pair of nodes and per device. launch.writeJson keeps both, the schema
describes both, and every refusal of a model's layout is unchanged.
…file, so every node derives the same endpoint before opening it (ashhart#1594 step 2a)

Ranks are the prefill nodes then the decode nodes, as listed (a converged
model keeps its node list), so the order of nodes in the file never moves
a rank. Each node takes its end of every declared link to the other
ranks: the same name, kind and path MTU on both ends, and the other end's
port as its peer port. The window is fabric_link's Layout (its total,
at MCDMA's alignment) and the endpoint is mcdma.Endpoint with the
cluster's Link over it. Refused by name before anything opens: a node
outside the model, one listed twice, a missing link, more ranks than
membership keeps links for (16), no library, and on a Mac a ConnectX
window and staging past the kext's 64 regions (the check tf-mcdma-pair
makes). planDigest hashes what both ends must read alike, for the
bring-up to agree on.
…so a real host settles, agrees on the plan and fails a lost peer by name (ashhart#1594 step 2a)

Live runs one node's membership on CLOCK_MONOTONIC over any transport
(the cluster's Link over an MCDMA endpoint): up() waits until every node
in the file is in one settled view, all computed this plan, and all
marked themselves planned, so none leaves before the others agree. A
peer that computed another plan (another cluster file, say a different
path MTU) is PlanMismatch, naming it and its digest; the node at a link's
other end must be the one the file names (WrongPeer); a peer that never
comes is NeverSettled at the settle time. watch() holds the view and
returns the first member to leave or fall silent past the dead time;
leave() says goodbye and lets the link drain before it closes. onHost()
opens this node's endpoint from mcdma_link's spec and does all of it,
with MCDMA's reason for a lost peer.

Tested on the fabric's in-process endpoints in test-cluster, and in
tools/zig/test_fabric.sh over MCDMA's stub verbs: a Mac node and a GB10
node from one cluster file agree and part, two files with different path
MTUs connect and then refuse each other's plan by name, and a stopped
node fails the other's hold by name within the dead time.
…over MCDMA on real hosts, so its nodes agree on the plan before any round (ashhart#1594 step 2a)

On real hosts a disaggregated model's nodes open their MCDMA links from
the cluster file, settle one view and agree on its plan (mcdma_link's
digest), then hold: serve for --hold seconds (default 0) before saying
goodbye, node until a node says goodbye. A node found dead, a plan that
differs, a wrong peer or a view that never settles fails by name, exit 1.
Everything that can refuse does so before serve starts any node: a node
outside the model, a missing link, the Mac's 64 regions, and MCDMA's
library (no "library", or no file there), which stays exit 3; a dry run
shows each node's rank, links and plan. Membership knows a node by its
name in the file rather than its probed hardware id, so two nodes on one
host do not take each other for themselves.

A converged model on real hosts stays refused, now before any node
starts and naming the missing backend.Shard (exit 1, was 3). On fake
hosts a disaggregated model no longer plans its prefill and decode lists
as one tensor-parallel group: it reads no model files, starts only its
two lists' nodes and agrees on the same digest the real nodes would.
…ill and decode nodes only, so a model without "nodes" asks no path of nodes that never load it (ashhart#1594 step 2a)

A disaggregated model that leaves out "nodes" gets every node of the
file there, and its per-node path map was checked against all of them.
Only the prefill and decode nodes load the model, so only theirs are
required; a converged model still needs one for every node it lists.
…in the file cannot stop it (ashhart#1594 step 2a)

serve takes its model as an argument, but its check went by the --model
flag alone, so `serve q` also planned every other model in the file,
printed it and failed when one of them could not be planned. The check
now takes the served model; cluster check and status still take --model
or every model.
…re it starts any, so no node is started into a cluster that cannot come up (ashhart#1594 step 2a)

serve derived and checked the MCDMA spec of its own node only, so a
remote node with no "library", a missing link between two remote nodes
or a Mac's window past the kext's 64 regions passed, and serve started
the remote nodes over ssh before any of them failed. mcdma_link.specAll
checks every node of the model as that node will check itself (a Metal
node as a Mac, whatever host runs serve), and serve refuses by name
before launching: exit 3 for a node's missing library, else 1. Only each
node can look for its library's file on its own host.
…so a host whose ssh PATH lacks it can still be started (ashhart#1594 step 2a)

serve starts each node with a bare `tensorfold node` over ssh, and a
non-interactive ssh session's PATH holds only the system directories
(a GB10's, for one), so the launch could not find it. A node may give
"bin", the absolute path of its tensorfold; the launch runs that, and
`tensorfold` from the PATH as before when it is absent. A relative
path, or one with spaces or other shell syntax (it goes into the remote
command as written), is refused by name. The schema and cluster init's
writer keep it, and the fake hosts' runner knows a launch by its
"node --name" rather than the binary's name.

The launch's remote command backgrounded the whole && chain (mkdir, the
cluster file, the node), so that subshell kept ssh's stdout open and ssh,
and serve's launch step with it, waited until the remote node exited; a
node then timed out waiting for its leader. Only the node goes to the
background now, inside braces with its stdin, stdout and stderr all
redirected, and the command returns as soon as it prints the node's pid.
A test pins the command, and one runs it with /bin/sh against a stand-in
node and checks it returns well before the node ends.
…so a mistyped or missing option never opens a real endpoint (ashhart#1594 step 2a)

The commands looked their flags up by name and ignored the rest, so
`node ... --dry-run` (node has no dry run) opened the real MCDMA
endpoint and waited for its peer. node and serve now refuse, before
reading the cluster file, an unknown flag, a flag missing its value, a
value given to a switch and a stray argument, each by name, with the
usage (exit 2). serve's usage line lists --probe, which it already took.
…index (ashhart#1594 step 2a)

A CUDA node was read with the macOS probes, so a GB10 failed them. It is now read
with meminfo, nvidia-smi, ibv_devinfo -v, df and machine-id. nvidia-smi asks only
for name and memory, so a GB10 stays NVIDIA GB10. A memory column of [N/A] stays
gpu_limit 0, and a declared gpu_limit_gb still fills it. A missing nvidia-smi or
ibv_devinfo is an empty report, not a failed probe.

ibv_devinfo keeps the first RoCE v2 GID. In the captured ibv_devinfo -v output
that row is index 1. vendor_part_id 4129 is ConnectX-7. ::ffff:a.b.c.d parses as
the same GID as the colon form. The inventory wire version is 2 because each
port carries that GID index.

A CUDA host probed this way reports no Thunderbolt peers, so the probed topology
never joins a Mac to a GB10, and serve's fake bring-up of a disaggregated model
(serve --cluster --probes) could not settle. It now cables the links the file
declares, as the real nodes open them, and the probed topology only when the
file declares none. Its test gives the GB10 Linux probe output (the captured
ibv_devinfo -v, now testdata/gb10-ibv.txt) and checks both. No test names a
machine.

test-cluster: 110 passed, 6 skipped. test-tp: 70 passed, 3 skipped.
tools/zig/test_fabric.sh: every file passes (fabric 40 passed, 1 skipped; the
cluster's MCDMA stub bring-up 3 of 3).
… step 2a)

A probed GB10 with gpu_limit still 0 used to plan anyway. weight() treats 0 as 1
byte and the fit then fails with a Mac wired-limit sentence. launch.inventory now
returns GpuLimitMissing before any plan, and names the node: refused: NAME is a
GB10 and nvidia-smi printed no memory. Set gpu_limit_gb for NAME in the cluster
file. init, check, serve and node exit 1 with that line and no stack trace;
serve of a disaggregated model catches it too, in its fake hosts' inventories
and in its own, and its fake-host test checks that. A declared gpu_limit_gb is
kept, including an explicit 0, which is still refused. MemTotal is not used as a
stand-in.

test-cluster: 111 passed, 6 skipped. test-tp: 70 passed, 3 skipped.
tools/zig/test_fabric.sh: every file passes (fabric 40 passed, 1 skipped; the
cluster's MCDMA stub bring-up 3 of 3).
…p 2a)

The CUDA binary now imports the cluster module and handles cluster init, check
and status, serve --cluster, and node --name before it looks for a model. Those
commands need no driver and no GPU. On top of step 2a, the CUDA binary's node
takes the cluster CLI's MCDMA path, through the library each node names in the
cluster file.

That binary is one compilation, and Zig allows a file in only one module.
canon.zig stays the canon module GLM already uses, and cluster imports it.
verbs.zig and verbs_abi.zig stay the verbs module TP already uses, and fabric
imports it. The CUDA CLI passes those same modules through. Other builds make
their own.

Those modules' tests do not run inside cluster or fabric. test-cluster also
roots the canon module. test_fabric.sh and zig build test both root the verbs
module, so those tests stay in the suite upstream CI runs. The verbs.h size
check is the arm64 macOS table, so it skips on other systems.

test-cluster: 111 passed, 6 skipped. test-tp: 70 passed, 3 skipped.
test_fabric.sh: fabric 37 passed; verbs 3 passed, 1 skipped; cluster stub 3 of 3.
verbs on zig build test: 3 passed, 1 skipped.
@ashhart
ashhart merged commit 8569e53 into ashhart:main Nov 7, 2026
4 of 7 checks passed
@ashhart

ashhart commented Nov 7, 2026

Copy link
Copy Markdown
Owner

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

@ashhart

ashhart commented Nov 7, 2026

Copy link
Copy Markdown
Owner

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