Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
34abe6e
GLM on CUDA: a kept state's disk image on one rank, its parts and whe…
wojo Oct 25, 2026
4c13cdc
GLM on CUDA: --learn-conversations keeps every rank's part of a kept …
wojo Oct 26, 2026
d11c45c
rows: a pool that reuses spare storage without trimming it reads a di…
wojo Oct 26, 2026
8dffa1e
rows: a pool that also trims reads a disk state only within its budge…
wojo Oct 27, 2026
a59fe66
GLM on CUDA: a disk read's seal refuses ring bases that do not hold t…
wojo Oct 27, 2026
58190c3
rows: the grid test runs on both writers, the test's thread and the I…
wojo Oct 27, 2026
ad865ea
GLM on CUDA: --spill-gib and --checkpoint-slots are refused, as --lea…
wojo Oct 28, 2026
dd0785e
GLM on CUDA: the disk image downloads through cuda.memory.download, t…
wojo Nov 7, 2026
7c52041
GLM on CUDA: a disk image's words record the world, the layout and th…
wojo Nov 7, 2026
583fd51
GLM on CUDA: --learn-conversations opens its store through the shared…
wojo Nov 11, 2026
294275b
native cuda: GLM's disk hooks name glm_cuda inline, keeping cuda.zig …
wojo Nov 14, 2026
9b5f945
kv_pool: owner classes, DeepSeek's residue book: a lease takes every …
wojo Nov 7, 2026
0ad159f
GLM on CUDA: TF_GLM_KV_SPLIT, agreed by every rank, refused by name a…
wojo Nov 7, 2026
797fa4b
GLM on CUDA: with TF_GLM_KV_SPLIT a page's pooled keys and latent row…
wojo Nov 7, 2026
28e8f96
GLM on CUDA: with TF_GLM_KV_SPLIT each stream's pages come from one o…
wojo Nov 7, 2026
b53c6ec
glm-paged-check: with TF_GLM_KV_SPLIT=1 the paged stream runs on owne…
wojo Nov 7, 2026
13b7d54
glm snapshots host: with TF_GLM_KV_SPLIT a kept state's plan reads bo…
wojo Nov 7, 2026
9aa19ae
GLM on CUDA: TF_GLM_KV_SPLIT's pool and begin steps cross two actual …
wojo Nov 7, 2026
3512be1
kernel contract: GLM's eight paged cases on TF_GLM_KV_SPLIT's two reg…
wojo Nov 7, 2026
9942b5e
Changelog: #2415 under Unreleased
wojo Nov 7, 2026
4c13b6c
kv_pool: the owner-class aliases' comments trail them, keeping kv_poo…
wojo Nov 15, 2026
27bf05d
GLM on CUDA: dsa_block's passes for owner-only rows: a rank without t…
wojo Nov 11, 2026
2f54b6c
GLM on CUDA: owner-computed attention: queries to a stream's owner, i…
wojo Nov 11, 2026
cee662d
GLM on CUDA: TF_GLM_KV_SPLIT refuses kept prompt states by name, unti…
wojo Nov 11, 2026
9be6859
GLM on CUDA: with TF_GLM_KV_SPLIT each stream's owner attends its row…
wojo Nov 11, 2026
402e8d2
GLM on CUDA: with TF_GLM_KV_SPLIT a rank keeps only its class's laten…
wojo Nov 11, 2026
83f1377
GLM on CUDA: with TF_GLM_KV_SPLIT an unasked prompt cache is planned …
wojo Nov 11, 2026
cc65ebb
glm-paged-check: with TF_GLM_KV_SPLIT each stream's latent rows live …
wojo Nov 11, 2026
57155dd
Changelog and kernel contract: TF_GLM_KV_SPLIT's owner-only rows (par…
wojo Nov 11, 2026
8156cad
glm-paged-check: prompts to 30,001 tokens, past 5,000 in the lanes' s…
wojo Nov 11, 2026
028f1df
GLM on CUDA: with TF_GLM_KV_SPLIT every rank checks a layer's segment…
wojo Nov 11, 2026
0917f6d
GLM on CUDA: with TF_GLM_KV_SPLIT a prompt chunk fetches its history …
wojo Nov 11, 2026
332fdaa
GLM owner fetch host: each rank's heads over the owner's history equa…
wojo Nov 11, 2026
7235fb4
glm-paged-check: with TF_GLM_KV_SPLIT the receipt counts the history …
wojo Nov 11, 2026
91b4321
Changelog and kernel contract: TF_GLM_KV_SPLIT's prompt history fetch…
wojo Nov 11, 2026
deb6c06
GLM on CUDA: with TF_GLM_KV_SPLIT a prompt chunk fetches only while i…
wojo Nov 13, 2026
fea177a
GLM on CUDA: with TF_GLM_KV_SPLIT a kept state's plan reads a stream'…
wojo Nov 11, 2026
12ccefa
GLM on CUDA: with TF_GLM_KV_SPLIT a kept state records its home, leas…
wojo Nov 11, 2026
5184332
GLM on CUDA: with TF_GLM_KV_SPLIT a resumed stream opens on its kept …
wojo Nov 11, 2026
7f8faf5
GLM on CUDA: with TF_GLM_KV_SPLIT a kept state restored off its home …
wojo Nov 11, 2026
0f42bdf
GLM on CUDA: TF_GLM_KV_SPLIT serves with a prompt cache; --learn-conv…
wojo Nov 11, 2026
9a0fd3d
GLM on CUDA: --learn-conversations with TF_GLM_KV_SPLIT: each rank's …
wojo Nov 11, 2026
89ed571
GLM on CUDA: with TF_GLM_KV_SPLIT a fresh prompt pass borrows a twin …
wojo Nov 11, 2026
a28b2af
glm-kv-split-keep-check and the changelog: TF_GLM_KV_SPLIT's kept sta…
wojo Nov 11, 2026
b0544ec
GLM on CUDA: with TF_GLM_KV_SPLIT a prompt twin holds the prompt's pa…
wojo Nov 13, 2026
aff469a
glm-kv-split-keep-check: the twinned pass's twin is the prompt's page…
wojo Nov 13, 2026
e02925d
GLM KV split carry host: three ranks, the home sends to the owner alo…
wojo Nov 13, 2026
83b03e3
TF_GLM_KV_SPLIT's rows: the history fetch and the prompt twins, and #…
wojo Nov 13, 2026
b25f749
TF_GLM_KV_SPLIT's row: the measured cold prompt and decode cost with …
wojo Nov 13, 2026
a9baa9a
GLM on CUDA: TF_GLM_KV_SPLIT prompt chunks exchange in pieces and pai…
wojo Nov 13, 2026
556ceba
rebase: integrate GLM split with main retirement and CUDA usage
ashhart Nov 20, 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel
- DeepSeek-V4.1 on Metal: the target's own buffers (prompt scratch, each slot's KV, tails, forward and layer scratch, RoPE tables) now join the weights' residency set, inside its load limit (the set refuses and logs what would take it past 70% of RAM). Before, a prompt chunk or decoder pass could wait 20-830 ms between commit and its first GPU instruction while macOS mapped them again, and a server's first request waited about 1.9 s. Replies are unchanged. On an M5 Ultra, cold prompts run about 5-7% faster (2K tokens 600 -> 631 tok/s, 8K 855 -> 917, 30K about 1,000 -> 1,063) (#3321).
- DeepSeek-V4.1 on Metal: a cold prompt's first chunk now reads its Engram rows while the GPU runs the layers before each Engram layer, instead of reading them all before the chunk starts. Replies are unchanged. On an M5 Ultra, cold prompts start about 0.3 s sooner at 2K tokens, 0.55 s at 8K and 0.8 s at 30K (#3318).
- Qwen3.8-27B on Metal (M1-M4): projections no longer barrier internally, and XS sums compile out before tensor units, with the same tokens (#2913, #2900).
- GLM-5.3-Flash on CUDA: `TF_GLM_KV_SPLIT=1`, off by default, takes each stream's KV pages from one owner rank's class and lays each page's pooled keys and latent rows in two regions, each with its own table; ranks that disagree stop before loading. In this part every rank still holds every latent row, so it saves no memory, and a class holds a whole window, so a split server can admit fewer streams. Unset, the pool and the pages are as before (#2415, part 1 of #1431). Thanks to @wojo.
- GLM-5.3-Flash on CUDA: with `TF_GLM_KV_SPLIT=1` each stream's latent rows now live only on its owner rank, which attends every rank's heads for them (the others send it their queries and get their outputs back); the pooled index keys stay on every rank. A token costs a rank 6,912 bytes at TP=2 instead of 13,056, so the same memory holds about 1.89 times the tokens (4,864 at TP=3), less a page of each class for a trash page. Prompt chunks are attended by their owner too, whole, without pieced exchanges or paired chunks, and kept prompt states are refused with the switch on until a later part carries them: serve it with `--prompt-cache-gib 0` and without `--learn-conversations`. The plan sets an unasked prompt cache aside first, at what the unsplit server would keep, so the saving goes to the pages (at a 1M window and 8 streams in 30 GiB: 1.90 GiB of cache either way, 2.10M tokens unsplit, 3.96M split), lowered only as far as each owner class still holds a window where it would not. Unset, nothing changes (#2935, part 2 of #1431). Thanks to @wojo.
- GLM-5.3-Flash on CUDA: with `TF_GLM_KV_SPLIT=1` a prompt chunk now fetches its history instead: the owner broadcasts the layer's earlier latent rows and every rank attends its own heads, so the owner no longer works every rank's heads and nothing is sent back. It uses the exchange room part 2 already makes (131,072 rows at TP=2 with the default 2,048-row prompt chunks), and a chunk fetches only while broadcasting its history moves no more bytes than its exchange would: at TP=2, a history of at most 64 rows for each of the chunk's rows, which for full chunks is the room. A short chunk on a long history, a longer prompt's chunks past the room, decode and verify windows keep the owner's exchange. Unset, nothing changes (#2937, part 3 of #1431). Thanks to @wojo.
- GLM-5.3-Flash on CUDA: `TF_GLM_KV_SPLIT=1` now serves with a prompt cache and `--learn-conversations`. A kept state's latent rows stay on the owner rank it was kept on (its home); a resume opens on that rank's class when it has the pages, and otherwise the home sends the rows to the new owner before the pass. Each rank's disk image holds its own rows and records the split and the home, and a server of the other layout refuses it by name. A fresh prompt pass borrows a twin of its prompt's pages on every other rank when they are free, so each rank attends its own heads for the prompt, and gives it back before its first decode round. A split prompt chunk now exchanges in row pieces, and two chunks pair when both attend their own heads, so a cold prompt costs what it does unset: on two GB10s a 28k-token prompt's first token in 19.07 s against 19.04 s (22.1 s before). Unset, nothing changes (#2938, part 4 of #1431). Thanks to @wojo.

- HIP on gfx1151: a plain prompt of 1 or 2 rows takes the 2-row K-parallel tile, with byte-identical output (#3273). Thanks to @AbrahamCete.

Expand Down
4 changes: 3 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,9 @@ store for each model and build. That store takes the place of `--learn`'s store
with the flag neither reads nor writes the prefix files a plain `--learn` server keeps, and they stay on disk until the
cap below needs their room. After a restart, a crash or an eviction from RAM, the next turn reads the latest state back
instead of reading the conversation again from its first token. Qwen3.8-27B, Nemotron, Flash Next and GLM-5.3-Flash on
one Mac, and Nemotron, the Qwen3.5 hybrids and Flash Next on CUDA, keep them; other engines refuse the flag at startup.
one Mac, and Nemotron, the Qwen3.5 hybrids, Flash Next and GLM-5.3-Flash on CUDA keep them; other engines refuse the
flag at startup. GLM-5.3-Flash on CUDA across ranks writes every rank's part to rank 0's disk, so a state is read back
on every rank or on none; it takes neither `--spill-gib` nor `--checkpoint-slots`.

The engine stages an owned copy between rounds, and an I/O thread writes and fsyncs it. Staging has a 1 GiB byte permit
and at most eight jobs. Qwen3.8-27B widens the permit to one whole state at its `--context`, with none of its rows on
Expand Down
1 change: 1 addition & 0 deletions docs/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Diagnostics quote and escape the supplied text so it cannot create another termi
| `TF_GLM_KV_HOST_GIB` | GLM on CUDA: a finite GiB amount of at least 0 for the DSA layers' pinned host pages; unset or blank uses one full window and 16 rows a page |
| `TF_GLM_RANK` | GLM-5.3-Flash on CUDA: a whole rank index from 0 through 4294967295, set with `TF_GLM_WORLD`; unset with it gives one rank |
| `TF_GLM_WORLD` | GLM-5.3-Flash on CUDA: a whole rank count from 1 through 4294967295, set with `TF_GLM_RANK`; unset with it gives one rank |
| `TF_GLM_KV_SPLIT` | Exactly `0`, `off`, `1` or `on`; default off (each stream's GLM KV pages from one owner class, its latent rows on the owner rank alone: about 1.89 times the tokens at TP=2 for about 2% slower decode (on two GB10s 32.9 against 33.5 tokens a second on one stream, 61.0 against 61.5 on four); a cold prompt takes what it does unset (a 28k-token prompt's first token in 19.07 s against 19.04 s, a 93k-token one's in 63.7 s against 63.6 s), its chunks exchanging in row pieces and pairing when both attend their own heads; a prompt chunk fetches its history from the owner while that moves no more bytes than the owner working every rank's heads, and a fresh prompt pass borrows a twin of its prompt's pages on every other rank until its first decode; the prompt cache and `--learn-conversations` keep a state's latent rows on the rank it was kept on; [profiles](profiles.md)) |
| `TF_NEMOTRON_RANK` | Nemotron 3.5 Super on CUDA: a whole rank index from 0 through 4294967295, set with `TF_NEMOTRON_WORLD`; unset with it gives one rank |
| `TF_NEMOTRON_WORLD` | Nemotron 3.5 Super on CUDA: a whole rank count from 1 through 4294967295, set with `TF_NEMOTRON_RANK`; unset with it gives one rank |
| `TF_MINIMAX_RANK` | MiniMax-M3.1-Flash on CUDA: a whole rank index, 0 or 1 at two ranks, set with `TF_MINIMAX_WORLD`; unset with it gives one rank |
Expand Down
10 changes: 9 additions & 1 deletion docs/kernel-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,15 @@ RADIO's fused bias, activation and residual (`tf_vit_bias_act`) replaces `tf_vit
CUDA also checks GLM-5.3-Flash's KV page kernels on a page table out of order: the latent write and the pooled keys
(`tf_glm_lat_write`, `tf_glm_pool_keys`), the index scores and the selected tokens' rows (`tf_glm_scores`,
`tf_glm_dsa_tokens`), and the MLA chunks through their merge (`tf_glm_chunks_16` and `tf_glm_chunks_32`, dense and
sparse). Its prompt indexer (`tf_glm_index_scores`, `tf_glm_index_pools`) is bit-equal to `tf_glm_scores` and
sparse). The same eight cases also run on `TF_GLM_KV_SPLIT`'s two regions (every page's pooled keys, then every page's
latent rows), each launch with its region's table and stride, and each control giving it the other region's table.
With the split each rank keeps only its own class's latent pages and a trash page, so its latent table holds places in
that smaller region; the owner's pass for another rank's heads is the same chunk and merge launches with that rank's
queries, outputs and head count. No launch is new, so the split adds no case here: `glm-paged-check` covers it.
A prompt chunk's history fetch packs the owner's earlier rows with `tf_glm_kvh_rows` (the `rows` case above) and
attends them on the other ranks with the same chunk and merge launches over rows in order (no table), so it adds
no case either.
Its prompt indexer (`tf_glm_index_scores`, `tf_glm_index_pools`) is bit-equal to `tf_glm_scores` and
`tf_glm_select_rows`, and its decode select at a 1,024-thread block a row (`tf_glm_select_rows_wide`) and in spans
over many blocks (`tf_glm_dsel_scan`, then `tf_glm_dsel_merge` a block a row) to `tf_glm_select_rows`; both stated
rules rank any NaN above +inf, as the GPU's `s + 0` makes every NaN one positive NaN.
Expand Down
6 changes: 3 additions & 3 deletions docs/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ profile supplies no value. Registry metadata comes directly from the table. Regi
Coverage includes:

- Qwen3.5 dense/MoE on CUDA: `TF_QWEN_KV_PAGES`, `TF_QWEN_KV_PAGES_ALL`, `TF_QWEN_KV_SHARE`.
- GLM on CUDA: `TF_KV_PAGES`, `TF_GLM_KV_HOST`, `TF_GLM_KV_HOST_SHARED`, `TF_GLM_PROMPT_TAIL`, and the exact 0/1
switches `TF_GLM_HOST_CACHE`, `TF_GLM_VISION_HOST` (off unless `1`) and `TF_GLM_PDL`, `TF_GLM_PROMPT_STEPS`,
`TF_GLM_SHARED` (on unless `0`).
- GLM on CUDA: `TF_KV_PAGES`, `TF_GLM_KV_HOST`, `TF_GLM_KV_HOST_SHARED`, `TF_GLM_KV_SPLIT` (`1` or `on`),
`TF_GLM_PROMPT_TAIL`, and the exact 0/1 switches `TF_GLM_HOST_CACHE`, `TF_GLM_VISION_HOST` (off unless `1`)
and `TF_GLM_PDL`, `TF_GLM_PROMPT_STEPS`, `TF_GLM_SHARED` (on unless `0`).
- Nemotron and Nemotron Omni on CUDA: `TF_KV_PAGES`, with their existing default-on parser.
- Gemma 4, Kolibri-1, Spark2.5, Dory and GLM on the core CUDA page adapter: `TF_KV_SHARE`, where the adapter is served.
Dory's `TF_KV_SHARE` also puts its full-attention caches in pool pages, as `TENSORFOLD_DORY_KV_PAGES=1` does;
Expand Down
8 changes: 8 additions & 0 deletions zig/build/cuda_readback_sites.zig
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@ pub const sites = [_]Site{
.at = "e.bd.logits",
.out = "std.mem.sliceAsBytes(if (j == 0) mine else twin)[0..rows * V * 2]",
},
.{
.path = "zig/tests/cuda/glm_paged_tests.zig",
.source = @embedFile("../tests/cuda/glm_paged_tests.zig"),
.ordinal = 3,
.setup = "const gpu = .{ .d = &rig.d }; const got = rig.dest(u32, 5); const st = .{ .ltable = rig.src };",
.at = "st.ltable",
.out = "std.mem.sliceAsBytes(got)",
},
.{
.path = "zig/tests/cuda/glm_solo_tests.zig",
.source = @embedFile("../tests/cuda/glm_solo_tests.zig"),
Expand Down
3 changes: 3 additions & 0 deletions zig/build/glm_family_host.zig
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ pub fn steps(b: *std.Build, cuda: *std.Build.Module, glm: *std.Build.Module, mod
const thin_run = b.addRunArtifact(b.addTest(.{ .root_module = glm, .filters = &.{"GLM thin weights:"} }));
b.step("test-glm-thin-weights-host", "TF_GLM_LAYERS's admission bytes by tensor from synthetic shard headers").dependOn(&thin_run.step);
step.dependOn(&thin_run.step);
const fetch_run = b.addRunArtifact(b.addTest(.{ .root_module = glm, .filters = &.{"GLM owner fetch:"} }));
b.step("test-glm-owner-fetch-host", "TF_GLM_KV_SPLIT's prompt history fetch on host ranks against unsplit attention").dependOn(&fetch_run.step);
step.dependOn(&fetch_run.step);
b.step("test-glm-tp3-host", "Uneven KDA head shares through actual projection and load planning, without devices").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = glm, .filters = &.{"GLM TP3:"} })).step);
// TF_GLM_INDEX_CUDA: the launch rules, and (its own slower step) glm_index_*.cuh as host C++ against plain models
const index_run = b.addRunArtifact(b.addTest(.{ .root_module = glm, .filters = &.{"GLM index:"} }));
Expand Down
Loading
Loading