Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
20e4ddb
metal: Spark2.5's and Llama's prompt attention from one source, Llama…
jschmied Nov 17, 2026
fe375b1
metal: a host test pins Llama's fold of the shared prompt attention a…
jschmied Nov 17, 2026
93f98b4
Record the shared prompt attention under Unreleased
ashhart Nov 17, 2026
72240eb
dsv41 metal: time-dsv41-metal-synth times synthetic release-shape lay…
gilby Nov 12, 2026
3dca10f
dsv41 metal: FP8 projections of 6-16 decode rows on a simdgroup-matri…
gilby Nov 12, 2026
191218c
docs: the kernel contract's entry for DeepSeek V4.1's FP8 rows tile
gilby Nov 13, 2026
9382cbc
changelog: #2973's line quotes the served result on both chips, not s…
gilby Nov 13, 2026
32a3f1e
changelog: one #2973 line under Unreleased, the served result, with t…
ashhart Nov 17, 2026
d18b4bc
changelog: #2973 under Unreleased
ashhart Nov 18, 2026
23a9475
feat(images): stream step progress and previews while a picture gener…
ashhart Nov 13, 2026
d857bbe
changelog: #3245 under Unreleased
ashhart Nov 18, 2026
cda0cb5
qwen3_5 cuda: a dense MLP's NVFP4 prompt gate, up and act in one lean…
jschmied Nov 13, 2026
afaf202
qwen3_5 cuda: re-pin prompt16.cu and nvfp4.zig for the lean SwiGLU pa…
jschmied Nov 16, 2026
cf67ec6
changelog: #3252 under Unreleased
ashhart Nov 18, 2026
18c0f5a
cuda: one kept image for states in device buffers, Gemma 4 on disk (#…
jschmied Nov 6, 2026
02ebd30
cuda: Dory and Spark2.5 keep their states on disk (#840)
jschmied Nov 6, 2026
0f9eaa4
cuda disk: the kept image's tests hang off cuda_disk.zig, cuda.zig st…
jschmied Nov 6, 2026
130df97
cuda kept: the store's permit takes a state at the served window, thr…
jschmied Nov 12, 2026
14b8c9a
docs: optimization ledger row 8, Gemma 4, Dory and Spark2.5 on CUDA open
jschmied Nov 12, 2026
9da1cef
cuda disk: pin the shared kept view on the rebased source (#3135)
ashhart Nov 17, 2026
0bbac81
changelog: #3135 under Unreleased
ashhart Nov 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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel

## Unreleased

- CUDA: Gemma 4, Dory and Spark2.5 can keep conversations on disk through the shared kept-image store (#3135, part of #840). Thanks to @jschmied.

- CUDA: a dense Qwen 3.5 MLP's NVFP4 prompt gate, up and activation run in one launch for prompt rows past 16, with the same bytes (#3252). Thanks to @jschmied.

- Images: with `stream: true`, `POST /v1/images/generations` streams each denoising step's progress (`image_generation.progress`) and, with `preview_interval`, partial previews while the picture generates, then the PNG (#3245).

- DeepSeek-V4.1 on Metal: decode launches of 6 to 16 rows (draft verify windows, alone or with other streams' rows) run the dense FP8 projections on a simdgroup-matrix tile that splits K over simdgroups in the row kernel's own group tree, so every row's bits equal the row kernel's one row at a time; launches of 1 to 5 rows keep the row kernel. On the release weights two drafted streams decode 3.7 to 5.5% faster on an M5 Ultra and 3.6 to 5.4% faster on an M3 Ultra, other stream counts are level, and every token is unchanged; `time-dsv41-metal-synth` times the dispatch classes per row without a checkpoint (#2973, part of #2984).

- Tools: add the heat-exchanger agent evaluation and its bounded Python execution helper (#3086).

- Packaging: a Grafana dashboard for the engine's Prometheus metrics (TTFT and TPOT quantiles, decode rate, running and waiting requests, KV use, draft acceptance, prompt cache, memory and admission), with a host test that rejects unwritten metrics (#3141).
Expand All @@ -13,6 +21,7 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel
- Tests: `zig build test-tokenizer-host` runs every tokenizer test, unfiltered, on the host without a GPU or shader compiler, and is part of the nightly Linux and macOS fast checks; before, CI reached only the tokenizer's two EOS policy tests (#3082).
- Bench: add served agent-cache traces and token-qualified A/B comparisons (#3263).
- CI: remove the redundant nightly Linux host shard while retaining the fast, compile, HIP and DeepSeek shards (#3276).
- Metal: Spark2.5 and Llama build their tensor-unit prompt attention from one shared source, Llama's at WINDOW 0 and RING 0; the compiled code is unchanged (#3269, part of #2251). Thanks to @jschmied.

- Docs: the README is now a short quick start and docs list; setup, serve flags and model tables moved to the new run guide and supported models pages, and the Zig preview and 1.0.0 release notes moved into docs/ (#3170). Thanks to @jayleaton.

Expand Down
46 changes: 35 additions & 11 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,29 @@ The reply is written once every picture has finished. A refusal, a failed genera
and returns that error with no pictures. A client that disconnects cancels the current picture, and the later
pictures are never submitted.

## Image generation streams

With `stream: true`, on an engine that reports its denoising steps, the route answers `text/event-stream`. After
each step it sends `image_generation.progress` with `index` (the picture, from 0), `seed`, `step` (from 1) and
`total_steps`; when the picture is done, `image_generation.completed` carries its `b64_json` PNG, `index` and
`seed`. With `n` above 1 the pictures follow one another on the same stream, each counting its own steps, and one
`data: [DONE]` ends it. Each event's `type` is its event name, OpenAI's for the completed picture and the previews.

`preview_interval: N`, an integer from 1 through `steps` sent with `stream: true` to an engine that makes previews,
adds `image_generation.partial_image` after every Nth step's progress event. Its `b64_json` is a separate PNG of at
most 128 pixels a side and 81,920 bytes, with `width`, `height`, `step`, `total_steps`, `index`, `seed` and
`partial_image_index` (from 0). Previews do not change the picture: the final PNG bytes are the same with or without
`stream` and `preview_interval`, and no preview is made unless one is asked for. For example,
`{"model":"m","prompt":"A red kite","seed":42,"steps":8,"stream":true,"preview_interval":2}` sends progress for
steps 1 to 8, previews after steps 2, 4, 6 and 8, then the picture.

A request without `stream`, or with `stream: false`, gets the whole JSON reply as before. `stream` on an engine
without step progress, `preview_interval` without `stream` or on an engine without previews, and a value out of
range are HTTP 400 before anything is submitted. A refusal before the stream starts is the usual HTTP error; once it
has started, a failure is an `error` event holding OpenAI's error object, then `data: [DONE]`, and the pictures
already completed stay sent. A client that disconnects, or a write that fails, cancels the picture at its next step,
and no later picture is submitted.

## Embeddings

`POST /v1/embeddings` takes OpenAI's body: `input` is one text, a list of texts, one list of token IDs or a list of
Expand Down Expand Up @@ -1316,17 +1339,18 @@ deleted and its tokens are prefilled, and a write cut off midway leaves nothing
needs `--spill-gib` or `--learn-conversations`. With `--learn-conversations` too, every state is still written
behind, a staged write survives eviction of its RAM entry, and the cap is the smaller of `--learn-gib` and
`--spill-gib`. `--learn-min-free-gib` and `--learn-daily-gib` apply to spilled states as well. The same four Mac
families take both flags, and so do three CUDA ones; the others refuse them at startup. Without either flag nothing
changes, and the routes below stay off. `TENSORFOLD_ROWS_SYNC=1` selects the previous synchronous writer for
comparisons; its block and state files have the same bytes. That comparison writer retains blocking I/O; the bounded
disk wait uses the threaded writer. `TF_IMPRINT_VERIFY=1` reads threaded writes back against their owned staging before
publication.

On CUDA, Nemotron, the Qwen3.5 hybrids and Flash Next take `--spill-gib` and `--checkpoint-slots` with the same store
and cap as a Mac. At an eviction the engine thread stages a copy of the state into host memory, waiting for the GPU
work that produced it, then releases its RAM entry and goes on; the I/O thread writes and fsyncs the copy while the
engine decodes. Staging holds at most 1 GiB and eight jobs: a state whose new bytes (rows neither on disk nor being
written) do not fit what is free is not saved, so one past 1 GiB never is, and a later request for it prefills. When the
families take both flags, and so do Nemotron, the Qwen hybrids, Flash Next, Gemma 4, Dory and Spark2.5 on CUDA; the
others refuse them at startup. Without either flag nothing changes, and the routes below stay off.
`TENSORFOLD_ROWS_SYNC=1` selects the previous synchronous writer for comparisons; its block and state files have the
same bytes. That comparison writer retains blocking I/O; the bounded disk wait uses the threaded writer.
`TF_IMPRINT_VERIFY=1` reads threaded writes back against their owned staging before publication.

On CUDA, Nemotron, the Qwen3.5 hybrids, Flash Next, Gemma 4, Dory and Spark2.5 take `--spill-gib` and
`--checkpoint-slots` with the same store and cap as a Mac. At an eviction the engine thread stages a copy of the state
into host memory, waiting for the GPU work that produced it, then releases its RAM entry and goes on; the I/O thread
writes and fsyncs the copy while the engine decodes. Staging holds at most 1 GiB and eight jobs; for Gemma 4, Dory and
Spark2.5 it holds one whole state at the served window, within the RAM cache's budget. A state whose new bytes (rows
neither on disk nor being written) do not fit what is free is not saved, and a later request for it prefills. When the
engine closes, at a planned stop (SIGTERM or SIGINT) or an idle unload, it saves the states still in RAM, newest first,
within the same disk cap and 20-second stop budget. While other streams run, a queued request whose state is on disk has
it read ahead on an I/O thread, as described above.
Expand Down
10 changes: 9 additions & 1 deletion docs/kernel-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ oracle in the kernel's fp32 order whose silu may move by exp's error, and the do
DeepSeek-only copy of Kimi K3's chains with the full E8M0 scale range) against its bytes (also over the release's real
FP4 expert bytes), each with four controls. The copied plan and combine (`tf_dsv41_route_plan`, `tf_dsv41_xp_combine`)
are checked end to end through the GPU's own plan, and every launch is recorded for gate 5.
Metal also checks DeepSeek V4.1's FP8 rows tile (`fp8_tile.metal`, `tf_dsv41_fp8_tile_*`), which runs decode launches
of 6 to 16 rows on simdgroup MMA: one registration replaces `tf_dsv41_fp8_w*` run one row a launch and must be
bit-equal to it at every shape of its shapes gate (the seven release projections and every row count from 1 to 16),
beside f32, bf16, forced-form and release-fixture registrations against float64. A probe holds the tile byte-equal to
the row kernel one row a launch on every dense FP8 shape the decode forward runs, f32 and bf16, rows 1 to 16 from row 0
and 1 to 15 from row 1 at every form, the 16/17 seam and a three-launch batch, with NaN and Inf planted. Four controls
go red: non-finite inputs flushed, group and slice roots added in a chain, group roots rounded to fp16, and writes past
its output.
The row-split seam's four kernels (`pair_rows.metal`, launched by `pair_rows.zig`) move bf16 frames, never sums:
`pair_stage` copies this rank's half of a frame row into the slot the relay sends, and `pair_gather` writes both halves
of every row, its own natively and the peer's from the relayed frame. `pair_argmax` flags a row whose logits are not
Expand All @@ -281,7 +289,7 @@ the once-rounded ones, each checked on its residual and its output, with four co
bit-equal to them) and top-k, the latent top-k's decode form (bit-equal to `tf_super_topk`), the latent combine and
shared add over bf16 share sums (bit-equal to `tf_super_combine` and `tf_super_moe_out` over the fp32 shares), the
Mamba scan of a verify window (its host twin's bytes), qmm_group's cluster tile, lane_gemv and its split-K form (both
bit-equal to it), the split-K form segmented over projections of one input (bit-equal to `decode()` on each), prompt16's FP4 tile with bf16 and fp32 out, qmmf's FP4 tiles with fp32 out (K slices met in a
bit-equal to it), the split-K form segmented over projections of one input (bit-equal to `decode()` on each), prompt16's FP4 tile with bf16 and fp32 out and its gate/up SwiGLU pair (bit-equal to two lean products then `tf_q35_mlp_act`; controls: gate and up swapped, the gate's scale one fp32 ulp up), qmmf's FP4 tiles with fp32 out (K slices met in a
cluster, fused, or by `reduce_kernel<true>`), the checkpoint math's FP8 128-row prompt tiles (both slice meetings,
bit-equal to the 64-row tiles) and NVFP4 experts: the decode-sized forms and the prompt tiles (up to down's NVFP4
rows, fp32 down and the down summing two width shares, each bit-equal to the kernels it replaces; sm_120 up), and the
Expand Down
5 changes: 3 additions & 2 deletions docs/optimization-ledger.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ last two hold the families with only a Metal, HIP or scoring backend.
| 5. State walk | open C[#2392] | open C[#2392] | open [#2215] | open C[#2392] | open C[#2392] |
| 6. KV ledger | done [#2127] | done [#2127] | done [#2127] | done [#2127] | done [#2127] |
| 7. Host KV tier | yes | open [#1501] | done [#1795] | yes | yes |
| 8. Disk cache | done C[#1358] | done C[#1359] M[#519] | done M¹ open C[#1411] | yes | done C[#1413] M¹ |
| 8. Disk cache | done C[#1358] | done C[#1359] M[#519] | done M¹ open C[#1411] | open C[#3135] | done C[#1413] M¹ |
| 9. FP8 KV | done [#886] | yes | done¹ | yes | yes |
| 10. FP4/FP8 decode | yes | yes | yes | no (affine) | yes |
| 11. Fused proj. | done [#1783] | done¹ | done¹ | done [#1783] | done [#1783] |
Expand Down Expand Up @@ -88,7 +88,7 @@ last two hold the families with only a Metal, HIP or scoring backend.
| 5. State walk | yes | yes | yes | yes | yes |
| 6. KV ledger | done [#2127] | done [#2127] | done [#2127] | yes | yes |
| 7. Host KV tier | yes | yes | yes | yes | yes |
| 8. Disk cache | yes | yes | yes | yes | done¹ |
| 8. Disk cache | yes | open [#3135] | open [#3135] | yes | done¹ |
| 9. FP8 KV | yes | yes | yes | yes | no (FP8 by design) |
| 10. FP4/FP8 decode | failed [#1448] | no (bf16) | yes | no (EXL3) | yes |
| 11. Fused proj. | done¹ | done [#1783] | yes | done¹ | done¹ |
Expand Down Expand Up @@ -524,6 +524,7 @@ below; these are estimates for planning a port, not results.
[#1394]: https://github.com/ashhart/TensorFold/pull/1394
[#1411]: https://github.com/ashhart/TensorFold/pull/1411
[#1413]: https://github.com/ashhart/TensorFold/pull/1413
[#3135]: https://github.com/ashhart/TensorFold/pull/3135
[#1423]: https://github.com/ashhart/TensorFold/pull/1423
[#1426]: https://github.com/ashhart/TensorFold/pull/1426
[#1434]: https://github.com/ashhart/TensorFold/pull/1434
Expand Down
2 changes: 1 addition & 1 deletion zig/build/cuda_fault_host.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const std = @import("std");
pub fn steps(b: *std.Build, cuda: *std.Build.Module, flashnext: *std.Build.Module, native: *std.Build.Module) void {
b.step("test-cuda-context-health-host", "Sticky CUDA context faults and real graph-instantiation refusal without devices").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = cuda, .filters = &.{ "CUDA context health:", "CUDA graph refusal:" } })).step);
b.step("test-flashnext-loader-host", "The threaded NVFP4 expert loader: the loop's words, no pinned or device memory left after a failed load, geometry first").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = flashnext, .filters = &.{"Flash Next expert loader:"} })).step);
b.step("test-flashnext-completion-host", "Actual CUDA sequence rollback drains asynchronous destinations before release").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = flashnext, .filters = &.{"Flash Next completion:"} })).step);
b.step("test-flashnext-completion-host", "Actual CUDA sequence rollback drains asynchronous destinations before release").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = native, .filters = &.{"Flash Next completion:"} })).step);
b.step("test-cuda-fault-admission-host", "Sticky context health reaches native status and queue admission").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = native, .filters = &.{"CUDA context health:"} })).step);
b.step("test-cuda-readiness-host", "Real native readiness and synchronous startup preparation without shaders").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = native, .filters = &.{"family readiness reaches"} })).step);
b.step("test-startup-log-host", "Ordered startup logs and early P2P facts without devices").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = cuda, .filters = &.{"startup log:"} })).step);
Expand Down
3 changes: 3 additions & 0 deletions zig/build/disk_identity_host.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ pub fn steps(b: *std.Build, native: *std.Build.Module, all: *std.Build.Step) voi
const open = b.addRunArtifact(b.addTest(.{ .root_module = native, .filters = &.{"CUDA disk open:"} }));
b.step("test-cuda-disk-open-host", "CUDA's disk store takes --spill-gib's mode and --checkpoint-slots").dependOn(&open.step);
all.dependOn(&open.step);
const kept = b.addRunArtifact(b.addTest(.{ .root_module = native, .filters = &.{"CUDA kept:"} }));
b.step("test-cuda-kept-host", "The shared kept image over host memory, stale keys through the real store").dependOn(&kept.step);
all.dependOn(&kept.step);
const identity = b.addRunArtifact(b.addTest(.{ .root_module = native, .filters = &.{"disk identity:"} }));
b.step("test-disk-identity-host", "Actual CUDA identity, resolved profile values and stale disk misses").dependOn(&identity.step);
all.dependOn(&identity.step);
Expand Down
11 changes: 11 additions & 0 deletions zig/build/dsv41_metal.zig
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ pub fn steps(b: *std.Build, metal: *std.Build.Module, sources: *std.Build.Module
const timing_run = b.addRunArtifact(b.addTest(.{ .root_module = timing }));
timing_run.has_side_effects = true;
b.step("time-dsv41-metal-real", "DeepSeek-V4.1 Metal: one release layer's decode timed at 1 and 4 rows").dependOn(&timing_run.step);
// synthetic layers of the release's shapes (no checkpoint): dispatch classes a row at 1-16 rows and 4 slots
const synth = b.createModule(.{
.root_source_file = b.path("zig/tests/dsv41_metal/timing_synth.zig"),
.target = b.graph.host,
.optimize = .ReleaseFast,
.link_libc = true,
.imports = &.{ .{ .name = "dsv41_metal", .module = quick.pkg }, .{ .name = "metal", .module = metal }, .{ .name = "dsv41", .module = quick.host }, .{ .name = "kernel_sources", .module = sources } },
});
const synth_run = b.addRunArtifact(b.addTest(.{ .root_module = synth }));
synth_run.has_side_effects = true;
b.step("time-dsv41-metal-synth", "DeepSeek-V4.1 Metal: synthetic release-shape layers timed per row and dispatch class").dependOn(&synth_run.step);
const ptime = b.createModule(.{
.root_source_file = b.path("zig/tests/dsv41_metal/prompt_time.zig"),
.target = b.graph.host,
Expand Down
3 changes: 2 additions & 1 deletion zig/build/server.zig
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ pub fn testImports(b: *std.Build, m: *std.Build.Module, target: std.Build.Resolv

/// Tool parsing and actual chat visibility checks share the aggregate's real modules.
pub fn toolHostTests(b: *std.Build, parser: *std.Build.Module, server: *std.Build.Module, all: *std.Build.Step) void {
b.step("test-images-host", "Image route counts, seeds, refusals and cancellation without devices").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = server, .filters = &.{ "image sequence:", "images_generations_test." } })).step);
const images = b.addRunArtifact(b.addTest(.{ .root_module = server, .filters = &.{ "image sequence", "image progress:", "images_generations_test." } }));
b.step("test-images-host", "Image route counts, seeds, step streams, previews and cancellation without devices").dependOn(&images.step);
testImports(b, parser, b.graph.host, .debug);
testImports(b, server, b.graph.host, .debug);
b.step("test-token-stream-host", "Native token streams, semantic anchors and cancellation without devices").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = server, .filters = &.{"token stream:"} })).step);
Expand Down
Loading
Loading