Repository navigation
Dashboard: prefill queue progress and a working Memory tile - #738
Conversation
Status gains optional fill_prompt_tokens and fill_tokens_left; a stream's atomic fill_at counts the prompt tokens its pass has prefilled; the lane host's status read sums them over the admitted jobs still prefilling, and /stats carries the pair only while a fill runs. The dashboard's dialside tile counts the tokens left and estimates the wait to the first token from the poll-to-poll drain, and the dial enters prefill mode as soon as a prompt starts.
… footprint The lane host's memoryFn returns null unless the family host wires a MemorySource, and only the CUDA host did, so /stats carried an empty memory object on a Mac and the dashboard's Memory tile fell back to a dash. The GLM host now wires one: the process's physical footprint (rusage_info_v4, Metal buffers included) as active, and the load limit read at load as peak, so the tile and the /metrics gauges show real numbers.
|
Hello @heitke, Thank you for the prefill countdown and for wiring a memory object into the GLM dashboard. readMemory stores the load limit in peak and drops reset_peak (glm_host.zig:72). active is the process footprint, which is the right gauge. peak should be the high-water mark. /health?reset_peak=1 reaches that flag from status_routes.zig:27, and /metrics publishes the value as device_memory_peak_bytes, whose help text is the high-water mark since start or the last reset (metrics.zig:140). The limit does not move when the footprint does, and the reset does not clear it. cache and pinned stay 0, so pinned_memory_bytes publishes as 0. Please store the high-water mark in peak, and clear it when reset_peak is set. A push with that is the update we need. Thank you again. |
A /stats poll raced the engine thread's completion path: deliver() freed a job that was still in the host's admitted list, and the fill-total reader walked that list, so a poll at the wrong moment read freed memory. A job now leaves the lists inside deliver, before finish runs it down; the status tests poll at the finished event, where the old order still counted the dying job. The GLM host's memory tile put the configured load limit in the peak field. The limit is a plan, not a measurement: it moves to a limit field of its own, the peak is the kernel's lifetime footprint peak, and the tile labels each number for what it is. Mac family hosts share the reading through cache_fit.hostMemory. The page's ETA mixed the drains of different prompts whenever one fill followed another without an idle poll between. The snapshot now carries fill_run, a marker that changes when the filling set does, and the page resets its samples on it; the label says the queue drains, which is what the aggregate of several lanes' remaining work estimates. Nemotron's prompt pass advanced fill_at past what the GPU had landed, so the countdown reached zero while the last chunk still ran. It stores landed tokens now, and a restored prefix counts as done the moment it lands.
…uery A review of the GLM host's memory counts pointed out that the peak field carried the load limit, and the repair put the kernel's lifetime peak there — which never resets, while /health?reset_peak=1 and the metrics' help text say the peak is the most device memory held since start or the last reset. The Mac hosts now keep that mark themselves: the session high-water mark of the process footprint, cleared to the current footprint when the reset is asked for, climbing again from there. /health's memory object carries the limit.
…he atomics The reset_peak query restarts the Mac hosts' stored high-water mark at the footprint now (a fetchMax alone never lowered it), the fill totals read the engine thread's fill_on flag instead of the plain lifecycle fields it writes without the host's lock, a requeue takes its job off the lists before the stream's teardown, and the cancellation walk joins the status reader's critical section. The remaining Mac family hosts report the process footprint's memory counts, and their prompt passes store landed fill progress. The peak's regression test runs on deterministic samples.
… fill counters says so
|
Fixes should be in and ready for merge! |
…, dashboard) Layout only: trailing comments onto their own line, closing commas and zig fmt, one template literal moved to the next line. The backend vtables #738 extends keep one line each, as main lays out every family's but Nemotron's, which #738 put on one line to keep its file under 600 lines.
…host_end.zig #738's fill tracking took lane_host.zig from 600 to 606 lines. takeCancels, failAll and closeAll move as they are, now free functions taking the host (pub, and closeAll calls takeCancels directly); the three callers name the new file. lane_host.zig is 553 lines.
…ps.zig #738's fill status took flashnext_host.zig from 599 to 604 lines. Snaps moves as it is (its functions pub for the host's vtable), with the two imports only it used; flashnext_host.zig is 536 lines.
fillTotals counted every admitted job whose prompt pass had not reported. The 27B's warm pass, which prefills the conversation and the reply for the next turn, showed as a new fill straight after each reply, and the next prompt's fill met it (two fill_runs, tokens left rising). Background jobs now stay out of the totals and out of fill_run. The test polls status at each chunk of a warm pass (no fill keys) and of the request after it (its prompt counted).
A stream's fill_at started at 0. GLM and Nemotron store the restored length once their restore is done, but the 27B stored nothing until its first chunk landed, so a resumed turn showed its whole prompt as left until then. Stream.init now starts fill_at at the kept prefix's length, and the 27B stores what its restore kept (0 when it failed) before its first chunk, as GLM and Nemotron do. The test polls a resumed turn's status before its pass lands a chunk: 8 of 16 tokens left, not 16.
#835 (@heitke) reset to 027ddea: his two commits and public main merged in. The candidate carries the guard as re-landed (5477b36, e5b9686) with the landing work after it, so this merge changes no file: fourteen of its twenty files merge to the tip's content as they are, and the six that conflict keep the tip's text, which holds his change in the landed form (glm_expiry.zig and prompt_cache_policy.zig wrapped under 120 columns; reported()'s three cases as one condition on the cache key; the requeue teardown after the list removal, as #738's landing ordered it; victimBut public for the disk rows; engine_api's test imports in lane_host_test.zig; glm_host.zig's image offer, which his base lacks).
#738's line gains its landing fixes (a warm pass is no fill; a resumed prompt counts its restored prefix as filled). New lines: the Qwen-VL tower releases its pipelines on a failed load; tf-qwen-vision --bound; every family's image identity in the cache key (bytes and grid, 62 bits, carried whole in the markers' cache words); CUDA's --vision taken per family. GLM's vision line no longer says every other native engine refuses the flag, now that the 27B and Super VL read images.
|
Thank you, @heitke. The prefill countdown and the memory numbers ship in TensorFold 1.0.12, merged with your commits as they are ( At landing we wrapped the lines past 120 columns and moved three lane host functions into
Could you tell us here if the second reads wrong to you? With both, our dashboard checks pass in full on the 27B and on GLM-5.3-Flash: every prompt counts down within one Posted by Ash's AI Assistant Synthena |
…ng Memory tile requeue takes the head's order (off the lists, then the teardown) and keeps the candidate's prefix report and recall release in that teardown; engine_api's tests keep lane_host_rows_test beside the head's moved fill test; glm_host keeps its vision offer and glm_disk beside the head's memory reader.
… routes, dashboard) Layout only: trailing comments onto their own line, closing commas and zig fmt, one template literal moved to the next line. The backend vtables ashhart#738 extends keep one line each, as main lays out every family's but Nemotron's, which ashhart#738 put on one line to keep its file under 600 lines.
…host_end.zig ashhart#738's fill tracking took lane_host.zig from 600 to 606 lines. takeCancels, failAll and closeAll move as they are, now free functions taking the host (pub, and closeAll calls takeCancels directly); the three callers name the new file. lane_host.zig is 553 lines.
…ps.zig ashhart#738's fill status took flashnext_host.zig from 599 to 604 lines. Snaps moves as it is (its functions pub for the host's vtable), with the two imports only it used; flashnext_host.zig is 536 lines.
…shhart#862, ashhart#863, ashhart#864, ashhart#866, ashhart#821, ashhart#822, ashhart#823, ashhart#851, ashhart#738, ashhart#523, ashhart#547 and ashhart#875, with the HIP and loader fixes
fillTotals counted every admitted job whose prompt pass had not reported. The 27B's warm pass, which prefills the conversation and the reply for the next turn, showed as a new fill straight after each reply, and the next prompt's fill met it (two fill_runs, tokens left rising). Background jobs now stay out of the totals and out of fill_run. The test polls status at each chunk of a warm pass (no fill keys) and of the request after it (its prompt counted).
…t#738) A stream's fill_at started at 0. GLM and Nemotron store the restored length once their restore is done, but the 27B stored nothing until its first chunk landed, so a resumed turn showed its whole prompt as left until then. Stream.init now starts fill_at at the kept prefix's length, and the 27B stores what its restore kept (0 when it failed) before its first chunk, as GLM and Nemotron do. The test polls a resumed turn's status before its pass lands a chunk: 8 of 16 tokens left, not 16.
ashhart#835 (@heitke) reset to 7d879fb: his two commits and public main merged in. The candidate carries the guard as re-landed (99c8944, af0fecc) with the landing work after it, so this merge changes no file: fourteen of its twenty files merge to the tip's content as they are, and the six that conflict keep the tip's text, which holds his change in the landed form (glm_expiry.zig and prompt_cache_policy.zig wrapped under 120 columns; reported()'s three cases as one condition on the cache key; the requeue teardown after the list removal, as ashhart#738's landing ordered it; victimBut public for the disk rows; engine_api's test imports in lane_host_test.zig; glm_host.zig's image offer, which his base lacks).
ashhart#738's line gains its landing fixes (a warm pass is no fill; a resumed prompt counts its restored prefix as filled). New lines: the Qwen-VL tower releases its pipelines on a failed load; tf-qwen-vision --bound; every family's image identity in the cache key (bytes and grid, 62 bits, carried whole in the markers' cache words); CUDA's --vision taken per family. GLM's vision line no longer says every other native engine refuses the flag, now that the 27B and Super VL read images.
Dashboard: prefill queue progress and a working Memory tile
Two dashboard enhancements, both server-side data + the existing page, plus the
review repairs: lifetime-safe fill totals, honest memory semantics, a robust
ETA, landed-progress reporting on Nemotron, and a fill marker that cannot
collide.
1. Prefill queue: tokens left and ETA
Statusgains optionalfill_prompt_tokensandfill_tokens_left; a stream'satomic
fill_atcounts the prompt tokens its pass has landed; the lane host'sstatus read sums them over the admitted jobs still prefilling, and
/statscarries the pair only while a fill runs — with
fill_run, a marker thatchanges whenever the filling set does (a prompt starts, ends, is cancelled or
requeued). The marker hashes each filling job's request id and admission
sequence as separate Wyhash inputs (XOR of the raw values collides: request id
2 at admission 0 and id 3 at admission 1 read alike on equal-length prompts),
and stays within 53 bits so the JSON number reaches the page's JavaScript
exactly. The page resets its drain samples on a
fill_runchange (and whenleftrises, a fill restarted), so one prompt's drain is never mixed withanother's. The tile's label says the queue drains, because the aggregate of
several lanes' remaining work estimates that, not the wait to a first token.
2. Memory tile shows real numbers on Mac
The lane host's
memoryFnreturns null unless the family host wires aMemorySource, and only the CUDA host did — so/statscarried an emptymemoryobject on a Mac and the dashboard's Memory tile fell back to a dash.Mac family hosts now share
cache_fit.hostMemory: the process's physicalfootprint (
rusage_info_v4) asactive, the footprint's session high-watermark as the measured
peak, and the configured load limit asMemory.limit— a budget, never folded into a measured field.
peakis the mark since theprocess started or the last
/health?reset_peak=1: a reset stores thefootprint now (replacing the old mark), and the next reading climbs from
there —
/health,/stats,/memoryand/metricsall read the samegauges. The tile labels each number for what it is (
limit X GiB · peak Y GiB), and the bar fills against the limit when there is one. The CUDA host'sresettable peak and its counters are untouched; cache and pinned stay 0 rather
than being relabelled as measured allocations.
3. The engine thread's completion path is lifetime-safe for status readers
deliver()used to free a job that was still in the host'sadmittedlist —the removal followed
finish()— and the fill-total reader walks that listunder the lock, so a concurrent
/statspoll could read freed memory. A jobnow leaves the lists inside
deliver, beforefinishruns; completion,cancellation, failure, requeue and the lone driver's handoff all destroy a job
only after a locked removal. Regression tests poll at the finished event — the
exact moment a concurrent reader races — and the old order fails them.
4. Supported prefill-progress coverage, stated honestly
A backend that never stores
fill_atnow declares that: the lane-backendvtable carries
reports_fill, set by the family backends that store landedprogress (GLM, GLM-DSA, Nemotron, Qwen3.5 — and carried through CUDA's
wrapper). Where it is unset, the status reader reports
fill_unknowninsteadof counting the whole prompt as unlanded, and the page shows "prefilling ·
this backend reports no fill progress" rather than idle or a guessed number.
The Flash Next host's own status path reports the same
fill_unknownwhileits prompt pass runs. Backends covered with landed counters: GLM, GLM-DSA,
Nemotron (landed tokens only,
at - rows), Qwen3.5 and the 27B; no ETA iscomputed for the uncovered ones and the queue's drain estimate is never
presented for a queue the server cannot count.
Testing (host checks; the model/device smoke test is separate)
bash zig/tests/server/zig_test.shand the engine-seam module pass on themerged head (211 + 117; includes the new collision, replacement and
unknown-progress tests, the dashboard contract test and origin/main's fill
and memory suites). The new tests fail on the previous marker code.
python3 tools/zig/lean_check.py— 527 problems on the branch, 527 onorigin/main(zero added).zig build native -Dcpu=apple_m1 -Dversion=1.0.9— builds clean;zig build test— pass (final counts in the thread below).zig fmt --check build.zig zigclean;git diff --checkclean.node --checkon the page's script, plus a behavioral DOM-stub harnessdriving
apply()with realistic snapshot sequences: limit/peak labeling,the idle dash, the queue-drain ETA, the
fill_runreset, a restarted fill,the idle return, the unknown-ETA dash and the unknown-progress state.
user's server restart; run separately by the maintainer), and the CUDA
device path (no CUDA machine here).