Skip to content

docs: the CUDA memory plan, what each setting decides and the file that reads it - #3028

Merged
ashhart merged 6 commits into
ashhart:mainfrom
Bizuayeu:docs/memory-knobs
Nov 13, 2026
Merged

ashhart merged 6 commits into
ashhart:mainfrom
Bizuayeu:docs/memory-knobs

Conversation

@Bizuayeu

@Bizuayeu Bizuayeu commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

docs/api.md said the CUDA server "sizes its window" from the free memory less the reserve, on unified memory and on discrete cards. On native CUDA the window is --context, the model's own window at --context 0, or, when it is unset, the family's default capped at the model's own window; on the paged families the streams and pages fill the budget up to the streams' windows plus the cache's pages, so once those exceed it, the free memory after load is the reserve. The two paragraphs now say so. After them, under "Context and errors":

docs/recipes/cuda.md's paragraph on the Python 0.6.6 engine links to the table. No new names and no default changes.

Checks on this head

  • Head commit: c20358d550 (documentation only), the review's three edits on a748ac0581.
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 345 and 345, 0 new. tools/pr_check.py: 0 errors, 0 warnings.
  • Tests run, with the command and pass, fail and skip counts: python -m pytest -q -rs -p no:cacheprovider from the root, on a748ac0581: 450 passed, 86 skipped and 519 subtests passed. Main's CI run of the same job on 3885dceb2bb6 has 452 passed and 84 skipped: the two more skips here are tools/zig/test_nfkd_tables.py's, since this interpreter has Unicode 15.0.0 and the tables pin 16.0.0. c20358d550 changes only docs/api.md, which no test reads, so it was not run again.
  • CI: green on c20358d550 (runs 43330299393 and 43330299202): benchmark-clients (ubuntu-latest, windows-latest), pytest, release-paths (ubuntu-24.04), zig, zig-macos-dev-tools, zig-windows and fmt pass; host-nightly-linux and host-nightly-macos were skipped by the workflow.
  • Not run, and why: inference, since the change is documentation only.

Receipt

n/a: documentation only, so it cannot reach inference.

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 tests: documentation only.)
  • Comments and docstrings are one line. No measurements or history in the source. (No source changes.)
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Thanks @Bizuayeu. I checked each setting and file in the new table against main, and nearly all of it holds:

  • the reserve's floors and the 2 GiB and 0.5 GiB lower limits (zig/src/native/cuda_memory.zig:141-154);
  • the limit counting the weights (Pool.room, :132);
  • --parallel auto meaning up to 8 (zig/src/server/cli.zig:508);
  • the plan's order and the named cache coming before the windows (zig/src/core/kv_pool.zig:81-104);
  • TF_KV_SHARE (zig/src/core/kv_prompts.zig:119-121);
  • GLM's host pages defaulting to one window and 16 pages (zig/src/families/glm/cuda_kv_host.zig:21-25).

The old "sizes its window" wording was wrong, and this fixes it.

Three small edits before it lands:

CI is green, and it's docs only, so it needs no device run. We'll add the CHANGELOG line when we land it.

  • Synthena (Ash's Agent)

@Bizuayeu

Copy link
Copy Markdown
Contributor Author

Three small edits before it lands

#3028 (comment)

Done in c20358d550, checked against main's zig/src/native/cuda_window.zig, cuda_kv_pool.zig and cuda_memory.zig:

The description matches the new head.

@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Thanks @Bizuayeu, all three edits are in. It's queued to land.

  • Synthena (Ash's Agent)

@ashhart
ashhart merged commit 4a68da2 into ashhart:main Nov 13, 2026
9 of 10 checks passed
ashhart added a commit that referenced this pull request Nov 13, 2026
@ashhart

ashhart commented Nov 13, 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 13, 2026

Copy link
Copy Markdown
Owner

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

  • Synthena (Ash's Agent)

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