[PR #99] [MERGED] Fixes from the issues: a start that fails after the RAM tier (#67), steadier CPU-lane timing (#56), the disk reads' size in --calibrate (#67), ZFS's cache as free RAM (#89), the prefetch's settings in the log (#6) #336

Closed
opened 2026-10-29 21:24:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/99
Author: @mw00
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @mw00

Base: main ← Head: issue-fixes-2


📝 Commits (4)

  • 2ef8fc8 Fixes from the issues: pinned buffers before the RAM tier (#67), the CPU lane's timing by its median (#56), ZFS's ARC counted as free RAM (#89), the prefetch's settings said at start (#6)
  • 38e7c14 Calibration: the disk reads' size (STRATA_GLM_READ_CHUNKS) measured too when part of the model is on the SSD (#67)
  • 992da2a CPU lane timing: the fastest of five spread rounds' medians (a burst of other work covered a whole round's runs)
  • 8c7511a Merge remote-tracking branch 'origin/main' into issue-fixes-2

📊 Changes

12 files changed (+285 additions, -54 deletions)

View changed files

📝 README.md (+5 -3)
📝 include/strata/core/glm_model.hpp (+4 -0)
📝 maya.py (+26 -6)
📝 serve/server.py (+3 -0)
📝 serve/test_server.py (+7 -0)
📝 src/core/glm_fast_path.cu (+108 -36)
📝 src/core/glm_fast_state.hpp (+6 -0)
📝 src/core/glm_prefill.cu (+3 -2)
📝 src/program/generate.cpp (+3 -0)
📝 tools/calibrate_glm.py (+49 -7)
📝 tools/test_calibrate_glm.py (+48 -0)
📝 tools/test_maya_models.py (+23 -0)

📄 Description

Fixes and improvements from the open issues, each small and tested on our machines.

What changes

  • #67: a start no longer fails right after the RAM tier.
    • On an RTX 5090 Laptop with 64 GB (Windows), every start whose RAM tier came out at 45.3 GB or more failed with pinned disk staging did not allocate: the driver's pinning cap was reached by the tier, and the small pinned buffers after it could not get any.
    • Those buffers (the disk reads' staging, the table updates) are now pinned before the tier, so a cap shrinks the tier instead.
    • A refused tier now shrinks by 1/32 a try for its first four tries (1/8 after). A tier just over a cap loses ~3%, not the 12% of a 1/8 step.
  • #56: the CPU lane's timing at start no longer swings between starts.
    • It was 16 runs in about 40 ms, averaged. A burst of other work on the CPU (the OS reclaiming memory right after the RAM tier was pinned, a desktop's background jobs) covered all of them. One start on a V100 timed an expert at 0.63 ms against the usual 0.32, its CPU lane took half its share, and decode lost 16% until the next restart.
    • Now: five rounds of 16 runs, ~100 ms apart, with the same work between them to keep the clocks up. The time is the fastest round's median: other work only adds time.
  • #67: --calibrate also measures the disk reads' size.
    • Each expert read from the SSD comes in 3 x STRATA_GLM_READ_CHUNKS pieces (8).
    • On a Windows laptop's Intel RST RAID, 4 was 15% faster. On Mercury (Linux, NVMe, Maya-M-Derisked: 13 disk reads a token) 8 stays the fastest: 12.6 tok/s against 12.3 at 4 and 11.8 at 2, interleaved.
    • So the tuning now tries 4, and then 2, against the engine's 8 when part of the model lives on the SSD. A size is kept only when it beats 8 by more than 3% in an interleaved re-measurement, like the CPU lane's settings.
    • It measures through one engine, with a new per-request strata_tune key, read_chunks, that the server passes on.
  • #89: ZFS's cache counts as free RAM.
    • ZFS's ARC gives memory back under pressure as the page cache does, but MemAvailable leaves it out. After a 95 GB download the ARC held 54 GB and the RAM tier was sized from 5 GB.
    • The engine's RAM measurements (the tier, a split's re-measure, the landing ring, an APU's sizing) and the setup's now add what the ARC holds above its floor (c_min). The engine log says so when it does.
  • #6: the prefetch says its settings at start. STRATA_GLM_PREFETCH_N and its three settings were read once and shown nowhere. The log now has one line, and it says when PREFETCH_N above 2 was read as 2.
  • README: a row for STRATA_GLM_READ_CHUNKS, the tuning paragraph names it, and the prefetch row says the cap.

Checks

On 1x Tesla V100 (Uranus, Maya-S), against v1.0.32:

  • the greedy tokens are identical, and decode is the same (18.1 vs 18.0 tok/s);
  • the RAM tier is the same size;
  • the prefetch line comes out right.

The CPU lane's timing over starts (an expert's ms on the CPU; the usual 0.32):

quiet (3 starts) under bursty CPU load (60 ms busy / 140 ms idle on every core, 5 starts)
v1.0.32 0.319-0.320 0.41, 0.66, 0.61, 0.53, 0.97
this PR 0.319 0.49, 0.32, 0.52, 0.32, 0.47

The load test is much harsher than a desktop's background work; the worst start goes from 3x the true time to 1.6x.

Also:

  • Windows: the engine compiles;
  • tools/test_maya_models.py (21, with 2 new for the ZFS reading) and tools/test_calibrate_glm.py (20, with 4 new for the disk reads' size) pass;
  • a server test covers the new tune key.

On 2x Tesla V100 (Mercury, Maya-M-Derisked, ~13 expert reads a token from the SSD), against v1.0.32, alone and merged with #93 and #94:

  • the same greedy tokens, the same answers across a conversation's turns, the same sampled picks (six settings);
  • the RAM tiers the same size;
  • decode the same or better (13.0 / 12.8 against 12.5 / 12.7 tok/s);
  • the server end to end, the Python tests and #50's stress run pass.

A real tools/calibrate_glm.py run (20 minutes) went through its new step. 4 pieces measured level with 8 (11.31 against 11.27 tok/s), and 2 looked faster once (11.95). In the interleaved re-measurement 2 did not beat 8 (10.0 / 11.4 / 11.2 against 11.4 / 11.3 / 11.5), so 8 stayed, as the hand sweep found on this drive.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mw00/project-maya/pull/99 **Author:** [@mw00](https://github.com/mw00) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `issue-fixes-2` --- ### 📝 Commits (4) - [`2ef8fc8`](https://github.com/mw00/project-maya/commit/2ef8fc8eb6f481cee28dacb19bbde8d0a0c429ca) Fixes from the issues: pinned buffers before the RAM tier (#67), the CPU lane's timing by its median (#56), ZFS's ARC counted as free RAM (#89), the prefetch's settings said at start (#6) - [`38e7c14`](https://github.com/mw00/project-maya/commit/38e7c1483a1bc1edb3b9abeedb52ad8152c7b1f2) Calibration: the disk reads' size (STRATA_GLM_READ_CHUNKS) measured too when part of the model is on the SSD (#67) - [`992da2a`](https://github.com/mw00/project-maya/commit/992da2acb9d9cfdb9a8a404c4916b2110a97e4c3) CPU lane timing: the fastest of five spread rounds' medians (a burst of other work covered a whole round's runs) - [`8c7511a`](https://github.com/mw00/project-maya/commit/8c7511a0640a581926b2a14dc1ea43aa9d5b7d76) Merge remote-tracking branch 'origin/main' into issue-fixes-2 ### 📊 Changes **12 files changed** (+285 additions, -54 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+5 -3) 📝 `include/strata/core/glm_model.hpp` (+4 -0) 📝 `maya.py` (+26 -6) 📝 `serve/server.py` (+3 -0) 📝 `serve/test_server.py` (+7 -0) 📝 `src/core/glm_fast_path.cu` (+108 -36) 📝 `src/core/glm_fast_state.hpp` (+6 -0) 📝 `src/core/glm_prefill.cu` (+3 -2) 📝 `src/program/generate.cpp` (+3 -0) 📝 `tools/calibrate_glm.py` (+49 -7) 📝 `tools/test_calibrate_glm.py` (+48 -0) 📝 `tools/test_maya_models.py` (+23 -0) </details> ### 📄 Description Fixes and improvements from the open issues, each small and tested on our machines. ## What changes - **#67: a start no longer fails right after the RAM tier.** - On an RTX 5090 Laptop with 64 GB (Windows), every start whose RAM tier came out at 45.3 GB or more failed with `pinned disk staging did not allocate`: the driver's pinning cap was reached by the tier, and the small pinned buffers after it could not get any. - Those buffers (the disk reads' staging, the table updates) are now pinned before the tier, so a cap shrinks the tier instead. - A refused tier now shrinks by 1/32 a try for its first four tries (1/8 after). A tier just over a cap loses ~3%, not the 12% of a 1/8 step. - **#56: the CPU lane's timing at start no longer swings between starts.** - It was 16 runs in about 40 ms, averaged. A burst of other work on the CPU (the OS reclaiming memory right after the RAM tier was pinned, a desktop's background jobs) covered all of them. One start on a V100 timed an expert at 0.63 ms against the usual 0.32, its CPU lane took half its share, and decode lost 16% until the next restart. - Now: five rounds of 16 runs, ~100 ms apart, with the same work between them to keep the clocks up. The time is the fastest round's median: other work only adds time. - **#67: `--calibrate` also measures the disk reads' size.** - Each expert read from the SSD comes in 3 x `STRATA_GLM_READ_CHUNKS` pieces (8). - On a Windows laptop's Intel RST RAID, 4 was 15% faster. On Mercury (Linux, NVMe, Maya-M-Derisked: 13 disk reads a token) 8 stays the fastest: 12.6 tok/s against 12.3 at 4 and 11.8 at 2, interleaved. - So the tuning now tries 4, and then 2, against the engine's 8 when part of the model lives on the SSD. A size is kept only when it beats 8 by more than 3% in an interleaved re-measurement, like the CPU lane's settings. - It measures through one engine, with a new per-request `strata_tune` key, `read_chunks`, that the server passes on. - **#89: ZFS's cache counts as free RAM.** - ZFS's ARC gives memory back under pressure as the page cache does, but MemAvailable leaves it out. After a 95 GB download the ARC held 54 GB and the RAM tier was sized from 5 GB. - The engine's RAM measurements (the tier, a split's re-measure, the landing ring, an APU's sizing) and the setup's now add what the ARC holds above its floor (`c_min`). The engine log says so when it does. - **#6: the prefetch says its settings at start.** `STRATA_GLM_PREFETCH_N` and its three settings were read once and shown nowhere. The log now has one line, and it says when `PREFETCH_N` above 2 was read as 2. - **README:** a row for `STRATA_GLM_READ_CHUNKS`, the tuning paragraph names it, and the prefetch row says the cap. ## Checks On 1x Tesla V100 (Uranus, Maya-S), against v1.0.32: - the greedy tokens are identical, and decode is the same (18.1 vs 18.0 tok/s); - the RAM tier is the same size; - the prefetch line comes out right. The CPU lane's timing over starts (an expert's ms on the CPU; the usual 0.32): | | quiet (3 starts) | under bursty CPU load (60 ms busy / 140 ms idle on every core, 5 starts) | |---|---|---| | v1.0.32 | 0.319-0.320 | 0.41, 0.66, 0.61, 0.53, **0.97** | | this PR | 0.319 | 0.49, **0.32**, 0.52, **0.32**, 0.47 | The load test is much harsher than a desktop's background work; the worst start goes from 3x the true time to 1.6x. Also: - Windows: the engine compiles; - `tools/test_maya_models.py` (21, with 2 new for the ZFS reading) and `tools/test_calibrate_glm.py` (20, with 4 new for the disk reads' size) pass; - a server test covers the new tune key. On 2x Tesla V100 (Mercury, Maya-M-Derisked, ~13 expert reads a token from the SSD), against v1.0.32, alone and merged with #93 and #94: - the same greedy tokens, the same answers across a conversation's turns, the same sampled picks (six settings); - the RAM tiers the same size; - decode the same or better (13.0 / 12.8 against 12.5 / 12.7 tok/s); - the server end to end, the Python tests and #50's stress run pass. A real `tools/calibrate_glm.py` run (20 minutes) went through its new step. 4 pieces measured level with 8 (11.31 against 11.27 tok/s), and 2 looked faster once (11.95). In the interleaved re-measurement 2 did not beat 8 (10.0 / 11.4 / 11.2 against 11.4 / 11.3 / 11.5), so 8 stayed, as the hand sweep found on this drive. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:24:20 +07:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mw00/project-maya#336
No description provided.