[PR #80] [MERGED] GLM split: load the parts at once, one thread each #321

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

📋 Pull Request Information

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

Base: main ← Head: parallel-split-load


📝 Commits (3)

  • 48e8ae4 GLM split: the parts load at once, one thread each (STRATA_GLM_PARALLEL_LOAD=0: one after another)
  • 5ff996c Merge remote-tracking branch 'origin/main' into fix80
  • fff29bb Parallel split load: the parts plan their RAM tiers in turn, then all pin at once - the first part's measurement sees no later part's prompt staging (#80 with #85)

📊 Changes

4 files changed (+147 additions, -19 deletions)

View changed files

📝 include/strata/core/glm_model.hpp (+24 -0)
📝 src/core/glm_fast_path.cu (+74 -18)
📝 src/core/glm_fast_state.hpp (+2 -0)
📝 src/core/glm_model.cu (+47 -1)

📄 Description

A split's parts load one after another today, and on a multi-GPU box that adds up: on 4x Tesla T4 with Maya-L, each part spends ~11 s pinning its RAM tier (one thread, no disk), ~15 s warming its tiers from the SSD, and ~1.7 s calibrating its CPU lane, for ~120 s of engine time before the first token. The CPU sits ~75% idle the whole time, and the disk idles while each part pins. This PR loads the parts at once, one thread per GPU; STRATA_GLM_PARALLEL_LOAD=0 keeps the sequential load.

The parts still take the RAM tier's budget in part order, so each gets the same tier as before. A part takes its planned size from the budget and then lets the next part on, before it pins. The CPU lane is set up only after every part has loaded, one part at a time: its calibration times the CPU and the PCIe link, which the other parts' loading would otherwise be using. The parts stay unlinked until all have loaded, because load_pack ends in reset(), which walks split_next_.

A one-line-looking change makes the parallelism actually work. cudaHostRegister used to fault the RAM tier's pages in (17–28 GB a part), and it holds the CUDA driver's lock while it does. Each part's warm-up copies then waited until the last part had finished registering, and the first parallel version was barely faster (130 vs 135 s). numa_pinned now faults the pages in itself, by touching each page on the calling thread before registering. So the registration only pins pages that are already there and holds the lock briefly, and the parts fault in their tiers concurrently, alongside each other's disk reads. It's still one thread per region, which keeps the huge pages: AnonHugePages measured 105.7 GB against 105.9 before.

Results on 4x T4 (2-socket Xeon, NVMe on PCIe 3.0 x4 with a 3.1 GB/s ceiling), Maya-L from a cold page cache: load to first token 142 → 96 s, with the warm-up now reading at the disk's ceiling (3.0 GB/s, was 2.7 with gaps between parts). Decode and prefill are unchanged (--bench, runs interleaved: 12.8 / 12.8 vs 12.9 / 12.6 tok/s, prefill identical). Tier sizes and plans are unchanged, except that the last card now sizes its expert pool before the other parts' pinned memory has taken its small share of VRAM: 88 slots a layer instead of 87, leaving ~485 MB free, about what the first card always had.


🔄 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/80 **Author:** [@ksanislo](https://github.com/ksanislo) **Created:** 10/10/2026 **Status:** ✅ Merged **Merged:** 10/10/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `parallel-split-load` --- ### 📝 Commits (3) - [`48e8ae4`](https://github.com/mw00/project-maya/commit/48e8ae4aa8b98f3f818963ef5335ebec2ae45b4e) GLM split: the parts load at once, one thread each (STRATA_GLM_PARALLEL_LOAD=0: one after another) - [`5ff996c`](https://github.com/mw00/project-maya/commit/5ff996c65c0d06739c679bc229ae735b9c5c876e) Merge remote-tracking branch 'origin/main' into fix80 - [`fff29bb`](https://github.com/mw00/project-maya/commit/fff29bb5dbf76d2e177f5369e60c57d8f0e179ee) Parallel split load: the parts plan their RAM tiers in turn, then all pin at once - the first part's measurement sees no later part's prompt staging (#80 with #85) ### 📊 Changes **4 files changed** (+147 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/core/glm_model.hpp` (+24 -0) 📝 `src/core/glm_fast_path.cu` (+74 -18) 📝 `src/core/glm_fast_state.hpp` (+2 -0) 📝 `src/core/glm_model.cu` (+47 -1) </details> ### 📄 Description A split's parts load one after another today, and on a multi-GPU box that adds up: on 4x Tesla T4 with Maya-L, each part spends ~11 s pinning its RAM tier (one thread, no disk), ~15 s warming its tiers from the SSD, and ~1.7 s calibrating its CPU lane, for ~120 s of engine time before the first token. The CPU sits ~75% idle the whole time, and the disk idles while each part pins. This PR loads the parts at once, one thread per GPU; `STRATA_GLM_PARALLEL_LOAD=0` keeps the sequential load. The parts still take the RAM tier's budget in part order, so each gets the same tier as before. A part takes its planned size from the budget and then lets the next part on, before it pins. The CPU lane is set up only after every part has loaded, one part at a time: its calibration times the CPU and the PCIe link, which the other parts' loading would otherwise be using. The parts stay unlinked until all have loaded, because `load_pack` ends in `reset()`, which walks `split_next_`. A one-line-looking change makes the parallelism actually work. `cudaHostRegister` used to fault the RAM tier's pages in (17–28 GB a part), and it holds the CUDA driver's lock while it does. Each part's warm-up copies then waited until the last part had finished registering, and the first parallel version was barely faster (130 vs 135 s). `numa_pinned` now faults the pages in itself, by touching each page on the calling thread before registering. So the registration only pins pages that are already there and holds the lock briefly, and the parts fault in their tiers concurrently, alongside each other's disk reads. It's still one thread per region, which keeps the huge pages: AnonHugePages measured 105.7 GB against 105.9 before. Results on 4x T4 (2-socket Xeon, NVMe on PCIe 3.0 x4 with a 3.1 GB/s ceiling), Maya-L from a cold page cache: load to first token 142 → 96 s, with the warm-up now reading at the disk's ceiling (3.0 GB/s, was 2.7 with gaps between parts). Decode and prefill are unchanged (`--bench`, runs interleaved: 12.8 / 12.8 vs 12.9 / 12.6 tok/s, prefill identical). Tier sizes and plans are unchanged, except that the last card now sizes its expert pool before the other parts' pinned memory has taken its small share of VRAM: 88 slots a layer instead of 87, leaving ~485 MB free, about what the first card always had. --- <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:10 +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#321
No description provided.