Repository navigation
Conversation
…its graphs are captured once On the 0.6.1 port every resize of the solo slot (`_grow`, `_shrink`) drops its graphs through `_state_changed`, and a slot starts at 256 rows and shrinks back after each request. A lone request therefore recaptured its graphs mid-decode whenever its context passed the slot's rows: 23 captures, 3.0 s of a 512-token reply on a GB10. - The solo slot keeps its rows when idle; it gives them back only when memory is short (an evicted kept end, the newest stream ending, or an idle solo slot freed for another stream's growth). - It grows by doubling (at least STEP rows), so a long session recaptures a handful of times, not every request. - `warm()` captures its graphs last, at the rows requests will find (the warm request had grown the slot after the captures, which discarded them). tests/test_cuda_growing_caches.py: the slot keeps its rows across a request's end, gives them to another stream when the gate is short, and grows 8192 -> 16384 -> 32768 -> the window; its decoder helper sets the port's new attributes (`solo`, `solo_on`, `planning`), so the file's three existing decoder tests run again on the port. GB10, EXL3 3.05bpw, greedy, 512 tokens, two starts: a streams=4 engine serving one request 18.41/18.56 -> 12.18/12.20 ms/token (= streams=1's 12.18/12.19); two streams 99.8/99.1 -> 111.7/110.8 tok/s and four 146.8/145.1 -> 157.6/157.8 (0.6.0: 111.9/111.5 and 158.4/157.9). No captures during any measured reply; every reply byte-identical to its solo run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011SuBgdp87NbfLbiigmzn1z
…an Shadows too On two ranks, rank 0 plans on Shadows of the slots, and `dec.solo.st` is itself a Shadow there. `_is_solo` unwrapped only its argument, so it was never true while planning: the two-rank path kept resizing the graph slot (and recapturing its graphs) as before ashhart#180. It now compares the slots the Shadows stand for, and an idle graph slot can be released under memory pressure while planning too (its resize is recorded for rank 1 like any other). tests/test_cuda_growing_caches.py: through a Shadow, the graph slot is recognised, keeping its rows records only a reset, and a release records the resize. The test fails on 6a3a8b1 (`_is_solo(Shadow)` is False). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011SuBgdp87NbfLbiigmzn1z
…thout dropping its graphs Two paths still dropped or broke the graph slot after the first request: - A lone request's prompt end is kept in the slot it finished in, the graph slot. The next lone request with another prompt landed elsewhere and `_move_to_solo` made that slot the graph slot instead (`_state_changed`, a full recapture). On one GB10, Flash Next EXL3, a --parallel 4 engine, four 256-token requests with three prompts: 32 / 30 / 19 graph captures (3.8 / 3.6 / 2.3 s) on every request after the first. Now the kept prompt end moves to a free slot of the same rows (`copy_from`, its snapshot unchanged) and the request takes the graph slot. If no free slot fits without evicting, the old swap stays. On two ranks the kept ends are named by slot in the plan, so they keep the swap too. - With the graph slot keeping its rows, a lone stream from a smaller slot no longer has the same geometry, and `copy_from` failed on the cache tensors' sizes. `copy_from` now takes a source with fewer rows into its first rows (rows past `pos` are written before they are read) and refuses a larger one. The same four requests: 0 captures each, 14.0 / 12.7 / 11.7 / 12.1 ms/token (0.6.1 port: 31.6 / 29.4 / 27.3 / 23.0), every reply byte-identical to the port's, including the one that resumes the moved prompt end. tests/test_cuda_growing_caches.py: a lone stream moves into a graph slot with more rows (no resize, rows and positions carried); a different lone request takes the graph slot while the kept prompt end moves to a free slot with its rows. Both fail on 6ada832 (a size mismatch in copy_from; the graph slot swapped). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011SuBgdp87NbfLbiigmzn1z
|
A third commit, Written with AI assistance (Claude Code). |
|
Ran #180 at Tests. One GPU test fails on #180, both cases: Exactness on two ranks (by Speed, aggregate tok/s, medians of 3, int8 (baseline without
Lone requests one after another (512 tokens, greedy, six different prompts then the first again): the first after startup went from 67.0 to 108.7 tok/s (the warm captures are no longer thrown away), the others gained 3-5%. On two ranks a different prompt still takes the slot swap, as the code says ( In my opinion #180 is merge ready, with the test update above. |
…nd its graphs ashhart#180's third commit moves a kept prompt end out of the graph slot (one GPU) so a different lone request takes the slot without dropping its graphs. The GPU test still asserted the old swap (the request in another slot), so it failed on ashhart#180 (bf16 and int8). It now asserts the new behaviour: the request ends in the graph slot, the slot's graphs are not dropped, the first prompt's kept end is moved rather than evicted, replies equal fresh runs and the resume still hits. Fails without ashhart#180, passes with it.
|
Thanks for the run and the test fix. I hadn't run The single-request gap left on two ranks is the swap: rank 0's plan names kept prompt ends by slot, so Written with AI assistance (Claude Code). |
|
Ran d2e651a on one DGX Spark (GB10, NGC
I could not reproduce the speed regression on this NVFP4 checkpoint, so these runs don't show a speedup either. That says nothing about the EXL3 numbers in the description, which used a different checkpoint. Median of two runs, 512 greedy tokens per stream:
The one-request differences are within run-to-run spread (cb5101d 37.3/34.8, #180 33.3/35.5). Unlike the EXL3 table (18.41 ms/token for cb5101d at |
|
@SvangenStudios thanks for the NVFP4 run. On our NVFP4 export (ModelOpt, NVFP4 experts, block-FP8 dense; one GB10) the
Our one-request speed is 63 tok/s against your 36, at every setting, so something else may bound your decode. Your Written with AI assistance (Claude Code). |
|
Thanks, that pointed the right way. The startup lines speak against n-gram paging as the cause: the tables fit ("n-gram tables read in 0.6s", no "do not fit" line).
A round takes about 50–60 ms whatever the prompt, so the drafts decide the speed. On code that drafts well this export reaches ~61 tok/s, close to your 63; my earlier 36 was the story prompts, at 1.8 tokens a round. At |
|
Data point from a single-GPU port of this (GB10, Flash Next EXL3 4.05 bpw, our fork on 0.6.x,
One case we hit that may also apply here: once every pool slot held a kept prompt end, the slot logic moved the graphs to the newly admitted request's slot and recaptured them on every request — lone speed fell to 39.6 tok/s. What fixed it for us: a new prompt takes the graph slot at admission (the kept end there moves out), and a resumed request that needs a slot evicts the oldest other kept end instead of the graphs. With that, captures stay at one set across requests. We also found waiting streams' pending DeltaNet rows needed folding before other rounds reuse the scratch (latent on our base, not specific to this PR). Still eager in our port: lone streams with a grammar constraint and requests with drafts off. Happy to share the port/regression test if useful. Written with AI assistance (Claude Code). |
…its graphs are captured once On the 0.6.1 port every resize of the solo slot (`_grow`, `_shrink`) drops its graphs through `_state_changed`, and a slot starts at 256 rows and shrinks back after each request. A lone request therefore recaptured its graphs mid-decode whenever its context passed the slot's rows: 23 captures, 3.0 s of a 512-token reply on a GB10. - The solo slot keeps its rows when idle; it gives them back only when memory is short (an evicted kept end, the newest stream ending, or an idle solo slot freed for another stream's growth). - It grows by doubling (at least STEP rows), so a long session recaptures a handful of times, not every request. - `warm()` captures its graphs last, at the rows requests will find (the warm request had grown the slot after the captures, which discarded them). tests/test_cuda_growing_caches.py: the slot keeps its rows across a request's end, gives them to another stream when the gate is short, and grows 8192 -> 16384 -> 32768 -> the window; its decoder helper sets the port's new attributes (`solo`, `solo_on`, `planning`), so the file's three existing decoder tests run again on the port. GB10, EXL3 3.05bpw, greedy, 512 tokens, two starts: a streams=4 engine serving one request 18.41/18.56 -> 12.18/12.20 ms/token (= streams=1's 12.18/12.19); two streams 99.8/99.1 -> 111.7/110.8 tok/s and four 146.8/145.1 -> 157.6/157.8 (0.6.0: 111.9/111.5 and 158.4/157.9). No captures during any measured reply; every reply byte-identical to its solo run. fix(qwen4_exp cuda): the graph slot is recognised through rank 0's plan Shadows too On two ranks, rank 0 plans on Shadows of the slots, and `dec.solo.st` is itself a Shadow there. `_is_solo` unwrapped only its argument, so it was never true while planning: the two-rank path kept resizing the graph slot (and recapturing its graphs) as before #180. It now compares the slots the Shadows stand for, and an idle graph slot can be released under memory pressure while planning too (its resize is recorded for rank 1 like any other). tests/test_cuda_growing_caches.py: through a Shadow, the graph slot is recognised, keeping its rows records only a reset, and a release records the resize. The test fails on 6a3a8b1 (`_is_solo(Shadow)` is False). fix(qwen4_exp cuda): a different lone request takes the graph slot without dropping its graphs Two paths still dropped or broke the graph slot after the first request: - A lone request's prompt end is kept in the slot it finished in, the graph slot. The next lone request with another prompt landed elsewhere and `_move_to_solo` made that slot the graph slot instead (`_state_changed`, a full recapture). On one GB10, Flash Next EXL3, a --parallel 4 engine, four 256-token requests with three prompts: 32 / 30 / 19 graph captures (3.8 / 3.6 / 2.3 s) on every request after the first. Now the kept prompt end moves to a free slot of the same rows (`copy_from`, its snapshot unchanged) and the request takes the graph slot. If no free slot fits without evicting, the old swap stays. On two ranks the kept ends are named by slot in the plan, so they keep the swap too. - With the graph slot keeping its rows, a lone stream from a smaller slot no longer has the same geometry, and `copy_from` failed on the cache tensors' sizes. `copy_from` now takes a source with fewer rows into its first rows (rows past `pos` are written before they are read) and refuses a larger one. The same four requests: 0 captures each, 14.0 / 12.7 / 11.7 / 12.1 ms/token (0.6.1 port: 31.6 / 29.4 / 27.3 / 23.0), every reply byte-identical to the port's, including the one that resumes the moved prompt end. tests/test_cuda_growing_caches.py: a lone stream moves into a graph slot with more rows (no resize, rows and positions carried); a different lone request takes the graph slot while the kept prompt end moves to a free slot with its rows. Both fail on 6ada832 (a size mismatch in copy_from; the graph slot swapped).
…nd its graphs #180's third commit moves a kept prompt end out of the graph slot (one GPU) so a different lone request takes the slot without dropping its graphs. The GPU test still asserted the old swap (the request in another slot), so it failed on #180 (bf16 and int8). It now asserts the new behaviour: the request ends in the graph slot, the slot's graphs are not dropped, the first prompt's kept end is moved rather than evicted, replies equal fresh runs and the resume still hits. Fails without #180, passes with it.
|
Thank you, @jschmied. The lone stream's graph slot now keeps its rows and its captured graphs, in TensorFold 0.6.4: https://github.com/ashhart/TensorFold/releases/tag/v0.6.4 Your first fix is in under your name. Your two follow-ups (the slot recognised through rank 0's plan, and a different lone request keeping the graphs) are in too, but they were folded into our commit fdf456f, so the history does not show your name on them. Sorry about that; the release notes credit you, and we have changed how we land follow-ups so it does not happen again. It passed the same two-Spark exactness run as #141. Great find. |
…its graphs are captured once On the 0.6.1 port every resize of the solo slot (`_grow`, `_shrink`) drops its graphs through `_state_changed`, and a slot starts at 256 rows and shrinks back after each request. A lone request therefore recaptured its graphs mid-decode whenever its context passed the slot's rows: 23 captures, 3.0 s of a 512-token reply on a GB10. - The solo slot keeps its rows when idle; it gives them back only when memory is short (an evicted kept end, the newest stream ending, or an idle solo slot freed for another stream's growth). - It grows by doubling (at least STEP rows), so a long session recaptures a handful of times, not every request. - `warm()` captures its graphs last, at the rows requests will find (the warm request had grown the slot after the captures, which discarded them). tests/test_cuda_growing_caches.py: the slot keeps its rows across a request's end, gives them to another stream when the gate is short, and grows 8192 -> 16384 -> 32768 -> the window; its decoder helper sets the port's new attributes (`solo`, `solo_on`, `planning`), so the file's three existing decoder tests run again on the port. GB10, EXL3 3.05bpw, greedy, 512 tokens, two starts: a streams=4 engine serving one request 18.41/18.56 -> 12.18/12.20 ms/token (= streams=1's 12.18/12.19); two streams 99.8/99.1 -> 111.7/110.8 tok/s and four 146.8/145.1 -> 157.6/157.8 (0.6.0: 111.9/111.5 and 158.4/157.9). No captures during any measured reply; every reply byte-identical to its solo run. fix(qwen4_exp cuda): the graph slot is recognised through rank 0's plan Shadows too On two ranks, rank 0 plans on Shadows of the slots, and `dec.solo.st` is itself a Shadow there. `_is_solo` unwrapped only its argument, so it was never true while planning: the two-rank path kept resizing the graph slot (and recapturing its graphs) as before ashhart#180. It now compares the slots the Shadows stand for, and an idle graph slot can be released under memory pressure while planning too (its resize is recorded for rank 1 like any other). tests/test_cuda_growing_caches.py: through a Shadow, the graph slot is recognised, keeping its rows records only a reset, and a release records the resize. The test fails on 6a3a8b1 (`_is_solo(Shadow)` is False). fix(qwen4_exp cuda): a different lone request takes the graph slot without dropping its graphs Two paths still dropped or broke the graph slot after the first request: - A lone request's prompt end is kept in the slot it finished in, the graph slot. The next lone request with another prompt landed elsewhere and `_move_to_solo` made that slot the graph slot instead (`_state_changed`, a full recapture). On one GB10, Flash Next EXL3, a --parallel 4 engine, four 256-token requests with three prompts: 32 / 30 / 19 graph captures (3.8 / 3.6 / 2.3 s) on every request after the first. Now the kept prompt end moves to a free slot of the same rows (`copy_from`, its snapshot unchanged) and the request takes the graph slot. If no free slot fits without evicting, the old swap stays. On two ranks the kept ends are named by slot in the plan, so they keep the swap too. - With the graph slot keeping its rows, a lone stream from a smaller slot no longer has the same geometry, and `copy_from` failed on the cache tensors' sizes. `copy_from` now takes a source with fewer rows into its first rows (rows past `pos` are written before they are read) and refuses a larger one. The same four requests: 0 captures each, 14.0 / 12.7 / 11.7 / 12.1 ms/token (0.6.1 port: 31.6 / 29.4 / 27.3 / 23.0), every reply byte-identical to the port's, including the one that resumes the moved prompt end. tests/test_cuda_growing_caches.py: a lone stream moves into a graph slot with more rows (no resize, rows and positions carried); a different lone request takes the graph slot while the kept prompt end moves to a free slot with its rows. Both fail on 6ada832 (a size mismatch in copy_from; the graph slot swapped).
…nd its graphs ashhart#180's third commit moves a kept prompt end out of the graph slot (one GPU) so a different lone request takes the slot without dropping its graphs. The GPU test still asserted the old swap (the request in another slot), so it failed on ashhart#180 (bf16 and int8). It now asserts the new behaviour: the request ends in the graph slot, the slot's graphs are not dropped, the first prompt's kept end is moved rather than evicted, replies equal fresh runs and the resume still hits. Fails without ashhart#180, passes with it.
…model wrote (2x DGX Sparks recipe issue ashhart#180) A tool parameter whose schema names no type - `{}`, a description alone, or a reference that resolves nowhere (a missing definition, a cycle, a bad pointer) - came back to the client as a JSON string holding the object the model wrote: `"payload":"{\"id\": 7, \"tags\": [\"alpha\", \"beta\"]}"`. Reproduced on this pair 2026-11-04 with an agent-style tool whose `payload` carried only a description. Upstream keeps an untyped value as text (v1.1.2's rule); this recipe follows the maintainer's decision on MiaAI-Lab/GLM-5.3-Flash-EXL3-2x-DGX-Sparks-TensorFold#180 (reported by jsfs11, traced by SvangenStudios): decode when the schema admits an object or array or is untyped and the text parses as a JSON object or array; scalars, plain words and JSON-quoted strings stay the text the model wrote. A union that admits an object already decoded one here. - tool_params.decode: an untyped schema goes through `untyped`, which parses the text (whole, or left open and closed as a typed object is) and keeps an object or array; `schemaUntyped` names the condition. Tests: `{}` and a description-only schema with an object, an array, an open object, and seven texts that stay text. - tool_stream: an untyped parameter's key is held until its value's first non-blank byte: `{` or `[` buffers the value and decodes it at the close, as a typed value is; anything else streams as text exactly as before (a tool declared without a parameter schema keeps streaming its arguments). A value closed before any byte is the empty string; a value the reply's end cut short is sent whole as a string. - tool_union_witness: the six cases where a kind-less reference carried an object (cycle, missing definition, bad pointer, type-free definition) now expect the object, with the divergence from upstream noted at the gate. Host tests: test-tool-parse-host (43), test-tool-visibility-http-host, test-json-answer-host, check-native-cuda-host pass; the cold host suites give the base tree's failure set (tool_stream_test's cut and witness cases included). Origin: MiaAI-Lab/GLM-5.3-Flash-DGX-Sparks-1104@13f2464 patches/engine 0105-server-an-untyped-tool-parameter-takes-the-JSON-object-or-array-the-model-wrote.patch sha256:28729a0cbb6cb39d07f3f5d07ac1ab1868814b62c5da7ad0c679a1595b9df8f9
On the 0.6.1 port, every resize of the lone stream's graph slot drops its graphs:
_growand_shrinkcall_state_changed. The slot starts at 256 rows, grows to 8,192 once a reply's context passes them, and shrinks back whenthe request ends. So every lone request recaptures its graphs mid-reply: 23 captures, 3.0 s of a 512-token reply on a
GB10. Two and four streams lose 8–11 % the same way, because the first stream starts alone in the slot.
stream ending, or an idle slot freed for another stream's growth.
STEProws), so a long session recaptures a handful of times rather than every request.warm()captures its graphs last. Before, the warm request grew the slot after the captures, which discarded them.slot it ran in, so the next lone request with another prompt landed elsewhere, and
_move_to_solomade that slot thegraph slot (
_state_changed, a full recapture each request). Now the kept prompt end moves to a free slot of the samerows (
copy_from; its snapshot is unchanged). With no free slot that fits without evicting, the old swap stays.copy_fromtakes a source with fewer rows into its first rows, because the graph slot now keeps more rows than astream moving in may have. Rows past
posare written before they are read. A larger source is refused.Two ranks: rank 0 plans on
Shadows of the slots,dec.solo.stincluded, so_is_solocompares the slots theShadows stand for. Keeping the rows records only a reset for rank 1, and a release records the resize like any other.
(The first commit compared a Shadow with the real slot and never matched while planning, so it did nothing on two ranks.
BHCC2025's two-rank run showed it. Fixed in the second commit.) Two ranks keep the slot swap for kept prompt ends,
because the plan names kept ends by slot.
Measured
One GB10, Flash Next EXL3 3.05bpw, greedy, 512 tokens of code per stream, two starts each:
cb5101d--parallel 4, one request (ms/token)--parallel 1(ms/token)Every reply is byte-identical in all three columns.
Lone requests one after another with different prompts (
--parallel 4, 256 tokens each; the last request resumes thefirst one's kept prompt end):
cb5101dThe replies are byte-identical, including the resumed one.
Tests
tests/test_cuda_growing_caches.py:gate is short. It also checks that the slot grows 8,192 → 16,384 → 32,768 → the window.
Shadowwhile planning: it is recognised, keeping its rows records only areset, and a release records the resize. It fails on the first commit.
solo,solo_on,planning). Its three existingdecoder tests failed on
cb5101dwithAttributeError: ... 'solo'and pass again.carried), and a different lone request takes the graph slot while the kept prompt end moves to a free slot with its
rows. Both fail on the second commit (a size mismatch in
copy_from; the slot swapped).tests/cuda/test_flashnext_tp_multi.py's lone-stream testasserts the new behaviour (the graph slot and its graphs kept, the first prompt's kept end moved, not evicted).
With it,
test_cuda_growing_caches.pyandtests/cuda/test_flashnext_{tp_multi,multi,tp,prompt_cache,kvquant}.pygive 180 passed, 1 skipped on one GB10 here (178 / 3 on theirs).
tests/cuda/test_flashnext_multi.pypasses 27 of 27 on this PR and oncb5101d.I ran the 14 multi-decoder host test files on both commits. This PR fails 29,
cb5101dfails 32, and the 29 are asubset of the 32 (211 pass here). The remainder fail on this machine for other reasons (mostly
mlxnot installed).Not covered: int8/int4 KV, a two-rank run of the second and third commits (one GPU here), and a server under memory pressure with
the slot holding its rows.
Written with AI assistance (Claude Code); the author reviewed every change.