[GH-ISSUE #243] Single-GPU Windows + 63 GB: sliced arena pin (28 GiB) then out of memory on every later device allocation #124

Closed
opened 2026-11-04 01:40:13 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @icegita on GitHub (Sep 30, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/243

Single-GPU Windows, 63 GB RAM: the arena's sliced `cudaHostRegister` (28 GiB) is followed by `out of memory` on EVERY later device allocation

Engine: 0.1.24 release (prebuilt `strata-windows-x64.zip`); the same code paths are unchanged in 0.1.29
(`src/core/pinned.cu` has no commits since v0.1.24 and `pin_limit` in `generate.cpp` is identical), so I expect 0.1.29 to fail the same way on this machine.

Machine

OS Windows 11 (10.0.26100 SDK)
GPU RTX 4090, 24 GB, driver 616.92 (CUDA UMD 13.4), single GPU
CPU i9-13900K (no AVX-512), 32 threads
RAM 63.3 GB, page file 62.5 GB on F:
Model Swift 1.5 IQ3_XXS (arena 39.97 GiB), context 131072, kv int8, `--kv-resident 32768`, images on

Symptom

`START-HERE.bat --setup --family swift --model IQ3_XXS` prepares everything, then the server reports
`RuntimeError: the engine exited before it was ready`. The engine log ends with:

```
strata generate: expert arena: cudaHostRegister of the whole arena FAILED (out of memory); 36 slices pinned (28 GiB); large pages refused for 42916118528 B ...; using 4 KB pages
strata generate: loaded 39.97 GiB at 1.28 GiB/s
strata generate: profile F:\Strata-data\mtp ... 24576 ranked pairs, built for 24576 slots
strata generate: native head upload: out of memory
```

At that moment, measured from outside the process:

  • dedicated VRAM in use: 5.5 / 24.5 GB (`\GPU Adapter Memory` perf counter)
  • free physical RAM: 23 GB, free commit: 66 GB
  • the failure is the FIRST device allocation after the arena was registered

It is not about the size of the allocation

Loading the native head before the arena makes the head succeed, and the very next allocation fails instead
(1 MB logits buffer), i.e. every post-arena `cudaMalloc` is refused:

```
strata generate: native head loaded before the expert arena, 437043200 bytes
strata generate: expert arena: ... 36 slices pinned (28 GiB) ...
strata generate: loaded 39.97 GiB at 1.30 GiB/s
strata generate: the logits buffer failed <-- cudaMalloc(248320 * 4) = 1 MB
```

What I ruled out (all measured on this machine)

  • not VRAM (19 GiB free), not RAM/commit (23 / 66 GB free), no Event 2004 commit exhaustion
  • not `STRATA_ARENA_LOCK=0`, not a smaller context (65536 with `--kv-resident 20480`, which pinned 29 GiB instead), not `--no-vision`, not `--mtp` removed
  • a clean process (Python + cudart 13) that reproduces the pinning (30 GiB in 1 GiB slices after the failed whole-arena register, 40 GB arena filled, 6 GB VRAM allocated) still does `cudaMalloc` + H2D copies fine — so the pin count alone is not enough to reproduce it; the engine's own state at that point matters

What fixes it

The mitigation you already use for multi-GPU (8 GiB cap on mapped host pages) fixes this machine completely:

```cpp
// src/program/generate.cpp, in the resident-arena branch

  • const uint64_t pin_limit = (o.expert_cache_remote[0] > 0 || multi_gpu) ? (8ull << 30) : 0;
  • uint64_t pin_limit = 8ull << 30; // every card count
    ```

With that one change the engine reports the arena note `cudaHostRegister limited to 8 GiB ...; 7 GiB pinned`,
reaches `READY` in 51 s, and answers requests (40-44 tok/s on this PC, expert cache 15.3 GiB, 70 % hit).
The same build is running here now on 0.1.29 source.

Questions / suggestion

  1. Would you take the 8 GiB cap as the default for single-GPU Windows too? The cost is that expert-cache misses
    DMA out of unpinned RAM instead of pinned pages; with a profile the hit rate is high (70 %+ here) and it is
    far better than not starting at all. (`STRATA_ARENA_PIN_GIB` could keep it tunable, 0 = old behaviour.)
  2. If the cap is not the right fix, the pattern worth looking at is: after the sliced `cudaHostRegister` fails
    part-way, this driver/WDDM refuses every later allocation. Your own multi-GPU comment documents exactly this
    ("pinning all of it into two contexts leaves WDDM refusing every later allocation ... cudaMemGetInfo and the next
    cudaMalloc fail"), and #158 is the same class under WSL — this report is the single-GPU variant.
  3. Happy to test a build with any instrumentation you want (`cudaMemGetInfo` right before the head, clearing the
    error state, etc.) on this machine.
Originally created by @icegita on GitHub (Sep 30, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/243 # Single-GPU Windows, 63 GB RAM: the arena's sliced \`cudaHostRegister\` (28 GiB) is followed by \`out of memory\` on EVERY later device allocation **Engine:** 0.1.24 release (prebuilt \`strata-windows-x64.zip\`); the same code paths are unchanged in 0.1.29 (\`src/core/pinned.cu\` has no commits since v0.1.24 and \`pin_limit\` in \`generate.cpp\` is identical), so I expect 0.1.29 to fail the same way on this machine. ## Machine | | | |---|---| | OS | Windows 11 (10.0.26100 SDK) | | GPU | RTX 4090, 24 GB, driver **616.92** (CUDA UMD 13.4), single GPU | | CPU | i9-13900K (no AVX-512), 32 threads | | RAM | **63.3 GB**, page file 62.5 GB on F: | | Model | Swift 1.5 **IQ3_XXS** (arena 39.97 GiB), context 131072, kv int8, \`--kv-resident 32768\`, images on | ## Symptom \`START-HERE.bat --setup --family swift --model IQ3_XXS\` prepares everything, then the server reports \`RuntimeError: the engine exited before it was ready\`. The engine log ends with: \`\`\` strata generate: expert arena: cudaHostRegister of the whole arena FAILED (out of memory); 36 slices pinned (28 GiB); large pages refused for 42916118528 B ...; using 4 KB pages strata generate: loaded 39.97 GiB at 1.28 GiB/s strata generate: profile F:\\Strata-data\\mtp ... 24576 ranked pairs, built for 24576 slots strata generate: native head upload: out of memory \`\`\` At that moment, measured from outside the process: * dedicated VRAM in use: **5.5 / 24.5 GB** (\`\\GPU Adapter Memory\` perf counter) * free physical RAM: **23 GB**, free commit: **66 GB** * the failure is the FIRST device allocation after the arena was registered ## It is not about the size of the allocation Loading the native head **before** the arena makes the head succeed, and the very next allocation fails instead (1 MB logits buffer), i.e. *every* post-arena \`cudaMalloc\` is refused: \`\`\` strata generate: native head loaded before the expert arena, 437043200 bytes strata generate: expert arena: ... 36 slices pinned (28 GiB) ... strata generate: loaded 39.97 GiB at 1.30 GiB/s strata generate: the logits buffer failed <-- cudaMalloc(248320 * 4) = 1 MB \`\`\` ## What I ruled out (all measured on this machine) * not VRAM (19 GiB free), not RAM/commit (23 / 66 GB free), no Event 2004 commit exhaustion * not \`STRATA_ARENA_LOCK=0\`, not a smaller context (65536 with \`--kv-resident 20480\`, which pinned 29 GiB instead), not \`--no-vision\`, not \`--mtp\` removed * a clean process (Python + cudart 13) that reproduces the pinning (**30 GiB** in 1 GiB slices after the failed whole-arena register, 40 GB arena filled, 6 GB VRAM allocated) still does \`cudaMalloc\` + H2D copies fine — so the pin count alone is not enough to reproduce it; the engine's own state at that point matters ## What fixes it The mitigation you already use for multi-GPU (8 GiB cap on mapped host pages) fixes this machine completely: \`\`\`cpp // src/program/generate.cpp, in the resident-arena branch - const uint64_t pin_limit = (o.expert_cache_remote[0] > 0 || multi_gpu) ? (8ull << 30) : 0; + uint64_t pin_limit = 8ull << 30; // every card count \`\`\` With that one change the engine reports the arena note \`cudaHostRegister limited to 8 GiB ...; 7 GiB pinned\`, reaches \`READY\` in 51 s, and answers requests (40-44 tok/s on this PC, expert cache 15.3 GiB, 70 % hit). The same build is running here now on 0.1.29 source. ## Questions / suggestion 1. Would you take the 8 GiB cap as the default for single-GPU Windows too? The cost is that expert-cache misses DMA out of unpinned RAM instead of pinned pages; with a profile the hit rate is high (70 %+ here) and it is far better than not starting at all. (\`STRATA_ARENA_PIN_GIB\` could keep it tunable, 0 = old behaviour.) 2. If the cap is not the right fix, the pattern worth looking at is: after the sliced \`cudaHostRegister\` fails part-way, this driver/WDDM refuses *every* later allocation. Your own multi-GPU comment documents exactly this ("pinning all of it into two contexts leaves WDDM refusing every later allocation ... cudaMemGetInfo and the next cudaMalloc fail"), and #158 is the same class under WSL — this report is the single-GPU variant. 3. Happy to test a build with any instrumentation you want (\`cudaMemGetInfo\` right before the head, clearing the error state, etc.) on this machine.
Author
Owner

@Niko1221 commented on GitHub (Sep 30, 2026):

Thanks for the detailed report. The whole-arena pin fails, then the sliced pin goes until the driver refuses; our guess is it lands right on Windows' shared GPU memory budget (about half the RAM), so later allocations fail. 0.1.31 caps the sliced pin below that budget (and honours STRATA_ARENA_PIN_GIB). We'll ping you when there's a build to test.

<!-- gh-comment-id:5917512170 --> @Niko1221 commented on GitHub (Sep 30, 2026): Thanks for the detailed report. The whole-arena pin fails, then the sliced pin goes until the driver refuses; our guess is it lands right on Windows' shared GPU memory budget (about half the RAM), so later allocations fail. 0.1.31 caps the sliced pin below that budget (and honours `STRATA_ARENA_PIN_GIB`). We'll ping you when there's a build to test.
Author
Owner

@Niko1221 commented on GitHub (Oct 1, 2026):

0.1.31 adds STRATA_ARENA_PIN_GIB=auto (in the config's env): the sliced pin stays below the GPU's shared-memory budget minus 4 GiB. It's opt-in because on a 64 GB test PC the cap cost ~20% prompt speed while the full pin worked; STRATA_ARENA_PIN_GIB=24 sets a fixed cap. Could you try auto on your machine? Please reopen with the log if later allocations still fail.

<!-- gh-comment-id:5925211746 --> @Niko1221 commented on GitHub (Oct 1, 2026): [0.1.31](https://github.com/Niko1221/Strata/releases/tag/v0.1.31) adds `STRATA_ARENA_PIN_GIB=auto` (in the config's `env`): the sliced pin stays below the GPU's shared-memory budget minus 4 GiB. It's opt-in because on a 64 GB test PC the cap cost ~20% prompt speed while the full pin worked; `STRATA_ARENA_PIN_GIB=24` sets a fixed cap. Could you try `auto` on your machine? Please reopen with the log if later allocations still fail.
Sign in to join this conversation.
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
Niko1221/Strata#124
No description provided.