Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
864fe25
Graph cache: effective settings have one digest for ranks to compare …
jayleaton Oct 16, 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
bf19238
TP RoCE: a failed transport halts its QPs, drains them and keeps its …
jayleaton Oct 11, 2026
beae7e8
TP RoCE: tf-tp-test failfast V transport checks the failed-transport …
jayleaton Oct 11, 2026
602aad5
Fix RoCE test smaps lookup for merged mappings
jayleaton Oct 11, 2026
890dfc6
TP RoCE: run_hosts.sh gives NCCL the RoCE picker's ports when neither…
jayleaton Oct 11, 2026
a3e2fb1
TP NCCL: all_reduce's doc says NCCL adds in its ring's order, so its …
jayleaton Oct 14, 2026
62a75ae
TP: keep Linux-only transport host tests off macOS builds
jayleaton Oct 15, 2026
e2504f6
TP: bootstrap compares the graph cache's effective settings, so a ran…
jayleaton Oct 16, 2026
5410eac
Session memory for paged-KV families: page pool, prefix trie, RAM res…
jayleaton Oct 10, 2026
0d0bdb2
Sessions: the page map is rehashed before tombstones fill it
jayleaton Oct 11, 2026
2cf61d3
Sessions: honor zero residency budgets and reserve uncapped requests
jayleaton Oct 15, 2026
dcdc30c
Keep the Linux NVMe lane test out of portable host tests
cwschroeder Oct 16, 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
Prev Previous commit
Next Next commit
Sessions: honor zero residency budgets and reserve uncapped requests
Use null for unlimited residency, retain portable bookkeeping tests on macOS, and run the Linux NVMe tier tests only on Linux.
  • Loading branch information
jayleaton committed Oct 16, 2026
commit 2cf61d3cbaa2df71b1c369f8d1f73c423cfec8ae
13 changes: 10 additions & 3 deletions zig/build/sessions.zig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Session memory's build: the family-neutral `sessions` module (zig/src/sessions) and its host tests on any OS.
//! Session memory: portable bookkeeping tests everywhere, NVMe tier tests on Linux.

const std = @import("std");

Expand All @@ -7,7 +7,14 @@ pub fn module(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.bui
}

