[PR #25] [MERGED] GLM: opt-in RAM-resident tier, nothing evicted to disk #286

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

📋 Pull Request Information

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

Base: main ← Head: glm-ram-resident


📝 Commits (1)

  • 6fa5d11 GLM: opt-in RAM-resident tier, nothing evicted to disk

📊 Changes

5 files changed (+86 additions, -9 deletions)

View changed files

📝 README.md (+1 -0)
📝 src/core/glm_fast_path.cu (+59 -9)
📝 src/core/glm_fast_state.hpp (+4 -0)
📝 src/core/glm_prefill.cu (+2 -0)
📝 src/program/generate.cpp (+20 -0)

📄 Description

What this changes

--glm-ram-resident (STRATA_GLM_RAM_RESIDENT=1) sizes the pinned RAM tier so it holds every expert that is not in VRAM, and a demotion never drops an expert to disk. The start fails if the tier cannot hold them (STRATA_GLM_RAM_GB, or a smaller --max-context). --glm-ram-slack N (STRATA_GLM_RAM_SLACK, default 16) is extra slots per MoE layer for a demotion that has not landed yet.

A demotion keeps the VRAM copy live until the copy into RAM has landed, so a route in that window still hits VRAM. The prompt path publishes those landed copies before it borrows the pool tail.

What it leaves alone

Default off. With the flag unset the tier cap, the disk-read spare slots, and the demote path are the ones this tree already has.

Measured

Same build, RTX 4090 D, 128 GB RAM, Windows, Maya-S IQ2_XXS, context 262144, one 38188-token prompt, 512 new tokens.

cold warm disk
flag off 11.8 tok/s 9.2 tok/s 1.8 then 2.3 reads/tok (36 then 58 ms/tok)
resident, plus STRATA_GLM_PROMOTE_MIN=6 (separate change) 22.1 tok/s 24.8 tok/s 0

The warm stock run was slower than the cold one: the cold tail rotated back onto disk. This flag is what removes that. The paired run also had STRATA_GLM_PROMOTE_MIN=6, which is not in this PR. An earlier split on the same machine, resident only, was 18.6-20.1 tok/s with disk 0, against a stock run that still read the disk. Needs enough free RAM for the pin (66 GB on that box). Not measured on Linux or on a second GPU.


🔄 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/25 **Author:** [@handmade0octopus](https://github.com/handmade0octopus) **Created:** 10/8/2026 **Status:** ✅ Merged **Merged:** 10/8/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `glm-ram-resident` --- ### 📝 Commits (1) - [`6fa5d11`](https://github.com/mw00/project-maya/commit/6fa5d116005befa7dd0724abf1eab11d0608cecf) GLM: opt-in RAM-resident tier, nothing evicted to disk ### 📊 Changes **5 files changed** (+86 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -0) 📝 `src/core/glm_fast_path.cu` (+59 -9) 📝 `src/core/glm_fast_state.hpp` (+4 -0) 📝 `src/core/glm_prefill.cu` (+2 -0) 📝 `src/program/generate.cpp` (+20 -0) </details> ### 📄 Description ## What this changes `--glm-ram-resident` (`STRATA_GLM_RAM_RESIDENT=1`) sizes the pinned RAM tier so it holds every expert that is not in VRAM, and a demotion never drops an expert to disk. The start fails if the tier cannot hold them (`STRATA_GLM_RAM_GB`, or a smaller `--max-context`). `--glm-ram-slack N` (`STRATA_GLM_RAM_SLACK`, default 16) is extra slots per MoE layer for a demotion that has not landed yet. A demotion keeps the VRAM copy live until the copy into RAM has landed, so a route in that window still hits VRAM. The prompt path publishes those landed copies before it borrows the pool tail. ## What it leaves alone Default off. With the flag unset the tier cap, the disk-read spare slots, and the demote path are the ones this tree already has. ## Measured Same build, RTX 4090 D, 128 GB RAM, Windows, Maya-S IQ2_XXS, context 262144, one 38188-token prompt, 512 new tokens. | | cold | warm | disk | | --- | --- | --- | --- | | flag off | 11.8 tok/s | 9.2 tok/s | 1.8 then 2.3 reads/tok (36 then 58 ms/tok) | | resident, plus `STRATA_GLM_PROMOTE_MIN=6` (separate change) | 22.1 tok/s | 24.8 tok/s | 0 | The warm stock run was slower than the cold one: the cold tail rotated back onto disk. This flag is what removes that. The paired run also had `STRATA_GLM_PROMOTE_MIN=6`, which is not in this PR. An earlier split on the same machine, resident only, was 18.6-20.1 tok/s with disk 0, against a stock run that still read the disk. Needs enough free RAM for the pin (66 GB on that box). Not measured on Linux or on a second GPU. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:23:48 +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#286
No description provided.