Repository navigation
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
Conversation
17df58c to
48f0050
Compare
|
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 |
48f0050 to
961b52c
Compare
|
thanks @ashhart! The hardware identifiers in #2088 have been replaced with made-up values (dummy GUID, |
|
Thanks @ThinkOffApp. Every address, GID, GUID and UUID in the tests and the captured |
|
/atc exchange eedaa1c76c9a35ad0ebbbabccf7409f5cb3b80c2763751d22eaef88252f19249 |
961b52c to
6604b42
Compare
|
Rebased onto main ( |
…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.
…so the script runs on main again (ashhart#1594 step 2a)
…t 600 lines (ashhart#1594 step 2a)
…when its plan fails (ashhart#1594 step 2a)
…to main's one-line wording
6604b42 to
6dde01b
Compare
|
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. |
|
Thanks @ThinkOffApp! This is in TensorFold 1.2.4, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.4 |
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 realbackend.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.shlists its modules by hand and stopped building on main at a46c9dd, which moved the fabric's bf16 rounding onto thebf16_roundmodule 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.zigholds the cluster's CUDA module, sozig/build/cuda.zigstays 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, soservenow names the missing Shard first, and a dry run still fails when the plan does.Receipt
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.bench_concurrent.pyandtoken_shado not apply: no token path changes.serve --clusterandnode, and it stops at the agreed plan (rounds come with step 2b).git archiveof 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.shwithTF_MCDMA_SRCat 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.linksparses as before.TF_FABRIC_VERBS=1's opt-in verbs smoke test.tensorfoldruns only the cluster commands here, which need no driver and no GPU.tools/zig/test_fabric.sh, so those ran locally only. They carry most of this PR's tests (see "Tested").Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. Not touched by this change.tools/zig/test_fabric.shwhenTF_MCDMA_SRCnames MCDMA's source.tools/zig/lean_check.py: 424 problems, the same as the base, 0 new.1. The cluster file: a node's library, and each link declared once
config.zig,cluster.schema.json,launch.writeJson,config_test.zig.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.linksarray: the data plane's MCDMA links, each declared once for both ends. A link hasname,kind(tb5orcx5; absent takes whichever connects) andmtu(1024, 2048 or 4096, default 4096), shared by both ends. Per end it hasnode,device,via,portandgid. An end's peer port is the other end's port, and a Thunderbolt bond's devices take consecutive ports from each end'sportand 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.mcdma.zigandtp_settingscheck them:mcdma.Endpointtakes);viais an interface, a slash and the other end's address, one for all devices or one per device;libraryorlinksparses as before, and the fake path (--probes) needs neither.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.2. A node's rank, links and window from the file:
mcdma_link.zigNew file, +225, and its tests, +222.
nodesin the file never moves a rank. So in the first run the GB10 is rank 0 and the Mac rank 1.peer_port; the link's name, kind and path MTU as both ends read them.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.library, and, on a Mac, a ConnectX window and staging past the kext's 64 regions (ported fromtf-mcdma-pair, which refuses the same asTooManyRegions). Two ranks need 2 regions.Opencreates themcdma.Endpointfrom that config and wraps it infabric_link.Link.init(gpa, ep.rdma(), layout), unchanged. Itsdeinitflushes, so the peers hear MCDMA's goodbye.planDigesthashes 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.libraryErrortells 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.Liveruns 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.PlanMismatch, with its digest (for example, two cluster files with different path MTUs connect, then refuse each other instead of running);WrongPeer);NeverSettledat the settle time (60 s);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 frommcdma_link's spec, and prints the links it opened and the agreement.zig/tests/cluster_mcdma_stub.zigruns 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.zigandcli_test.zig,launch.zigandlaunch_test.zig.mcdma_link's digest), then hold.serveholds for--holdseconds (default 0) before saying goodbye;nodeholds 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).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.library, no file there, or not libmcdma-fabric ABI 1.serve MODELchecks only the model it serves, so another model in the file cannot stop it (cluster checkandstatusstill check--modelor every model). A disaggregated model without"nodes"asks a per-node path only of its prefill and decode nodes."bin". serve started each node with a baretensorfold nodeover 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, andtensorfoldfrom 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 andcluster init's writer keep it.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 firstupon hardware found it.nodeandservelooked their flags up by name and ignored the rest, sonode ... --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
tensorfoldprobe.zig,launch.zig,wire.zig,zig/build/cuda.zig,zig/src/cli/cuda_main.zig.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 declaredgpu_limit_gbstill fills it. A missing nvidia-smi or ibv_devinfo is an empty report, not a failed probe.ibv_devinfo -voutput, nowtestdata/gb10-ibv.txt, with its GUID, GIDs and addresses replaced by made-up values),::ffff:a.b.c.dparses 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.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.[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.inventorynow returnsGpuLimitMissingbefore 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 declaredgpu_limit_gbis kept (an explicit 0 is still refused), and MemTotal is not used as a stand-in.tensorfold.zig/build/cuda.zigbuilds the cluster module against CUDA's core, lanes and fabric, andcuda_main.zigdispatchescluster init|check|status,serve --clusterandnodebefore it looks for a model; they need no driver and no GPU. The CUDA binary'snodetakes the same MCDMA path, through the library each node names in the cluster file.zig build testandtest_fabric.shboth 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
mcrdma0, GID index 0rocep1s0f0, firmware 28.45.4028, RoCE v2 GID index 1, active MTU 4096org.mcdma.cx5.native0.1.18mlx5_corefrom that kerneltf-cluster(the Mac's cluster commands) from a cleangit archiveof c1cfa670dtensorfoldbuilt on the GB10 from agit archiveof c1cfa670d with-Dnvccand-Dsm=121One 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.cluster checkandserve --dry-runof the filenodeon both hosts from one cluster file, no serve: both connect and agree; then the GB10's node is stoppedbinand unknown flags refusedmcrdma1at 100G (the port renamed after the enclosure was power cycled) and the GB10'srocep1s0f1at 200G, path MTU 1024Before the launch fix,
upfailed 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
--leaderonly picks the host that runsserveand starts the others over ssh; membership elects its leader by id.Open points
metal_link.zig'sConnectFailedadvice is still Mac-to-Mac wording (left from step 1).Tested
What CI shows and what it does not. The no-GPU workflow (
.github/workflows/no-gpu.yml) runszig build test,test-kernel-contract,test-golden, the security steps and the fuzz targets. It never runstest-cluster,test-tportools/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-clusteris 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.shcould join where MCDMA's source is present.Where and how every count was taken:
test_fabric.sh.-Dhipand-Dvulkanoff; no-Dnvccor-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 ofzig build test) build and run on the Mac.git archiveof 961b52c, an empty cache for each suite (--cache-dirandZIG_GLOBAL_CACHE_DIRforzig build,ZIG_LOCAL_CACHE_DIRandZIG_GLOBAL_CACHE_DIRfortest_fabric.sh), niced, and each suite's own exit code (not a pipe's).At 961b52c:
zig build test(what CI runs): exit 0, 669 of 669 steps, 10305 passed, 0 failed, 84 skipped (10389).test-cuda-hostruns 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).zig build test-cluster115 passed, 0 failed, 6 skipped (121).zig build test-tp71 passed, 0 failed, 3 skipped (74).tools/zig/test_fabric.shwithTF_MCDMA_SRCat 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.