[PR #15] [CLOSED] Opt-in RAM shadows for the expert tiers (STRATA_GLM_RAM_SHADOW): fewer SSD rereads with a large RAM tier #279

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

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/15
Author: @boxwrench
Created: 10/8/2026
Status: ❌ Closed

Base: main ← Head: amd/glm-ram-shadow


📝 Commits (2)

  • 8ae9940 Keep promoted experts' RAM copies as shadows (STRATA_GLM_RAM_SHADOW)
  • fb867ee Document STRATA_GLM_RAM_SHADOW in the AMD notes

📊 Changes

3 files changed (+69 additions, -8 deletions)

View changed files

📝 docs/AMD_MAYA.md (+14 -0)
📝 src/core/glm_fast_path.cu (+52 -8)
📝 src/core/glm_fast_state.hpp (+3 -0)

📄 Description

An opt-in expert tier mode, STRATA_GLM_RAM_SHADOW=1, for machines whose RAM tier holds most of the model. Off by default: with it unset every path takes its original branch. Tracking: #6.

The problem

With exclusive tiers an expert is in VRAM or in the RAM tier, never both. Promoting it frees its RAM copy, so when it later leaves VRAM it is copied back (device-to-host) or, if the RAM tier had no room, reread from the SSD. With a large RAM tier and a hot set that moves, STRATA_GLM_TIER_DIAG showed the boundary's clean-up freeing thousands of duplicate RAM copies and the decode rereading several experts a token from disk.

What changes (src/core/glm_fast_path.cu, glm_fast_state.hpp)

  • A promoted expert keeps its RAM copy (a "shadow") instead of releasing it, including a promoted disk read.
  • The boundary's clean-up leaves shadows alone (a deliberate duplicate).
  • Evicting a VRAM expert that still has its shadow just frees the slot: no device-to-host copy.
  • When the RAM tier needs room (a demotion, or the free slots kept for disk reads), shadows are reclaimed first, oldest first, before an expert's only RAM copy.

Measured (v1.0.11, Maya-S, 8K context, STRATA_GLM_RAM_GB=90, greedy, 256-token answers)

exclusive shadows
one RX 7900 XT, answers (median of 10) 15.15 tok/s 18.5 tok/s
one RX 7900 XT, SSD read per request 13.2 GB 4.6 GB
one RX 7900 XT, disk reads per token 5.55 0.87
R9700 + RX 7900 XT (with #14), answers 33.2 tok/s 35.6 tok/s

Prompt speed is unchanged. On this branch's own build: 7/7 smoke checks on one RX 7900 XT (18.8 tok/s) and on two GPUs (36.2 tok/s); earlier, 20 back-to-back requests on one card and 39 on two with no error.

Not tested: CUDA (no NVIDIA toolchain here). The change is in shared engine code but every new branch is behind F->ram_shadow, which is false unless the variable is set.


🔄 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/15 **Author:** [@boxwrench](https://github.com/boxwrench) **Created:** 10/8/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `amd/glm-ram-shadow` --- ### 📝 Commits (2) - [`8ae9940`](https://github.com/mw00/project-maya/commit/8ae9940c68a2b1ceb964b1753fa3e7e0491a3ce1) Keep promoted experts' RAM copies as shadows (STRATA_GLM_RAM_SHADOW) - [`fb867ee`](https://github.com/mw00/project-maya/commit/fb867ee673328bc3b1a501e3e7746286811731df) Document STRATA_GLM_RAM_SHADOW in the AMD notes ### 📊 Changes **3 files changed** (+69 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `docs/AMD_MAYA.md` (+14 -0) 📝 `src/core/glm_fast_path.cu` (+52 -8) 📝 `src/core/glm_fast_state.hpp` (+3 -0) </details> ### 📄 Description An opt-in expert tier mode, `STRATA_GLM_RAM_SHADOW=1`, for machines whose RAM tier holds most of the model. Off by default: with it unset every path takes its original branch. Tracking: #6. ### The problem With exclusive tiers an expert is in VRAM or in the RAM tier, never both. Promoting it frees its RAM copy, so when it later leaves VRAM it is copied back (device-to-host) or, if the RAM tier had no room, reread from the SSD. With a large RAM tier and a hot set that moves, `STRATA_GLM_TIER_DIAG` showed the boundary's clean-up freeing thousands of duplicate RAM copies and the decode rereading several experts a token from disk. ### What changes (`src/core/glm_fast_path.cu`, `glm_fast_state.hpp`) - A promoted expert keeps its RAM copy (a "shadow") instead of releasing it, including a promoted disk read. - The boundary's clean-up leaves shadows alone (a deliberate duplicate). - Evicting a VRAM expert that still has its shadow just frees the slot: no device-to-host copy. - When the RAM tier needs room (a demotion, or the free slots kept for disk reads), shadows are reclaimed first, oldest first, before an expert's only RAM copy. ### Measured (v1.0.11, Maya-S, 8K context, `STRATA_GLM_RAM_GB=90`, greedy, 256-token answers) | | exclusive | shadows | |---|---|---| | one RX 7900 XT, answers (median of 10) | 15.15 tok/s | 18.5 tok/s | | one RX 7900 XT, SSD read per request | 13.2 GB | 4.6 GB | | one RX 7900 XT, disk reads per token | 5.55 | 0.87 | | R9700 + RX 7900 XT (with #14), answers | 33.2 tok/s | 35.6 tok/s | Prompt speed is unchanged. On this branch's own build: 7/7 smoke checks on one RX 7900 XT (18.8 tok/s) and on two GPUs (36.2 tok/s); earlier, 20 back-to-back requests on one card and 39 on two with no error. **Not tested:** CUDA (no NVIDIA toolchain here). The change is in shared engine code but every new branch is behind `F->ram_shadow`, which is false unless the variable is set. --- <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:44 +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#279
No description provided.