[GH-ISSUE #417] Windows: a 2-GPU split can't start on v1.1.25 — big pinned blocks use up the WDDM pin budget, so CUDA1 gets 0 GB #163

Open
opened 2026-10-29 21:21:53 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @Efs-O on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/417

Setup: Windows 10 Pro 19045, 2x RTX 5060 Ti 16 GB (+ an idle 3060), 128 GB DDR4, CUDA 13.0, Maya-S24, --gpus 0,1, 128K ctx, v1.1.25 stock.

What happens: CUDA0 pins its RAM tier, then CUDA1 is refused everything:

glm fast: CUDA0 RAM tier 34.61 GB pinned, 5222 slots
glm fast: CUDA1 a pinning cap: 0.00 GB more pin, the RAM tier sized to it
maya generate: glm fast: the warmed expert tables did not upload (out of memory)

With STRATA_GLM_PARALLEL_LOAD=0, the last line is the pinned RAM tier did not allocate. Same result with the default lane and with CPU_LANE=6.

At that point the process holds about 37.6 GB pinned (34.6 tier + 2x 0.81 KV + 2x 0.69 landing ring). In 1 GB pieces this PC pins 61 GB per process.

The new part: the budget depends on block size. This is the per-process ~RAM/2 WDDM budget from #147/#185/#207, but big cudaHostAlloc blocks use up much more of it than their size. A ctypes probe against cudart (nothing else running, contexts on every GPU, cudaHostAllocPortable) gave:

allocation pattern total pinned before refusal
1 GB blocks 61 GB
2 GB blocks 58 GB
4 GB blocks 52 GB
largest single block ~20.9 GB (and 40 more 1 GB blocks pin after it)
0.5 / 0.25 GB blocks 62 / 62.5 GB

So a tier class pinned as one multi-GB block can leave the second part nothing, even though plenty of budget would remain in small pieces. #110's one-after-another pinning makes the outcome deterministic (CUDA0 wins, CUDA1 gets 0). #153 changes the order classes are pinned in, not block size, so it wouldn't help here.

Workaround: cap the budget so it fits. STRATA_GLM_RAM_GB=40 → tiers 20.5 + 19.5 GB, decode 9.7 tok/s; RAM_GB=48 + CPU_LANE=6 → tiers 24.6 + 23.4 GB, decode 11.8 tok/s, prefill 173 @2K / 381 @8K. That works, but the 48 is found by trial, and it wastes ~13 GB of pinnable RAM.

Fix we tested locally (on v1.0.3x, 2026-10-09): pin each RAM class in 1 GB pieces (a slot(s) helper mapping slot → piece + offset, in place of R.base + s*R.stride; env STRATA_GLM_PIN_CHUNK_MB, Windows default 1024). Pinned total went 44.8 → 60.3 GB, disk waits 23 → 11 ms/tok, prefill 111/199 → 153/257. Decode stayed about the same on this box because the CPU lane is the bottleneck here. On a box where VRAM-hit is the limit it should matter more. Happy to rebase it onto main as a PR if you want it.

Originally created by @Efs-O on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/mw00/project-maya/issues/417 **Setup:** Windows 10 Pro 19045, 2x RTX 5060 Ti 16 GB (+ an idle 3060), 128 GB DDR4, CUDA 13.0, Maya-S24, `--gpus 0,1`, 128K ctx, v1.1.25 stock. **What happens:** CUDA0 pins its RAM tier, then CUDA1 is refused everything: ``` glm fast: CUDA0 RAM tier 34.61 GB pinned, 5222 slots glm fast: CUDA1 a pinning cap: 0.00 GB more pin, the RAM tier sized to it maya generate: glm fast: the warmed expert tables did not upload (out of memory) ``` With `STRATA_GLM_PARALLEL_LOAD=0`, the last line is `the pinned RAM tier did not allocate`. Same result with the default lane and with `CPU_LANE=6`. At that point the process holds about 37.6 GB pinned (34.6 tier + 2x 0.81 KV + 2x 0.69 landing ring). In 1 GB pieces this PC pins **61 GB** per process. **The new part: the budget depends on block size.** This is the per-process ~RAM/2 WDDM budget from #147/#185/#207, but big `cudaHostAlloc` blocks use up much more of it than their size. A ctypes probe against cudart (nothing else running, contexts on every GPU, `cudaHostAllocPortable`) gave: | allocation pattern | total pinned before refusal | | --- | ---: | | 1 GB blocks | 61 GB | | 2 GB blocks | 58 GB | | 4 GB blocks | 52 GB | | largest single block | ~20.9 GB (and 40 more 1 GB blocks pin after it) | | 0.5 / 0.25 GB blocks | 62 / 62.5 GB | So a tier class pinned as one multi-GB block can leave the second part nothing, even though plenty of budget would remain in small pieces. #110's one-after-another pinning makes the outcome deterministic (CUDA0 wins, CUDA1 gets 0). #153 changes the order classes are pinned in, not block size, so it wouldn't help here. **Workaround:** cap the budget so it fits. `STRATA_GLM_RAM_GB=40` → tiers 20.5 + 19.5 GB, decode 9.7 tok/s; `RAM_GB=48` + `CPU_LANE=6` → tiers 24.6 + 23.4 GB, decode 11.8 tok/s, prefill 173 @2K / 381 @8K. That works, but the 48 is found by trial, and it wastes ~13 GB of pinnable RAM. **Fix we tested locally (on v1.0.3x, 2026-10-09):** pin each RAM class in 1 GB pieces (a `slot(s)` helper mapping slot → piece + offset, in place of `R.base + s*R.stride`; env `STRATA_GLM_PIN_CHUNK_MB`, Windows default 1024). Pinned total went 44.8 → 60.3 GB, disk waits 23 → 11 ms/tok, prefill 111/199 → 153/257. Decode stayed about the same on this box because the CPU lane is the bottleneck here. On a box where VRAM-hit is the limit it should matter more. Happy to rebase it onto main as a PR if you want it.
Author
Owner

@mw00 commented on GitHub (Oct 23, 2026):

Thanks for the measurements - the block-size finding was the key. In v1.1.26 the GLM RAM tier is pinned in pieces of at most 1 GB on Windows (MAYA_GLM_PIN_PIECE_MB, 0 = one block as before), so the first GPU's tier no longer uses up the per-process budget and the second GPU gets its share. Could you try v1.1.26 on your 2-GPU setup without the MAYA_GLM_RAM_GB workaround and tell us what each GPU's RAM tier comes out at?

<!-- gh-comment-id:6373122884 --> @mw00 commented on GitHub (Oct 23, 2026): Thanks for the measurements - the block-size finding was the key. In v1.1.26 the GLM RAM tier is pinned in pieces of at most 1 GB on Windows (`MAYA_GLM_PIN_PIECE_MB`, 0 = one block as before), so the first GPU's tier no longer uses up the per-process budget and the second GPU gets its share. Could you try v1.1.26 on your 2-GPU setup without the `MAYA_GLM_RAM_GB` workaround and tell us what each GPU's RAM tier comes out at?
Author
Owner

@air-terminal commented on GitHub (Oct 24, 2026):

Thanks for the fix. Here is a data point from a different 2-GPU Windows box, where one block already
pinned fine - and where the 1 GB pieces make decode slower.

Setup

  • Windows 11 26H2, NVIDIA Studio driver 616.92, CUDA 12.8
  • Intel Core Ultra 7 265 (8P+12E), 96 GB DDR5 (4 DIMMs, 4400 MT/s)
  • CUDA0: RTX 5060 Ti 16 GB via OCuLink (PCIe 4.0 x4), display attached
  • CUDA1: RTX 5070 Ti 16 GB (PCIe 5.0 x16)
  • Maya-S24 (GGUF), 96K context, --kv int8, MTP drafting, "gpu": [0, 1]
  • env: MAYA_GLM_PCIE_SHARE=0.00, MAYA_GLM_CPU_SHARED=1, MAYA_GLM_CPU_LANE=16, MAYA_GLM_SPLIT=19

RAM tier on v1.1.26 - the same with and without pieces, no "pinning cap" line in either:

CUDA0 CUDA1 total
v1.1.26 default (1 GB pieces) 22.43 GB 45.30 GB 67.7 GB
v1.1.26 + MAYA_GLM_PIN_PIECE_MB=0 22.35 GB 45.30 GB 67.7 GB

Disk reads are 0/token in both. (Since v1.1.20 this box has pinned ~67.6 GB in one block per class;
on v1.1.15 CUDA1 hit the cap and got ~27 GB.)

Decode (--bench, same day, same config; mean of each run)

decode tok/s (runs) avg prefill 2K
v1.1.21 28.5 / 27.2 27.85 ~462
v1.1.26 default 25.8 / 26.1 25.95 ~450
v1.1.26 + PIN_PIECE_MB=0 27.0 / 27.5 / 27.6 27.4 ~459

VRAM hit rate and MTP acceptance are unchanged; the difference is the CPU lane time per token
(glm stat "cpu lane ... in X ms/tok", the four bench requests):

  • v1.1.21: 34.8 / 41.7 / 40.8 / 46.9 ms
  • v1.1.26 default: 36.8 / 46.1 / 42.4 / 49.5 ms
  • v1.1.26 PIN_PIECE_MB=0: 34.0 / 42.3 / 40.0 / 46.6 ms

So here the pieces cost about 7% of decode while pinning nothing extra. Would it be possible to pin
in one block first and fall back to the 1 GB pieces only when a pin is refused (or when a later GPU
would get less than planned)? That would keep Efs-O's case working without the slowdown where one
block fits. For now I run v1.1.26 with MAYA_GLM_PIN_PIECE_MB=0.

<!-- gh-comment-id:6382885384 --> @air-terminal commented on GitHub (Oct 24, 2026): Thanks for the fix. Here is a data point from a different 2-GPU Windows box, where one block already pinned fine - and where the 1 GB pieces make decode slower. **Setup** - Windows 11 26H2, NVIDIA Studio driver 616.92, CUDA 12.8 - Intel Core Ultra 7 265 (8P+12E), 96 GB DDR5 (4 DIMMs, 4400 MT/s) - CUDA0: RTX 5060 Ti 16 GB via OCuLink (PCIe 4.0 x4), display attached - CUDA1: RTX 5070 Ti 16 GB (PCIe 5.0 x16) - Maya-S24 (GGUF), 96K context, `--kv int8`, MTP drafting, `"gpu": [0, 1]` - env: MAYA_GLM_PCIE_SHARE=0.00, MAYA_GLM_CPU_SHARED=1, MAYA_GLM_CPU_LANE=16, MAYA_GLM_SPLIT=19 **RAM tier on v1.1.26** - the same with and without pieces, no "pinning cap" line in either: | | CUDA0 | CUDA1 | total | |---|---|---|---| | v1.1.26 default (1 GB pieces) | 22.43 GB | 45.30 GB | 67.7 GB | | v1.1.26 + MAYA_GLM_PIN_PIECE_MB=0 | 22.35 GB | 45.30 GB | 67.7 GB | Disk reads are 0/token in both. (Since v1.1.20 this box has pinned ~67.6 GB in one block per class; on v1.1.15 CUDA1 hit the cap and got ~27 GB.) **Decode** (`--bench`, same day, same config; mean of each run) | | decode tok/s (runs) | avg | prefill 2K | |---|---|---|---| | v1.1.21 | 28.5 / 27.2 | 27.85 | ~462 | | v1.1.26 default | 25.8 / 26.1 | 25.95 | ~450 | | v1.1.26 + PIN_PIECE_MB=0 | 27.0 / 27.5 / 27.6 | 27.4 | ~459 | VRAM hit rate and MTP acceptance are unchanged; the difference is the CPU lane time per token (glm stat "cpu lane ... in X ms/tok", the four bench requests): - v1.1.21: 34.8 / 41.7 / 40.8 / 46.9 ms - v1.1.26 default: 36.8 / 46.1 / 42.4 / 49.5 ms - v1.1.26 PIN_PIECE_MB=0: 34.0 / 42.3 / 40.0 / 46.6 ms So here the pieces cost about 7% of decode while pinning nothing extra. Would it be possible to pin in one block first and fall back to the 1 GB pieces only when a pin is refused (or when a later GPU would get less than planned)? That would keep Efs-O's case working without the slowdown where one block fits. For now I run v1.1.26 with MAYA_GLM_PIN_PIECE_MB=0.
Author
Owner

@Efs-O commented on GitHub (Oct 26, 2026):

Tested v1.1.28 on 2x RTX 5060 Ti 16 GB (CUDA 13.0, 128 GB RAM, Windows 10), Maya-S24, 131K ctx, CPU lane 6.

  • No MAYA_GLM_RAM_GB, default 1 GB pieces: CUDA0 RAM tier 34.61 GB pinned (5222 slots); CUDA1 "a pinning cap: 0.00 GB more pin"; then "the warmed expert tables did not upload (out of memory)". Same with PIN_PIECE_MB=0 (CUDA0 34.61 GB in one block).
  • MAYA_GLM_RAM_GB=48: CUDA0 24.55 GB, CUDA1 23.43 GB; 11.5 tok/s decode (1.1.25: 11.8), prefill 163/376 at 2K/8K.
  • A standalone cudaHostAlloc probe in a fresh process: after 35 x 1 GB portable pinned, 26 GB more pins in 1 GB steps (27.5 GB in 256 MB steps), the same with 13.5 GB cudaMalloc'd on each card, and the same straight after freeing. So the OS cap is about 61 GB here, yet the engine's CUDA1 pin_room sees 0. Something in the process seems to hold ~26 GB of pinnable room between CUDA0's tier and CUDA1's.
<!-- gh-comment-id:6410493063 --> @Efs-O commented on GitHub (Oct 26, 2026): Tested v1.1.28 on 2x RTX 5060 Ti 16 GB (CUDA 13.0, 128 GB RAM, Windows 10), Maya-S24, 131K ctx, CPU lane 6. - No `MAYA_GLM_RAM_GB`, default 1 GB pieces: CUDA0 RAM tier 34.61 GB pinned (5222 slots); CUDA1 "a pinning cap: 0.00 GB more pin"; then "the warmed expert tables did not upload (out of memory)". Same with `PIN_PIECE_MB=0` (CUDA0 34.61 GB in one block). - `MAYA_GLM_RAM_GB=48`: CUDA0 24.55 GB, CUDA1 23.43 GB; 11.5 tok/s decode (1.1.25: 11.8), prefill 163/376 at 2K/8K. - A standalone cudaHostAlloc probe in a fresh process: after 35 x 1 GB portable pinned, 26 GB more pins in 1 GB steps (27.5 GB in 256 MB steps), the same with 13.5 GB cudaMalloc'd on each card, and the same straight after freeing. So the OS cap is about 61 GB here, yet the engine's CUDA1 `pin_room` sees 0. Something in the process seems to hold ~26 GB of pinnable room between CUDA0's tier and CUDA1's.
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#163
No description provided.