Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c85646f
lfm3 metal: opt in to exact warm turns
ashhart Nov 22, 2026
4a9068f
changelog: #4585 under Unreleased
ashhart Nov 23, 2026
b115771
qwen27 dflash: read and run the 9B's DFlash drafter beside DFlash2
grantoverton Nov 1, 2026
b1454f3
qwen27 served: the serving line names a v1 drafter "DFlash", DFlash2 …
grantoverton Nov 1, 2026
4a03875
qwen27 prompt memory: the planner counts a drafter's own tap planes a…
grantoverton Nov 1, 2026
891467e
qwen27 dflash v1: the ring keeps fused rows, and the full layer sees …
grantoverton Nov 1, 2026
c6d0eea
qwen27 served: the startup line names a v1 drafter "DFlash" too
grantoverton Nov 1, 2026
7dd0f0e
qwen27 lanes: the gathered taps' stride check reads the taps' source,…
ashhart Nov 22, 2026
8243dda
qwen27 dflash v1: the full layers' attention takes main's Shape, whic…
ashhart Nov 22, 2026
713f7a8
qwen27 dflash: retain main behavior beside the v1 drafter
ashhart Nov 23, 2026
a7d35ea
qwen27: grow a slot's K/V as its stream grows (opt-in TF_Q27_KV_GROW)
grantoverton Nov 1, 2026
4229e50
qwen27: free slots give back grown K/V; drafter taps rings grow as used
grantoverton Nov 1, 2026
93cb60f
qwen27: a fresh pass takes its prompt's K/V rows at once (TF_Q27_KV_G…
grantoverton Nov 2, 2026
9e87183
qwen27: adapt K/V growth and DFlash to current main
ashhart Nov 22, 2026
147e803
qwen27 served: format prompt fit setup
ashhart Nov 23, 2026
87fc023
qwen27 served: keep opt-in K/V setup within 600 lines
ashhart Nov 23, 2026
6e43faf
qwen27 served: extract helpers for formatted setup
ashhart Nov 23, 2026
473c0c7
changelog: #1896 under Unreleased
ashhart Nov 23, 2026
c559913
GLM on CUDA: a kept state's disk image on one rank, its parts and whe…
wojo Oct 25, 2026
ad74d2c
GLM on CUDA: --learn-conversations keeps every rank's part of a kept …
wojo Oct 26, 2026
6280c46
rows: a pool that reuses spare storage without trimming it reads a di…
wojo Oct 26, 2026
7713637
rows: a pool that also trims reads a disk state only within its budge…
wojo Oct 27, 2026
8a55948
GLM on CUDA: a disk read's seal refuses ring bases that do not hold t…
wojo Oct 27, 2026
0ecfef3
rows: the grid test runs on both writers, the test's thread and the I…
wojo Oct 27, 2026
ee6530e
GLM on CUDA: --spill-gib and --checkpoint-slots are refused, as --lea…
wojo Oct 28, 2026
a8badce
GLM on CUDA: the disk image downloads through cuda.memory.download, t…
wojo Nov 7, 2026
fd5dcb3
GLM on CUDA: a disk image's words record the world, the layout and th…
wojo Nov 7, 2026
3d4cab0
GLM on CUDA: --learn-conversations opens its store through the shared…
wojo Nov 11, 2026
418e2aa
GLM on CUDA: a disk read sends each block's rows to the other ranks i…
wojo Nov 16, 2026
3ba7bc0
GLM on CUDA: native/cuda.zig names glm_cuda where it compares, keepin…
wojo Nov 16, 2026
4011c5c
glm cuda: the disk ranks test's fake link answers cuLaunchKernelEx to…
ashhart Nov 20, 2026
ddbaa32
changelog: #1411 under Unreleased
ashhart Nov 23, 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
GLM on CUDA: a disk read's seal refuses ring bases that do not hold t…
…he state's rows

An index ring based at `base` holds the rows from `base` up to the state's position, and the image keeps
at most a ring's rows of each. The seal now checks the words' main base against the state's position and
the head's base against its rows, so an image whose words name a ring that starts past them, or too far
back to be held, is refused before the blank state is made whole.
  • Loading branch information