pub fn add(b: *std.Build, test_step: *std.Build.Step) void {
const run = b.addRunArtifact(b.addTest(.{ .root_module = module(b, b.graph.host, .debug) }));
b.step("test-sessions", "Session memory's host tests: pool, prefix trie, RAM tier, NVMe tier on real files (no GPU)").dependOn(&run.step);
const host = b.graph.host;
const tests = if (host.result.os.tag == .linux) module(b, host, .debug) else b.createModule(.{
.root_source_file = b.path("zig/src/sessions/portable_test.zig"),
.target = host,
.optimize = .debug,
.link_libc = true,
});
const run = b.addRunArtifact(b.addTest(.{ .root_module = tests }));
b.step("test-sessions", "Session memory's host tests: pool, prefix trie, RAM tier, NVMe tier on Linux (no GPU)").dependOn(&run.step);
test_step.dependOn(&run.step);
}
11 changes: 10 additions & 1 deletion zig/src/sessions/pool.zig
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ pub const Pool = struct {

/// Pages an admission needs for a request (prompt + reply + slack, at most the slot's capacity).
pub fn needPages(p: *const Pool, prompt: u64, max_tokens: u64, capacity: u64, slack: u64) u32 {
return pagesFor(@min(prompt + max_tokens + slack, capacity), p.page);
const total = prompt + max_tokens + slack;
return pagesFor(if (capacity == 0) total else @min(total, capacity), p.page);
}

/// This rank stores the split families' rows of page pg.
Expand Down Expand Up @@ -473,3 +474,11 @@ test "residues, holders, quotas and the device tables" {
try std.testing.expectEqual(@as(u16, 3), p.holders(b.pages[0]));
try std.testing.expectEqual(@as(u32, 0), c.pages[2] % 2);
}

test "admission without a capacity still reserves prompt, reply and slack pages" {
var p = try Pool.init(std.testing.allocator, .{ .families = &.{}, .page = 64 }, 1024, 1, 0);
defer p.deinit();
try std.testing.expectEqual(@as(u32, 3), p.needPages(65, 64, 0, 1));
try std.testing.expectEqual(@as(u32, 1), p.needPages(65, 64, 64, 1));
try std.testing.expectEqual(@as(u32, 0), p.needPages(0, 0, 0, 0));
}
8 changes: 8 additions & 0 deletions zig/src/sessions/portable_test.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//! Portable session bookkeeping tests; the Linux NVMe tier is tested separately.
test {
_ = @import("freeset.zig");
_ = @import("pool.zig");
_ = @import("pagestore.zig");
_ = @import("prefix.zig");
_ = @import("format.zig");
}
12 changes: 6 additions & 6 deletions zig/src/sessions/store.zig
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ pub const Bounded = struct {
pub const Policy = struct {
/// bounded state the RAM tier keeps (least recently used entries go past it)
ram_bytes: u64 = 512 << 20,
/// idle chats resident in the pool (0: no limit) and pool bytes held by entries alone (0: no limit)
chats: u32 = 0,
resident_bytes: u64 = 0,
/// Idle chats and entry-only pool bytes: null is unlimited; zero retains no idle residency.
chats: ?u32 = null,
resident_bytes: ?u64 = null,
/// park an evicted chat's older turns too (default: drop them, the leaf's file covers them)
park_prefixes: bool = false,
/// drop, never write, an entry a newer entry of its chain covers
Expand Down Expand Up @@ -479,7 +479,7 @@ pub const Store = struct {
/// Evicts LRU idle chats past the residency budget (leaf parked, unshared older turns dropped); returns how many.
pub fn enforce(s: *Store) !u32 {
const pol = s.policy;
if (pol.chats == 0 and pol.resident_bytes == 0) return 0;
if (pol.chats == null and pol.resident_bytes == null) return 0;
var chats: std.ArrayList(Chat) = .empty;
defer chats.deinit(s.gpa);
var members: std.ArrayList(u32) = .empty;
Expand All @@ -494,8 +494,8 @@ pub const Store = struct {
var idle: u32 = @intCast(chats.items.len);
var gone: u32 = 0;
for (chats.items) |c| {
const over_n = pol.chats > 0 and idle > pol.chats;
const over_b = pol.resident_bytes > 0 and s.pool.entryOnlyBytes() > pol.resident_bytes;
const over_n = if (pol.chats) |limit| idle > limit else false;
const over_b = if (pol.resident_bytes) |limit| s.pool.entryOnlyBytes() > limit else false;
if (!over_n and !over_b) break;
if (!s.index.get(c.leaf).ram or !s.idleLeaf(c.leaf)) continue;
members.clearRetainingCapacity();
Expand Down
25 changes: 25 additions & 0 deletions zig/src/sessions/store_test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,28 @@ test "two split ranks make the same decisions on the same calls and each restore
try restart(gpa, root, 2, 1);
try testing.expectEqualSlices(u64, t0.items, t1.items);
}

test "zero chat or byte budgets evict idle residency while null remains unlimited" {
const gpa = testing.allocator;
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
const root = try tmpRoot(gpa, &tmp, "zero-budget");
defer gpa.free(root);
var r: Rank = undefined;
try r.init(gpa, root, 1, 0, .{});
defer r.deinit();
const slot = try r.pool.newSlot(64 * page);
const ids = try chatIds(gpa, 1, 5 * page);
defer gpa.free(ids);
_ = try turn(gpa, &r, slot, 1, ids);
try testing.expectEqual(@as(u32, 1), r.store.resident().chats);
r.store.policy.chats = 0;
try testing.expectEqual(@as(u32, 1), try r.store.enforce());
try testing.expectEqual(@as(u32, 0), r.store.resident().chats);
r.store.policy.chats = null;
_ = try turn(gpa, &r, slot, 1, ids);
try testing.expect(r.store.resident().bytes > 0);
r.store.policy.resident_bytes = 0;
try testing.expectEqual(@as(u32, 1), try r.store.enforce());
try testing.expectEqual(@as(u64, 0), r.store.resident().bytes);
}