Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
186 commits
Select commit Hold shift + click to select a range
3688f3c
CUDA keyed graph cache and device arena, both off until a family inst…
jayleaton Oct 10, 2026
b7be793
A failed CUDA kernel launch names its kernel and launch configuration…
jayleaton Oct 10, 2026
faf5901
fix(cuda): correct RDMA VMM capability attribute
jrb-ai Oct 10, 2026
3cc0397
Graph cache: a capture is freed until the map holds it, the keep floo…
jayleaton Oct 11, 2026
c58d83c
CUDA arena: the address maps are rehashed before tombstones fill them
jayleaton Oct 11, 2026
25c02d3
Tensor parallelism across CUDA processes: bootstrap, NCCL, mailbox an…
jayleaton Oct 10, 2026
6b5404d
TP tests: a drain on rank 0 then its clean stop ends rank 1's loop at…
jayleaton Oct 10, 2026
06c4e75
TP RoCE: with no TF_TP_ROCE_HCA, each rank picks the ports on an IPv4…
jayleaton Oct 11, 2026
062af8b
TP README: when -Dtp-nvcc, TF_TP_ROCE_HCA, NCCL_IB_HCA, NCCL_SOCKET_I…
jayleaton Oct 11, 2026
d7510ef
TP test runner: a binary built without the mailbox kernel refuses the…
jayleaton Oct 11, 2026
e16e331
TP RoCE: every RDMA post is bounds-checked before the verb, and peers…
jayleaton Oct 11, 2026
649e788
TP RoCE: no RDMA write past 1 MiB, and boot refuses any setting that …
jayleaton Oct 11, 2026
664a8e2
TP RoCE: TF_TP_ROCE_CHUNKED_KB gathers strides past the slot in slot-…
jayleaton Oct 11, 2026
4ad5029
TP RoCE: a failed transport halts its QPs, drains them and keeps its …
jayleaton Oct 11, 2026
9bbc21a
TP RoCE: tf-tp-test failfast V transport checks the failed-transport …
jayleaton Oct 11, 2026
cf19042
Fix RoCE test smaps lookup for merged mappings
jayleaton Oct 11, 2026
0ba7d30
Sessions: the page map is rehashed before tombstones fill it
jayleaton Oct 11, 2026
0918809
Let a family's round planner drive the lane host with prompt pieces
jayleaton Oct 10, 2026
361f063
Lane host halt: a stop's drain deadline ends the rounds at the next b…
jayleaton Oct 10, 2026
e9f9210
Round planner test: both prompts queue before the host starts, and it…
jayleaton Oct 10, 2026
96ae865
Server hooks for a model family's own chat rules.
jayleaton Oct 10, 2026
df480e0
Server: a stop logs its signal and the open connections when the acce…
jayleaton Oct 10, 2026
2c4d837
Server: SIGTERM / SIGINT drains before stopping.
jayleaton Oct 10, 2026
55bf0a7
Server tests: a stop that lands between a request's count and its dra…
jayleaton Oct 10, 2026
9fbc2b3
Server: a stream that has not sent its first token gets keepalives ev…
jayleaton Oct 10, 2026
bb53ff4
Server tests: the drain test's reply in progress is held until its dr…
jayleaton Oct 10, 2026
9eb765d
DeepSeek-V4.1 host side: release config, EXL3 pack headers, a rank's …
jayleaton Oct 11, 2026
865335e
DeepSeek-V4.1 weight forms built at load, and prepared weight folders…
jayleaton Oct 11, 2026
7ccfc5c
DeepSeek-V4.1 Engram host side: table layout, n-gram hashes of a wind…
jayleaton Oct 11, 2026
b775815
DeepSeek-V4.1 phase timers: where a serving round's time goes, by nam…
jayleaton Oct 11, 2026
def4859
DeepSeek-V4.1 Engram rows from packed per-rank shards on local NVMe, …
jayleaton Oct 11, 2026
c7d29ea
DeepSeek-V4.1 CUDA kernel sources: CSA2 attention and top-k, mHC, rou…
jayleaton Oct 11, 2026
b17df97
DeepSeek-V4.1 kernel tooling: nvcc in a container for any checkout la…
jayleaton Oct 11, 2026
73be75f
DeepSeek-V4.1 kernel launch bindings and their loader: each kernel's …
jayleaton Oct 11, 2026
e687ad5
DeepSeek-V4.1 device kernel tests: tf-dsv41-test, bit-exact against t…
jayleaton Oct 11, 2026
a7674d2
DeepSeek-V4.1 kernel prototypes: attention merge and phase timing, x3…
jayleaton Oct 11, 2026
c0605f0
DeepSeek-V4.1 device-side load: named weights in device buffers, run-…
jayleaton Oct 11, 2026
46bff5e
DeepSeek-V4.1 block emitter: a decode window as calls (attention, the…
jayleaton Oct 11, 2026
6d44dab
CUDA runtime: prioritized streams, external event records, 2D async c…
jayleaton Oct 11, 2026
63e708f
CUDA AOT sets: aot.json specs parsed and matched without cubins, and …
jayleaton Oct 11, 2026
2eeabf7
CUDA memory: a driver allocation count, the arena's first failed chun…
jayleaton Oct 11, 2026
a89bd4f
Graph cache: named caches publish their counts, the floor's state is …
jayleaton Oct 11, 2026
05977fa
Session store: historyOf returns an entry's ids from RAM or from the …
jayleaton Oct 11, 2026
063e855
Graph cache registry: slots claimed, published, released and read und…
jayleaton Oct 11, 2026
d800c62
DeepSeek-V4.1 KV memory: the family's pages, split KV's exchange, the…
jayleaton Oct 11, 2026
bf5a8e8
DeepSeek-V4.1 forward: decode windows over the block emitter, split K…
jayleaton Oct 11, 2026
cd1e3d8
DeepSeek-V4.1 prefill: prompt segments over the prefill emitter, CED …
jayleaton Oct 11, 2026
4b5a078
DeepSeek-V4.1 keyed sampling: the exact host rule, the ranks' pipelin…
jayleaton Oct 11, 2026
1b1e565
DeepSeek-V4.1 drafting, host side: DSpark's chain, cost-derived depth…
jayleaton Oct 11, 2026
18121a3
DeepSeek-V4.1 DSpark on the GPU: the drafting pass as calls, candidat…
jayleaton Oct 11, 2026
f9dab0b
DeepSeek-V4.1 batched rows: several slots in one round, the GPU targe…
jayleaton Oct 11, 2026
f5db10b
DeepSeek-V4.1 serving side: release tokenizer, chat encoding, DSML to…
jayleaton Oct 11, 2026
59af121
DeepSeek-V4.1 served engine and tool: the model at boot, the engine b…
jayleaton Oct 11, 2026
3c93b75
DeepSeek-V4.1 performance extras, host side: side streams, the Engram…
jayleaton Oct 11, 2026
989ca7e
TP RoCE: run_hosts.sh gives NCCL the RoCE picker's ports when neither…
jayleaton Oct 11, 2026
05c5213
Session memory for paged-KV families: page pool, prefix trie, RAM res…
jayleaton Oct 10, 2026
a3303c7
CUDA keyed graph cache and device arena, both off until a family inst…
jayleaton Oct 10, 2026
69e8a65
A failed CUDA kernel launch names its kernel and launch configuration…
jayleaton Oct 10, 2026
d7e89df
fix(cuda): correct RDMA VMM capability attribute
jrb-ai Oct 10, 2026
5826f89
Graph cache: a capture is freed until the map holds it, the keep floo…
jayleaton Oct 11, 2026
5806e55
CUDA arena: the address maps are rehashed before tombstones fill them
jayleaton Oct 11, 2026
d335520
Graph cache: TF_GRAPH_CACHE=0 or off runs every step eagerly in any f…
jayleaton Oct 14, 2026
7ff83d8
Tensor parallelism across CUDA processes: bootstrap, NCCL, mailbox an…
jayleaton Oct 10, 2026
9af2ea2
TP tests: a drain on rank 0 then its clean stop ends rank 1's loop at…
jayleaton Oct 10, 2026
7c9a26e
TP RoCE: with no TF_TP_ROCE_HCA, each rank picks the ports on an IPv4…
jayleaton Oct 11, 2026
8ebb0be
TP README: when -Dtp-nvcc, TF_TP_ROCE_HCA, NCCL_IB_HCA, NCCL_SOCKET_I…
jayleaton Oct 11, 2026
e9e0056
TP test runner: a binary built without the mailbox kernel refuses the…
jayleaton Oct 11, 2026
0472cbf
TP RoCE: every RDMA post is bounds-checked before the verb, and peers…
jayleaton Oct 11, 2026
9688398
TP RoCE: no RDMA write past 1 MiB, and boot refuses any setting that …
jayleaton Oct 11, 2026
72132f0
TP RoCE: TF_TP_ROCE_CHUNKED_KB gathers strides past the slot in slot-…
jayleaton Oct 11, 2026
e65583c
Server hooks for a model family's own chat rules.
jayleaton Oct 10, 2026
bf19238
TP RoCE: a failed transport halts its QPs, drains them and keeps its …
jayleaton Oct 11, 2026
9a486bb
Server: a stop logs its signal and the open connections when the acce…
jayleaton Oct 10, 2026
beae7e8
TP RoCE: tf-tp-test failfast V transport checks the failed-transport …
jayleaton Oct 11, 2026
467504a
Server: SIGTERM / SIGINT drains before stopping.
jayleaton Oct 10, 2026
602aad5
Fix RoCE test smaps lookup for merged mappings
jayleaton Oct 11, 2026
23bf7d8
Server tests: a stop that lands between a request's count and its dra…
jayleaton Oct 10, 2026
890dfc6
TP RoCE: run_hosts.sh gives NCCL the RoCE picker's ports when neither…
jayleaton Oct 11, 2026
5410eac
Session memory for paged-KV families: page pool, prefix trie, RAM res…
jayleaton Oct 10, 2026
a5b8b35
Server: a stream that has not sent its first token gets keepalives ev…
jayleaton Oct 10, 2026
a3e2fb1
TP NCCL: all_reduce's doc says NCCL adds in its ring's order, so its …
jayleaton Oct 14, 2026
0d0bdb2
Sessions: the page map is rehashed before tombstones fill it
jayleaton Oct 11, 2026
2b3cccf
Server tests: the drain test's reply in progress is held until its dr…
jayleaton Oct 10, 2026
62a75ae
TP: keep Linux-only transport host tests off macOS builds
jayleaton Oct 15, 2026
2cf61d3
Sessions: honor zero residency budgets and reserve uncapped requests
jayleaton Oct 15, 2026
9367784
server: keep shared halt and drain on the existing template path
jayleaton Oct 15, 2026
864fe25
Graph cache: effective settings have one digest for ranks to compare …
jayleaton Oct 16, 2026
e2504f6
TP: bootstrap compares the graph cache's effective settings, so a ran…
jayleaton Oct 16, 2026
dcdc30c
Keep the Linux NVMe lane test out of portable host tests
cwschroeder Oct 16, 2026
368a0d3
Keep the Linux NVMe lane test out of portable host tests
cwschroeder Oct 16, 2026
7a6b32f
server: main's drain stop closes the engine without the closed lane-h…
jayleaton Oct 16, 2026
abcad7d
Merge ashhart/main into stack/02-graph-cache-arena
jayleaton Oct 16, 2026
02d455e
Merge stack/02-graph-cache-arena (with ashhart/main) into stack/03-tp…
jayleaton Oct 16, 2026
9266f3f
Merge stack/03-tp-fabric (with ashhart/main) into stack/04-sessions
jayleaton Oct 16, 2026
001ac2e
Merge stack/04-sessions (with ashhart/main) into stack/07-server
jayleaton Oct 16, 2026
33c0ef6
Merge stack/07-server (sessions, TP, graph cache, current main) into …
jayleaton Oct 16, 2026
af0bc53
Server tests: the drain test imports the named json module
jayleaton Oct 16, 2026
7051a3c
Merge stack/07-server's drain-test json import fix into stack/08a-config
jayleaton Oct 16, 2026
e6df8ad
merge origin/main: the round planner and halt on main's split lane host
jayleaton Oct 16, 2026
4da2618
Merge shared/lane-host-core (#861, on current main) into stack/08a-co…
jayleaton Oct 16, 2026
6b9bede
Merge stack/08a-config (current main, shared layers, #861) into stack…
jayleaton Oct 16, 2026
f17db02
Merge stack/08b-engram (current main, shared layers, #861) into stack…
jayleaton Oct 16, 2026
0137ac2
Merge stack/08c-kernels (current main, shared layers, #861) into stac…
jayleaton Oct 16, 2026
cf649ff
Merge stack/08e-block (current main, shared layers, #861) into stack/…
jayleaton Oct 16, 2026
4a02606
Merge stack/08r-runtime (current main, shared layers, #861) into stac…
jayleaton Oct 16, 2026
968a4f2
Merge stack/09a-kv (current main, shared layers, #861) into stack/09b…
jayleaton Oct 16, 2026
1d0b2d7
Merge stack/09b-forward (current main, shared layers, #861) into stac…
jayleaton Oct 16, 2026
ed4239b
Merge stack/10-prefill (current main, shared layers, #861) into stack…
jayleaton Oct 16, 2026
a6bc6c4
Merge stack/11a-sampling (current main, shared layers, #861) into sta…
jayleaton Oct 16, 2026
999755d
Merge stack/11b-draft (current main, shared layers, #861) into stack/…
jayleaton Oct 16, 2026
850f6b2
Merge stack/11c-device-drafts (current main, shared layers, #861) int…
jayleaton Oct 16, 2026
a0d8181
Merge stack/11d-batched-rows (current main, shared layers, #861) into…
jayleaton Oct 16, 2026
d624aa1
Merge stack/12a-serving-host (current main, shared layers, #861, fami…
jayleaton Oct 16, 2026
d2f0223
Merge stack/12b-serving-engine (current main, shared layers, #861, fa…
jayleaton Oct 16, 2026
95f6b4c
DeepSeek-V4.1 sessions: an unset idle residency stays unlimited
jayleaton Oct 16, 2026
3f392a6
Merge stack/11d-batched-rows (unset session residency stays unlimited…
jayleaton Oct 16, 2026
75eae6c
Merge stack/12a-serving-host (unset session residency stays unlimited…
jayleaton Oct 16, 2026
503eeb3
Merge stack/12b-serving-engine (unset session residency stays unlimit…
jayleaton Oct 16, 2026
8900c7c
Sessions: a failed prefix insert leaves the index as it was
jayleaton Oct 17, 2026
3aeebb9
CUDA arena: a reuse whose address-map insertion fails keeps its range…
jayleaton Oct 17, 2026
46161ac
Merge stack/02-graph-cache-arena (the #635 arena fix) into stack/03-t…
jayleaton Oct 17, 2026
78ce706
Merge stack/03-tp-fabric (the #635 arena and #637 prefix fixes) into …
jayleaton Oct 17, 2026
9c5bd60
Merge stack/04-sessions (the #635 arena and #637 prefix fixes) into s…
jayleaton Oct 17, 2026
eaa7953
Merge stack/07-server (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
4370f91
Merge stack/08a-config (the #635 arena and #637 prefix fixes) into st…
jayleaton Oct 17, 2026
a0f9598
Merge stack/08b-engram (the #635 arena and #637 prefix fixes) into st…
jayleaton Oct 17, 2026
98a1695
Merge stack/08c-kernels (the #635 arena and #637 prefix fixes) into s…
jayleaton Oct 17, 2026
28e33cc
Merge stack/08e-block (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
f5a0b8b
Merge the layer below (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
3b7681f
Merge the layer below (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
334ce65
Merge the layer below (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
6b97211
Merge the layer below (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
fc25bef
Merge the layer below (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
c58f30c
Merge the layer below (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
d46405c
Merge the layer below (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
87d7912
Merge the layer below (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
ada4b74
Merge the layer below (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
9002037
Merge the layer below (the #635 arena and #637 prefix fixes) into sta…
jayleaton Oct 17, 2026
88418d8
test(tp): reject malformed runner commands before configuration
cwschroeder Oct 17, 2026
4c69b0d
fix(tp): parse runner commands before opening sessions
cwschroeder Oct 17, 2026
4df28ce
test(tp): retain verbs load failures in HCA diagnostics
cwschroeder Oct 17, 2026
0a80da0
fix(tp): distinguish verbs load errors from absent HCA ports
cwschroeder Oct 17, 2026
999cb03
Merge stack/03-tp-fabric (adopted #636 runner CLI validation and HCA …
jayleaton Oct 18, 2026
5f14a64
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
749240a
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
7122563
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
6390cf1
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
829c4c9
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
b81382d
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
2be028e
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
e47ed0e
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
e548a60
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
2fc04e3
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
92ff736
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
043a4c8
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
5ebfcdd
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
956febe
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
d9df51c
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
4a5263d
Merge the layer below (adopted #636 runner CLI validation and HCA ver…
jayleaton Oct 18, 2026
cdde1a4
Merge ashhart/main (1.1.0, 76aafcf2) into stack/02-graph-cache-arena
jayleaton Oct 18, 2026
adbdb8a
CUDA launches: a not-ready launch returns NotReady unlogged, as Drive…
jayleaton Oct 18, 2026
3bd6a6a
Merge stack/02-graph-cache-arena (adbdb8ab, main 76aafcf2) into stack…
jayleaton Oct 18, 2026
54141a1
Merge stack/03-tp-fabric (3bd6a6ab, main 76aafcf2) into stack/04-sess…
jayleaton Oct 18, 2026
80d4ed5
Merge stack/04-sessions (54141a1e, main 76aafcf2) into stack/07-server
jayleaton Oct 18, 2026
aebceae
Merge stack/07-server (80d4ed5c, main 76aafcf2) into stack/08a-config
jayleaton Oct 18, 2026
1003f08
Build: DeepSeek-V4.1's host tests on hosts other than Windows, whose …
jayleaton Oct 18, 2026
aa96782
Merge stack/08a-config (1003f08f, main 76aafcf2) into stack/08b-engram
jayleaton Oct 18, 2026
3f758dc
Merge stack/08b-engram (aa967828, main 76aafcf2) into stack/08c-kernels
jayleaton Oct 18, 2026
ea54d42
Merge stack/08c-kernels (3f758dcf, main 76aafcf2) into stack/08e-block
jayleaton Oct 18, 2026
d6190dc
Merge stack/08e-block (ea54d42d, main 76aafcf2) into stack/08r-runtime
jayleaton Oct 18, 2026
6742872
Merge stack/08r-runtime (d6190dcf, main 76aafcf2) into stack/09a-kv
jayleaton Oct 18, 2026
a88da5d
Build: DeepSeek-V4.1's KV host tests also skip Windows, like the fami…
jayleaton Oct 18, 2026
696e58a
Merge stack/09a-kv (a88da5de, main 76aafcf2) into stack/09b-forward
jayleaton Oct 18, 2026
4ac0c37
Merge stack/09b-forward (696e58a7, main 76aafcf2) into stack/10-prefill
jayleaton Oct 18, 2026
a4ca6d3
Merge stack/10-prefill (4ac0c37d, main 76aafcf2) into stack/11a-sampling
jayleaton Oct 18, 2026
5e6e8c6
Merge stack/11a-sampling (a4ca6d39, main 76aafcf2) into stack/11b-draft
jayleaton Oct 18, 2026
3f0fc40
Merge stack/11b-draft (5e6e8c68, main 76aafcf2) into stack/11c-device…
jayleaton Oct 18, 2026
5faa948
Merge stack/11c-device-drafts (3f0fc404, main 76aafcf2) into stack/11…
jayleaton Oct 18, 2026
c24b124
Merge stack/11d-batched-rows (5faa9489, main 76aafcf2) into stack/12a…
jayleaton Oct 18, 2026
c14a40a
Merge stack/12a-serving-host (c24b124d, main 76aafcf2) into stack/12b…
jayleaton Oct 18, 2026
7169718
Merge stack/12b-serving-engine (c14a40a0, main 76aafcf2) into stack/1…
jayleaton Oct 18, 2026
ab2fa63
DeepSeek-V4.1 serving tests: TF_DSV41_MODEL and TF_DSV41_GOLDEN throu…
jayleaton Oct 18, 2026
b04302a
Merge stack/12a-serving-host (ab2fa636: DeepSeek-V4.1 serving tests r…
jayleaton Oct 18, 2026
232f69e
Merge stack/12b-serving-engine (b04302a7: DeepSeek-V4.1 serving tests…
jayleaton Oct 18, 2026
ba8856a
Build: tensorfold-dsv41's checkpoint CLI imports core, as main's chec…
jayleaton Oct 18, 2026
45d5b13
Merge stack/12b-serving-engine (ba8856a7: tensorfold-dsv41's checkpoi…
jayleaton Oct 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion zig/build/tp.zig
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ fn kernelModule(b: *std.Build, image: ?std.Build.LazyPath) *std.Build.Module {

pub fn add(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, test_step: *std.Build.Step) void {
const host = b.graph.host;
const cli_tests = b.addRunArtifact(b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = b.path("zig/src/fabric/tp/gpu_cli.zig"), .target = host, .optimize = optimize }) }));
const cli_step = b.step("test-tp-cli", "TP runner command validation (no GPU)");
cli_step.dependOn(&cli_tests.step);
test_step.dependOn(&cli_tests.step);
if (host.result.os.tag == .linux) {
const tests = b.addRunArtifact(b.addTest(.{ .root_module = module(b, host, .debug, runtime(b, host, .debug)) }));
b.step("test-tp", "Tensor parallelism's host tests: bootstrap, fate channel, in-process ranks (no GPU)").dependOn(&tests.step);
const tp_step = b.step("test-tp", "Tensor parallelism's host tests: bootstrap, fate channel, in-process ranks (no GPU)");
tp_step.dependOn(&tests.step);
tp_step.dependOn(cli_step);
test_step.dependOn(&tests.step);
}
if (target.result.os.tag != .linux) return;
Expand All @@ -56,6 +62,27 @@ pub fn add(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builti
runner.addImport("tp", module(b, target, optimize, cuda));
runner.addImport("tp_kernel", kernelModule(b, image));
const exe = b.addExecutable(.{ .name = "tf-tp-test", .root_module = runner });
if (host.result.os.tag == .linux and target.query.isNative()) {
const cli = @import("../src/fabric/tp/gpu_cli.zig");
for (cli.invalid) |args| {
const check = b.addRunArtifact(exe);
check.addArgs(args);
check.setEnvironmentVariable("TF_TP_WORLD", "invalid");
check.expectExitCode(2);
check.expectStdErrEqual(cli.usage);
cli_step.dependOn(&check.step);
test_step.dependOn(&check.step);
}
if (image == null) {
const kernel = b.addRunArtifact(exe);
kernel.addArg("kernel");
kernel.setEnvironmentVariable("TF_TP_WORLD", "invalid");
kernel.expectExitCode(1);
kernel.expectStdErrEqual("mailbox kernel 0 B\n");
cli_step.dependOn(&kernel.step);
test_step.dependOn(&kernel.step);
}
}
b.installArtifact(exe);
b.step("tf-tp-test", "TP=2 on two GPUs: bootstrap, every collective bit-exact, graph capture, fail-fast, latency").dependOn(&b.addInstallArtifact(exe, .{}).step);
}
66 changes: 66 additions & 0 deletions zig/src/fabric/tp/gpu_cli.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//! Validate the runner's command before opening a driver, bootstrap or fate channel.
const std = @import("std");

pub const usage = "usage: tf-tp-test suite | failfast RANK fatal|kill|transport [N [HOLD_S]] | roce-host | hca | kernel\n";
pub const Mode = enum { fatal, kill, transport };
pub const Failure = struct { victim: u32, mode: Mode, n: u32 = 50, hold: ?u32 = null };
pub const Command = union(enum) { suite, failfast: Failure, @"roce-host", hca, kernel };

pub fn parse(args: []const []const u8) error{InvalidArguments}!Command {
if (args.len == 0) return error.InvalidArguments;
const tag = std.meta.stringToEnum(std.meta.Tag(Command), args[0]) orelse return error.InvalidArguments;
switch (tag) {
.suite, .@"roce-host", .hca, .kernel => {
if (args.len != 1) return error.InvalidArguments;
return switch (tag) {
.suite => .suite,
.@"roce-host" => .@"roce-host",
.hca => .hca,
.kernel => .kernel,
else => unreachable,
};
},
.failfast => {
if (args.len < 3 or args.len > 5) return error.InvalidArguments;
const mode = std.meta.stringToEnum(Mode, args[2]) orelse return error.InvalidArguments;
if (mode != .transport and args.len != 3) return error.InvalidArguments;
return .{ .failfast = .{
.victim = try number(args[1]),
.mode = mode,
.n = if (args.len > 3) try number(args[3]) else 50,
.hold = if (args.len > 4) try number(args[4]) else null,
} };
},
}
}

fn number(s: []const u8) error{InvalidArguments}!u32 {
return std.fmt.parseInt(u32, s, 10) catch error.InvalidArguments;
}

// Also executed against the Linux entry point with an invalid environment, before any CUDA work.
pub const invalid = [_][]const []const u8{
&.{}, &.{"UNKNOWN"}, &.{ "suite", "extra" }, &.{ "kernel", "extra" },
&.{ "hca", "extra" }, &.{ "roce-host", "extra" }, &.{"failfast"}, &.{ "failfast", "0" },
&.{ "failfast", "0", "typo" }, &.{ "failfast", "bad", "fatal" }, &.{ "failfast", "-1", "kill" }, &.{ "failfast", "4294967296", "fatal" },
&.{ "failfast", "0", "fatal", "50" }, &.{ "failfast", "0", "kill", "50" }, &.{ "failfast", "0", "transport", "bad" }, &.{ "failfast", "0", "transport", "50", "bad" },
&.{ "failfast", "0", "transport", "50", "0", "extra" },
};

test "invalid commands are refused before resources open" {
for (invalid) |args| try std.testing.expectError(error.InvalidArguments, parse(args));
}

test "documented commands and failfast defaults" {
inline for (.{ "suite", "roce-host", "hca", "kernel" }) |name| {
try std.testing.expectEqualStrings(name, @tagName(try parse(&.{name})));
}
inline for (.{ Mode.fatal, Mode.kill, Mode.transport }) |mode| {
const f = (try parse(&.{ "failfast", "2", @tagName(mode) })).failfast;
try std.testing.expectEqualDeep(Failure{ .victim = 2, .mode = mode }, f);
}
const explicit = (try parse(&.{ "failfast", "63", "transport", "0", "0" })).failfast;
try std.testing.expectEqualDeep(Failure{ .victim = 63, .mode = .transport, .n = 0, .hold = 0 }, explicit);
const n = (try parse(&.{ "failfast", "1", "transport", "123" })).failfast;
try std.testing.expectEqualDeep(Failure{ .victim = 1, .mode = .transport, .n = 123 }, n);
}
41 changes: 22 additions & 19 deletions zig/src/fabric/tp/gpu_main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@ const tp = @import("tp");
const tp_kernel = @import("tp_kernel");
const checks = @import("gpu_checks.zig");
const bench = @import("gpu_bench.zig");
const cli = @import("gpu_cli.zig");

const max_bytes = (4 << 20) + 4096;

pub fn main(init: std.process.Init) !u8 {
const args = try init.minimal.args.toSlice(init.arena.allocator());
if (args.len < 2) {
std.debug.print("usage: tf-tp-test suite | failfast RANK fatal|kill|transport [N [HOLD_S]] | roce-host | hca | kernel\n", .{});
const command = cli.parse(args[1..]) catch {
std.debug.print("{s}", .{cli.usage});
return 2;
}
};
// `kernel`: whether the build embeds the mailbox kernel (-Dtp-nvcc or -Dtp-fatbin), for scripts to check first
if (std.mem.eql(u8, args[1], "kernel")) {
if (command == .kernel) {
std.debug.print("mailbox kernel {d} B\n", .{tp_kernel.mailbox.len});
return if (tp_kernel.mailbox.len > 0) 0 else 1;
}
const cfg = try tp.Config.fromEnv();
if (std.mem.eql(u8, args[1], "roce-host")) return @import("roce_host.zig").run(cfg, init.gpa);
if (std.mem.eql(u8, args[1], "hca")) return hca(cfg, init.io);
if (std.mem.eql(u8, args[1], "failfast") and (!cfg.failfast or args.len > 5) and !hostOnlyAllowed(cfg)) {
if (command == .@"roce-host") return @import("roce_host.zig").run(cfg, init.gpa);
if (command == .hca) return hca(cfg, init.io);
if (command == .failfast and (!cfg.failfast or command.failfast.hold != null) and !hostOnlyAllowed(cfg)) {
std.debug.print("REFUSED: failfast with TF_TP_FAILFAST=0 or a hold is host-only: TF_TP_ALLOW_HOST_ONLY=1 and no RDMA wire\n", .{});
return 2;
}
Expand All @@ -40,15 +41,14 @@ pub fn main(init: std.process.Init) !u8 {
try s.open(&driver, cfg, tp_kernel.mailbox);
const up_ms = @as(f64, @floatFromInt(tp.sock.nowNs() - t0)) / 1e6;
std.debug.print("INFO rank {d}/{d} on {s} (sm_{d}), backend {t}, mailbox kernel {d} B, bootstrap + NCCL init {d:.0} ms\n", .{ cfg.rank, cfg.world, try ctx.name(&name_buf), try ctx.capability(), s.comm().kind(), tp_kernel.mailbox.len, up_ms });
if (std.mem.eql(u8, args[1], "suite")) return suite(&s, &driver, init.gpa, cfg);
if (std.mem.eql(u8, args[1], "failfast") and args.len >= 4 and std.mem.eql(u8, args[3], "transport")) {
const n = if (args.len > 4) try std.fmt.parseInt(u32, args[4], 10) else 50;
const hold = if (args.len > 5) try std.fmt.parseInt(u32, args[5], 10) else 0;
return @import("gpu_transport.zig").run(&s, &driver, init.gpa, cfg, try std.fmt.parseInt(u32, args[2], 10), n, hold);
}
if (std.mem.eql(u8, args[1], "failfast") and args.len == 4) return failfast(&s, &driver, init.gpa, cfg, try std.fmt.parseInt(u32, args[2], 10), args[3]);
std.debug.print("unknown command {s}\n", .{args[1]});
return 2;
return switch (command) {
.suite => suite(&s, &driver, init.gpa, cfg),
.failfast => |f| if (f.mode == .transport)
@import("gpu_transport.zig").run(&s, &driver, init.gpa, cfg, f.victim, f.n, f.hold orelse 0)
else
failfast(&s, &driver, init.gpa, cfg, f.victim, @tagName(f.mode)),
else => unreachable,
};
}

/// `hca` (host only, no GPU): both ranks' RoCE pick over the bootstrap; this rank's `NCCL_IB_HCA=...` line on stdout.
Expand All @@ -73,10 +73,13 @@ fn hca(cfg: tp.Config, io: std.Io) !u8 {
var buf: [tp.roce_pick.list_bytes + 16]u8 = undefined;
const line = tp.roce_pick.hcaLine(pick, &specs, &buf) catch |e| {
const why = switch (e) {
error.NoRoceDevice => "no active Ethernet RDMA port with an IPv4 RoCE v2 GID on this host",
error.NoSharedSubnet => "no RoCE port here shares an IPv4 /24 with the peer's",
error.LibraryUnavailable => "could not load libibverbs.so.1 (LibraryUnavailable); check the RDMA userspace installation",
error.MissingSymbol => "libibverbs.so.1 lacks required symbols (MissingSymbol); check the RDMA userspace installation",
error.NoRoceDevice => "no active Ethernet RDMA port with an IPv4 RoCE v2 GID on this host: name the peer's ports in TF_TP_ROCE_HCA or NCCL_IB_HCA",
error.NoSharedSubnet => "no RoCE port here shares an IPv4 /24 with the peer's: name the peer's ports in TF_TP_ROCE_HCA or NCCL_IB_HCA",
else => @errorName(e),
};
std.debug.print("FAIL hca rank {d}: {s}: name the peer's ports in TF_TP_ROCE_HCA or NCCL_IB_HCA\n", .{ cfg.rank, why });
std.debug.print("FAIL hca rank {d}: {s}\n", .{ cfg.rank, why });
return 1;
};
var names: [tp.roce_pick.list_bytes]u8 = undefined;
Expand Down
82 changes: 72 additions & 10 deletions zig/src/fabric/tp/roce_pick.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ const bootstrap = @import("bootstrap.zig");
const sock = @import("sock.zig");
const Config = @import("config.zig").Config;
const Verbs = @import("verbs").Verbs;
const OpenFn = *const fn (?[:0]const u8) @import("verbs").Error!Verbs;

/// Ports a rank lists to its peers (a DGX Spark's ConnectX-7 shows four RDMA devices).
pub const max_ports = 8;
const blob_bytes = 1 + 4 * max_ports;

/// How many devices, and how: on a /24 the peer shares (`shared`), named by TF_TP_ROCE_HCA (`explicit`), or neither.
pub const Pick = struct { n: usize, shared: bool, explicit: bool = false };
pub const Pick = struct {
n: usize,
shared: bool,
explicit: bool = false,
verbs_open_error: ?@import("verbs").Error = null,
};

fn usable(p: rv.Port) bool {
return p.active and p.ethernet and p.ipv4 != null;
Expand Down Expand Up @@ -90,14 +96,23 @@ pub fn resolve(cfg: Config, b: *bootstrap.Bootstrap, out: *[rv.max_hcas]rv.HcaSp

/// `resolve` with how the devices were chosen, over this host's ports (a collective, as `resolve`).
pub fn select(cfg: Config, b: *bootstrap.Bootstrap, out: *[rv.max_hcas]rv.HcaSpec) !Pick {
return selectWithOpen(cfg, b, out, Verbs.open);
}

fn selectWithOpen(cfg: Config, b: *bootstrap.Bootstrap, out: *[rv.max_hcas]rv.HcaSpec, open: OpenFn) !Pick {
var ports: [max_ports]rv.Port = undefined;
var n_ports: usize = 0;
if (Verbs.open(null)) |opened| {
var open_error: ?@import("verbs").Error = null;
if (open(null)) |opened| {
var v = opened;
defer v.close();
n_ports = rv.scanPorts(&v, &ports);
} else |_| {}
return selectFrom(cfg, b, ports[0..n_ports], out);
} else |e| {
open_error = e;
}
var pick = try selectFrom(cfg, b, ports[0..n_ports], out);
pick.verbs_open_error = open_error;
return pick;
}

/// `select` over given ports (the scan's, or a test's fixture ports).
Expand Down Expand Up @@ -135,11 +150,14 @@ pub const HcaError = error{
NoRoceDevice,
/// this host's ports share no IPv4 /24 with the peer's: NCCL would not reach the peer on them either
NoSharedSubnet,
};
} || @import("verbs").Error;

/// `tf-tp-test hca`'s line for run_hosts.sh: `NCCL_IB_HCA=` the picked devices; never the first local ports alone.
pub fn hcaLine(pick: Pick, specs: []const rv.HcaSpec, buf: *[list_bytes + 16]u8) HcaError![]const u8 {
if (pick.n == 0) return error.NoRoceDevice;
if (pick.n == 0) {
if (pick.verbs_open_error) |e| return e;
return error.NoRoceDevice;
}
if (!pick.shared and !pick.explicit) return error.NoSharedSubnet;
const prefix = "NCCL_IB_HCA=";
@memcpy(buf[0..prefix.len], prefix);
Expand Down Expand Up @@ -338,33 +356,77 @@ test "the port scan reads a host's devices through verbs: state, Ethernet, the I
}

/// One rank's `selectFrom` over a real bootstrap (rank 0 on `l`), its hca line or error into `out`.
fn hcaRank(cfg: Config, l: ?sock.Fd, ports: []const rv.Port, out: *[list_bytes + 16]u8, line: *HcaError![]const u8, err: *?anyerror) void {
fn hcaRank(cfg: Config, l: ?sock.Fd, ports: []const rv.Port, open: ?OpenFn, out: *[list_bytes + 16]u8, line: *HcaError![]const u8, err: *?anyerror) void {
var b = (if (l) |fd| bootstrap.Bootstrap.acceptOn(fd, 2, 5 * std.time.ns_per_s) else bootstrap.Bootstrap.open(cfg)) catch |e| {
err.* = e;
return;
};
defer b.close();
var specs: [rv.max_hcas]rv.HcaSpec = undefined;
const pick = selectFrom(cfg, &b, ports, &specs) catch |e| {
const pick = (if (open) |f| selectWithOpen(cfg, &b, &specs, f) else selectFrom(cfg, &b, ports, &specs)) catch |e| {
err.* = e;
return;
};
line.* = hcaLine(pick, &specs, out);
}

fn hcaPair(cfgs: [2]Config, ports: [2][]const rv.Port, lines: *[2]HcaError![]const u8, bufs: *[2][list_bytes + 16]u8) !void {
return hcaPairWithOpen(cfgs, ports, .{ null, null }, lines, bufs);
}

fn hcaPairWithOpen(cfgs: [2]Config, ports: [2][]const rv.Port, open: [2]?OpenFn, lines: *[2]HcaError![]const u8, bufs: *[2][list_bytes + 16]u8) !void {
const l = try bootstrap.testListener();
defer sock.close(l.fd);
var errs: [2]?anyerror = @splat(null);
var c1 = cfgs[1];
c1.link_port = l.port;
c1.connect_timeout_ns = 5 * std.time.ns_per_s;
const t = try std.Thread.spawn(.{}, hcaRank, .{ c1, null, ports[1], &bufs[1], &lines[1], &errs[1] });
hcaRank(cfgs[0], l.fd, ports[0], &bufs[0], &lines[0], &errs[0]);
const t = try std.Thread.spawn(.{}, hcaRank, .{ c1, null, ports[1], open[1], &bufs[1], &lines[1], &errs[1] });
hcaRank(cfgs[0], l.fd, ports[0], open[0], &bufs[0], &lines[0], &errs[0]);
t.join();
for (errs) |e| if (e) |x| return x;
}

fn missingLibrary(_: ?[:0]const u8) @import("verbs").Error!Verbs {
return error.LibraryUnavailable;
}

fn missingSymbol(_: ?[:0]const u8) @import("verbs").Error!Verbs {
return error.MissingSymbol;
}

test "hca keeps a verbs load failure while completing the peer's port exchange" {
var lines: [2]HcaError![]const u8 = undefined;
var bufs: [2][list_bytes + 16]u8 = undefined;
var scanned: [max_ports]rv.Port = undefined;
const peer = ScanFixture.scan(&hosts[1], &scanned);
const cfgs: [2]Config = .{ .{ .rank = 0 }, .{ .rank = 1 } };
try hcaPairWithOpen(cfgs, .{ &.{}, peer }, .{ missingLibrary, null }, &lines, &bufs);
try std.testing.expectError(error.LibraryUnavailable, lines[0]);
try std.testing.expectError(error.NoSharedSubnet, lines[1]);
}

test "hca distinguishes missing verbs symbols from an empty successful scan" {
const cfg: Config = .{ .world = 1 };
var b = try bootstrap.Bootstrap.open(cfg);
defer b.close();
var specs: [rv.max_hcas]rv.HcaSpec = undefined;
var buf: [list_bytes + 16]u8 = undefined;
const pick = try selectWithOpen(cfg, &b, &specs, missingSymbol);
try std.testing.expectError(error.MissingSymbol, hcaLine(pick, &specs, &buf));
try std.testing.expectError(error.NoRoceDevice, hcaLine(try selectFrom(cfg, &b, &.{}, &specs), &specs, &buf));
}

test "hca keeps an explicit list when the verbs scan cannot open its library" {
const cfg: Config = .{ .world = 1, .roce_hca = "fx_rocep1s0f0:3" };
var b = try bootstrap.Bootstrap.open(cfg);
defer b.close();
var specs: [rv.max_hcas]rv.HcaSpec = undefined;
var buf: [list_bytes + 16]u8 = undefined;
const pick = try selectWithOpen(cfg, &b, &specs, missingLibrary);
try std.testing.expectEqualStrings("NCCL_IB_HCA=fx_rocep1s0f0\n", try hcaLine(pick, &specs, &buf));
}

test "hca over a real bootstrap: both ranks print their peer-linked ports; an explicit rank keeps its list; no ports fail both" {
var lines: [2]HcaError![]const u8 = undefined;
var bufs: [2][list_bytes + 16]u8 = undefined;
Expand Down
Loading