[GH-ISSUE #521] DeepSeek EXL3 on Windows: start fails with "pinning the CPU lane's experts (4787 MiB) failed" when the experts fit in RAM #212

Closed
opened 2026-10-29 21:22:40 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @anbow1 on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/521

Summary

DeepSeek-V4.1-Flash-1017, LibertAIDAI EXL3 2.9 bpw, one RTX 5090 32 GB, 191 GB RAM, Windows 11.
The engine copies the CPU lane's experts into RAM (the auto check finds they fit), then stops while pinning them:

maya-ds4: pinning the CPU lane's experts (4787 MiB) failed
RuntimeError: the engine exited before it was ready (see G:\project-maya\maya-ds4.log)

Maya-S (GGUF) on the same PC works well (24.0 tok/s over 41,848 tokens).

Cause (as far as I can read the code)

  • src/ds4/ds4_model.cu ~2582: with --mmap-experts auto, a safetensors pack sets file_experts = false when the experts
    VRAM does not take fit ram_avail() beside kRamMargin (8 GB). Here that is ~170 GB of the 191 GB.
  • load_experts puts them in anonymous host maps, one per layer (host_maps, ~4.7 GB each).
  • ~3236: when chunk > 0 (the default on one GPU, 2048) every host map goes through cudaHostRegister, and the first
    failure ends the start.
  • Windows will not page-lock nearly all of physical RAM (and counts it against the commit limit), so one of the layers
    fails. The chunk size does not matter: any chunk > 0 pins all of them.

Workarounds that start

  • --prefill-chunk 0: no pinning, the experts stay in RAM, but prompts drop to ~37 tok/s (1,054 tokens in 28 s).
  • --mmap-experts on: the experts are read in place from the files instead.

Suggested fix (any of)

  • On a failed cudaHostRegister, keep the rest unpinned (or unregister and fall back to the staged path) with a warning,
    instead of failing the start.
  • Pin only up to a budget (like GLM's RAM tier on Windows, which fills what Windows lets it pin) and stage the rest.
  • On Windows, include the pinning in the auto check: when the experts copied into RAM cannot all be pinned, pick
    file_experts = true (or chunk = 0) by itself and say so in the log.

Environment

  • Project Maya v1.1.28, plus tools/ds4/pack.py from PR #481 (without it the EXL3 pack does not build)
  • Windows 11, driver 621.01, CUDA 13.3, Python 3.14.5
  • RTX 5090 32 GB (PCIe 5.0 x16), Ryzen 7 9800X3D, 191 GB DDR5 (175 GB available at setup), page file 64 GB + 8 GB
  • Config: --ds4-quant exl3, context 65536, one GPU
Originally created by @anbow1 on GitHub (Oct 26, 2026). Original GitHub issue: https://github.com/mw00/project-maya/issues/521 ### Summary DeepSeek-V4.1-Flash-1017, LibertAIDAI EXL3 2.9 bpw, one RTX 5090 32 GB, 191 GB RAM, Windows 11. The engine copies the CPU lane's experts into RAM (the auto check finds they fit), then stops while pinning them: maya-ds4: pinning the CPU lane's experts (4787 MiB) failed RuntimeError: the engine exited before it was ready (see G:\project-maya\maya-ds4.log) Maya-S (GGUF) on the same PC works well (24.0 tok/s over 41,848 tokens). ### Cause (as far as I can read the code) - `src/ds4/ds4_model.cu` ~2582: with `--mmap-experts` auto, a safetensors pack sets `file_experts = false` when the experts VRAM does not take fit `ram_avail()` beside `kRamMargin` (8 GB). Here that is ~170 GB of the 191 GB. - `load_experts` puts them in anonymous host maps, one per layer (`host_maps`, ~4.7 GB each). - ~3236: when `chunk > 0` (the default on one GPU, 2048) every host map goes through `cudaHostRegister`, and the first failure ends the start. - Windows will not page-lock nearly all of physical RAM (and counts it against the commit limit), so one of the layers fails. The chunk size does not matter: any `chunk > 0` pins all of them. ### Workarounds that start - `--prefill-chunk 0`: no pinning, the experts stay in RAM, but prompts drop to ~37 tok/s (1,054 tokens in 28 s). - `--mmap-experts on`: the experts are read in place from the files instead. ### Suggested fix (any of) - On a failed `cudaHostRegister`, keep the rest unpinned (or unregister and fall back to the staged path) with a warning, instead of failing the start. - Pin only up to a budget (like GLM's RAM tier on Windows, which fills what Windows lets it pin) and stage the rest. - On Windows, include the pinning in the auto check: when the experts copied into RAM cannot all be pinned, pick `file_experts = true` (or `chunk = 0`) by itself and say so in the log. ### Environment - Project Maya v1.1.28, plus `tools/ds4/pack.py` from PR #481 (without it the EXL3 pack does not build) - Windows 11, driver 621.01, CUDA 13.3, Python 3.14.5 - RTX 5090 32 GB (PCIe 5.0 x16), Ryzen 7 9800X3D, 191 GB DDR5 (175 GB available at setup), page file 64 GB + 8 GB - Config: `--ds4-quant exl3`, context 65536, one GPU
Author
Owner

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

Thank you for tracing this to cudaHostRegister. From v1.1.30 a failed pin no longer stops the start: when Windows will not lock every layer's copied experts, they stay in RAM unpinned and the engine prints a warning saying so. The answers are the same; prompts copy those experts through the driver's staging, so they are slower than fully pinned. If prompt speed matters more, --mmap-experts on (reading the experts in place from the files) is still an option. We have no DeepSeek EXL3 setup on Windows to reproduce the failure, so this is checked by builds on Linux and Windows only. Please tell us how the start goes on your 5090 with --prefill-chunk back at its default.

<!-- gh-comment-id:6436261928 --> @mw00 commented on GitHub (Oct 27, 2026): Thank you for tracing this to `cudaHostRegister`. From v1.1.30 a failed pin no longer stops the start: when Windows will not lock every layer's copied experts, they stay in RAM unpinned and the engine prints a warning saying so. The answers are the same; prompts copy those experts through the driver's staging, so they are slower than fully pinned. If prompt speed matters more, `--mmap-experts on` (reading the experts in place from the files) is still an option. We have no DeepSeek EXL3 setup on Windows to reproduce the failure, so this is checked by builds on Linux and Windows only. Please tell us how the start goes on your 5090 with `--prefill-chunk` back at its default.
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#212
No description provided.