mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #81] [MERGED] GLM CPU lane: keep the calibration across starts (STRATA_GLM_CPU_CAL), with a drift guard #322
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#322
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/81
Author: @ksanislo
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/10/2026
Merged by: @mw00
Base:
main← Head:cpu-lane-cal-cache📝 Commits (1)
293249dGLM CPU lane: STRATA_GLM_CPU_CAL= keeps the calibration across starts, with a drift guard📊 Changes
4 files changed (+100 additions, -4 deletions)
View changed files
📝
include/strata/core/glm_model.hpp(+2 -0)📝
src/core/glm_fast_path.cu(+93 -4)📝
src/core/glm_fast_state.hpp(+4 -0)📝
src/program/generate.cpp(+1 -0)📄 Description
Every start times the CPU lane on each GPU: how long the CPU takes to compute an expert, and how long an expert takes over PCIe, once alone and once in a stream of copies. From those times it derives the split between the CPU and the link. These times describe the machine and the model, not the run, yet measuring them costs ~1.7 s a GPU, most of it the 1.5 s wake that keeps the link at full speed while it is timed. On a 4-GPU split that is ~7 s of every start. The times also vary slightly between starts, so the starting plan can differ by an expert from one start to the next.
With
STRATA_GLM_CPU_CAL=<file>, the three times are kept in a plain text file, one line per GPU, and later starts read them instead of timing. The line's key names everything that would change the result: the engine build (its compile date and time, sinceSTRATA_VERSIONstays the same across Maya's releases), the pack, the layer timed, the card (PCI bus id and name), and the CPU-lane pool (its thread count, and whether it is shared). A new build, a card moved to another slot or a different thread count therefore times again by itself, and deleting the file (or one line) forces it. With the variable unset nothing changes.Because a kept calibration could go stale in ways the key doesn't see (BIOS or memory settings, a different CPU governor, or a calibration taken while something else was running), a drift guard checks it against decode. The first 2000 CPU-lane experts of decode after a calibration was timed set a reference: decode's CPU time an expert, stored as a 4th number on the line. After each request, a full window of 2000 experts is compared with it, and 5 windows in a row more than 15% off in the same direction drop the line, so the next start times the lane again. A busy spell during one long answer doesn't trigger it; a calibration that is wrong for the machine does. The check is a few counters read once a request; nothing runs between requests.
Tested on 4x Tesla T4 with Maya-L. A fresh start writes the four lines, and the first request adds their references (0.87–1.16 ms an expert). A restart reads them (all four cards "not timed", the four calibrations taking 6 ms instead of ~6.6 s) and keeps them through 6 requests. With every reference doctored to half its value, three of the four lines were dropped within 6 requests; the fourth card fills its 2000-expert windows more slowly and had not reached 5 yet. Combined with the parallel split load (#80 ), Maya-L's load to first token went from ~142 s to ~89 s from a cold page cache.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.