wojo authored and ashhart committed Nov 23, 2026
commit 8a55948df62b51db4f72dbbf51a525540dcd7ef2
18 changes: 18 additions & 0 deletions zig/src/families/glm/cuda_disk_image_test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ test "GLM disk image: a disk read's blank state is refused until sealed, and its
try expectError(error.UnsealedState, snaps.restore(&e, 7));
try expectError(error.DiskWords, snaps.seal(&e, 7, at + @import("cuda_state.zig").window_rows + 1, .{ 0, 0 }, 0)); // a head past its verify window
try expectError(error.DiskWords, snaps.seal(&e, 7, at, .{ 0, 0 }, @as(u64, 1) << @intCast(e.cur.st.cur.len))); // a copy bit no layer has
try expectError(error.DiskWords, snaps.seal(&e, 7, at - 1, .{ at + 1, 0 }, 0)); // a main ring based past the state
try expectError(error.DiskWords, snaps.seal(&e, 7, at - 1, .{ 0, at }, 0)); // a head ring based past its rows
try snaps.seal(&e, 7, at - 1, .{ 3, 5 }, 0b01);
const s = e.snaps.get(7).?;
const sh = try image.Shape.of(&e.cur.st, &e.c, capacity, true);
Expand All @@ -268,6 +270,22 @@ test "GLM disk image: a disk read's blank state is refused until sealed, and its
try expectEqual([2]usize{ 3, 5 }, s.bases);
try std.testing.expectEqualSlices(u1, &.{ 1, 0 }, s.cur);
try expectError(error.StateKept, snaps.seal(&e, 7, at, .{ 0, 0 }, 0));
const far: u32 = capacity - 1024; // a state past the rings' rows
const back: u32 = far - @as(u32, @intCast(e.cur.st.ring_rows)); // the least base whose ring still holds its rows
try snaps.blankAs(&e, 8, far);
defer {
var held = e.snaps.get(8).?;
snaps.free(&e, &held);
}
try expectError(error.DiskWords, snaps.seal(&e, 8, far, .{ back - 1, back }, 0)); // a main ring too far back
try expectError(error.DiskWords, snaps.seal(&e, 8, far, .{ back, back - 1 }, 0)); // a head ring too far back
try snaps.seal(&e, 8, far, .{ back, back }, 0);
try snaps.blankAs(&e, 9, far);
defer {
var held = e.snaps.get(9).?;
snaps.free(&e, &held);
}
try snaps.seal(&e, 9, 0, .{ back, 0 }, 0); // no head rows yet (as without drafts): the main ring holds the state's rows
}

/// A state's store image at `at` for two ranks, rank 1's prefix a copy of rank 0's: what the load's probe gathers.
Expand Down
7 changes: 7 additions & 0 deletions zig/src/families/glm/cuda_snapshots.zig
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,20 @@ pub fn blankAs(e: anytype, id: u64, at: usize) !void {
e.snaps.putAssumeCapacityNoClobber(id, .{ .lease = lease, .len = 0, .pos = at, .mtp_len = 0, .cur = cur, .bases = .{ 0, 0 } });
}

/// Whether an index ring of `rows` rows based at `base` holds every row up to `len`, as the image's ring bytes do.
fn ringHolds(base: usize, len: usize, rows: usize) bool {
return base <= len and len - base <= rows;
}

/// A blank state made whole from its image's words (its bytes are in or follow): a restore takes it from here.
pub fn seal(e: anytype, id: u64, mtp_len: usize, bases: [2]usize, cur: u64) !void {
const s = e.snaps.getPtr(id) orelse return error.NoKeptState;
if (s.len != 0) return error.StateKept;
if (s.cur.len > 64 or (s.cur.len < 64 and cur >> @intCast(s.cur.len) != 0)) return error.DiskWords;
const head = if (e.mtp) @min(e.capacity, s.pos + @import("cuda_state.zig").window_rows) else 0;
if (mtp_len > head) return error.DiskWords;
const rows = e.cur.st.ring_rows;
if (!ringHolds(bases[0], s.pos, rows) or !ringHolds(bases[1], mtp_len, rows)) return error.DiskWords;
const n = try layout.Plan.size(&e.cur.st, &e.c, e.capacity, s.pos, if (e.mtp) mtp_len else null, s.shared);
if (n == 0 or n > s.lease.ids.items.len * pages.page) return error.SnapshotSize;
for (s.cur, 0..) |*b, i| b.* = @intCast(cur >> @intCast(i) & 1);
Expand Down