Skip to content

glm cuda: the idle KV pool's line reads even under TF_GLM_KV_SHARE - #1993

Merged
ashhart merged 2 commits into
ashhart:mainfrom
Bizuayeu:pr/glm-idle-line
Nov 3, 2026
Merged

ashhart merged 2 commits into
ashhart:mainfrom
Bizuayeu:pr/glm-idle-line

Conversation

@Bizuayeu

@Bizuayeu Bizuayeu commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Under TF_GLM_KV_SHARE, an idle server whose prompt cache keeps pool pages logs kv pool idle (UNEVEN), because GLM's report also asks for free == total; with this change it reads Pool.idle()'s free + kept == total there, Spark 25's form from 004655c64, and is unchanged without the share. Only the log line changes: no pool, page or token.

Build TF_GLM_KV_SHARE Rank 0's line after the last stream closes
main 532589e40 16 kv pool idle (UNEVEN): promised 0, free 6131 + store 16 == total 6147
This head 16 kv pool idle: promised 0, free 6131 + store 16 == total 6147
This head off kv pool idle: promised 0, free 6147 + store 0 == total 6147

Checks on this head

  • Head commit: 72a78e008
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 424 and 424, no new findings.
  • Tests run, with the command and pass, fail and skip counts (Linux x86_64 under WSL2): zig build test-cuda-host 291/291 steps (4,483 of 4,499 tests, 16 skipped); zig build test 487/487 steps (2,035 of 2,065 tests, 30 skipped); zig build test-kv-pool 33/33 tests; the GLM host steps (test-glm-prompt-settings-host 6/6, test-glm-tp3-host 8/8, test-glm-pages-host, test-glm-fp8-kv-host, test-glm-prompts-host 7/7); zig build compile-cuda-tests 10/10 steps, also with -Dtarget=aarch64-linux-gnu (the CUDA runner, which CI does not build); zig build compile-config-server 7/7; zig build test-roce-multi-host 40/40 tests; zig build test-tp 33/33 steps; zig fmt --check clean. No failures.
  • CI: green, all seven checks on this head.
  • Not run, and why: Metal, as this file is CUDA's. No test reaches the line: report returns at once under the test build, as Spark 25's does, so the table above is its before and after.

Receipt

  • Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision: main 532589e40 and this head 72a78e008, each built with zig build native (Zig 0.17.0, CUDA 13.3, sm_121); three NVIDIA GB10s at TP=3 over NCCL 2.30.7, driver 580.178.04, --parallel 4 with paged KV; GLM-5.3-Flash XSFP4 (Bizuayeu/GLM-5.3-Flash-XSFP4 at 88736f91). Each launch ran tools/bench_cache.py --require-cold --repeats 1 --streams 1 on an 8K-token prompt (a cold request, a repeated one and one concurrent), and rank 0 printed the same line after each.
  • Paths and platforms the change reaches, which I ran and which I could not: GLM's CUDA engine with paged KV, with the share on and off; I ran both on CUDA (the table above). Metal is not reached.
  • Exactness: n/a, the change is one log line's word and no token passes through it.
  • Decode speed before and after: n/a, as above.
  • Prompt speed before and after: n/a, the line prints when the last stream closes, after prompt processing.
  • Licence of any new weights or drafter: n/a.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. (No new test: report does not run under the test build. The table above is the before and after.)
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off. (A log line.)
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (A log line.)
  • No precision traded for speed. If the bits change, the description says which sums change and why. (No bits change.)
  • Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it, greedy and sampled (the change cannot reach either: the line prints when the last stream closes).

@ashhart

ashhart commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Thanks @Bizuayeu. An independent review on current main (d38bba3):
Verdict: LAND.

Applying it: cleanly on main d38bba3. The lean check stays at 424, the same as main. The author line is a real
GitHub identity (@Bizuayeu, noreply address).

Nothing was built or run here.

What holds

  • One expression changes, in Pages.report (zig/src/families/glm/cuda_pages.zig):
    p.pool.idle() and c.free == c.total becomes p.pool.idle() and (p.e.share_pages or c.free == c.total).
  • Pool.idle() already requires nothing promised, nothing leased and free + kept == total. Under
    TF_GLM_KV_SHARE the prompt cache holds pool pages, so kept can be above 0 on a balanced idle pool, and main
    printed (UNEVEN) for it. The new form is Spark 25's (spark25/backend.zig report), word for word in meaning.
  • Off is main exactly. share_pages is set only by share() in cuda_native.zig (rank 0) and from rank 0's
    flag in cuda_follow.zig. With the share off it is false and the expression is main's.
  • Only rank 0 reaches report (close returns first on other ranks), and only the log word changes. No page,
    pool state or token passes through it.
  • No new test: report returns at once under the test build, the same as Spark 25's. The author's table (GB10,
    TP=3, GLM-5.3-Flash, share on and off) is the before and after.

Small point (not blocking): the receipt was taken on an older main (532589e). The changed lines are identical
on d38bba3, so it carries over.

Device run: none needed beyond the author's.

Bizuayeu and others added 2 commits November 3, 2026 08:28
Under the share the prompt cache holds pool pages, so a balanced idle pool
logged (UNEVEN): Pool.idle() already checks free + kept == total, free ==
total holds only for the copy store. Spark 25's form from 004655c.
@ashhart
ashhart merged commit 9eda955 into ashhart:main Nov 3, 2026
1 of 7 checks passed
@ashhart

ashhart commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Thank you @Bizuayeu. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

@ashhart

ashhart commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Thanks @Bizuayeu! This is in TensorFold 1.2.2, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants