mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1412] Windows: SeLockMemoryPrivilege moves the expert arena to 2 MiB large pages — but the token is issued at logon (1314 ≠ 1450) #573
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#573
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?
Originally created by @shahrokhzargarpour on GitHub (Oct 7, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1412
What changes
On Windows, if the account running the engine holds the "Lock pages in memory" user right
(
SeLockMemoryPrivilege), Strata backs the expert arena with 2 MiB large pages instead of 4 KB pages.Two things change in the startup log:
large pages refused …warning disappears and becomes a positive line.working-set minimum + VirtualLockline for the (~46,700 MiB) arena disappears — large pages arenon-pageable by construction, so the engine no longer needs to pin the working set to keep the arena resident.
This is an observation of startup-log behavior (allocator / working-set), not a throughput A/B.
Environment (where this was observed)
82f46a8c), Windows 11, WDDM driver model.--expert-cache auto.--batch 4 --batch-mtp --spec 4, KV int8 with--kv-resident 98304,--remote-expert-opt --pcie-frac 0.55 --pool-workers 8.How to enable it (step by step)
SeLockMemoryPrivilege) tothe account that runs the engine (via
secpol.mscor your provisioning tool). It is a user right, notan "elevated process" privilege — the engine process does not need to run as administrator.
(or restarting the scheduled Task) is not enough. This was the part that cost the most time.
SeLockMemoryPrivilegemust be listed for that account.Evidence (verbatim startup lines)
Before (privilege not in the token) — the arena falls back to 4 KB pages:
After (privilege present, fresh logon) — the arena is large-page backed:
and the ~46,700 MiB
working-set minimum + VirtualLockline no longer appears.1314 is not 1450
Two different failures show up as "large pages refused" and they need different fixes:
ERROR_PRIVILEGE_NOT_HELD: the account/token does not holdSeLockMemoryPrivilege.Fix: grant the right and re-logon (steps 1–2).
ERROR_NO_SYSTEM_RESOURCES: the privilege is fine, but the system cannot satisfy acontiguous large-page allocation — fragmentation. Observed here after killing and relaunching several
engines in a row; a clean reboot made it succeed every time.
Not measured
The effect on tok/s / throughput was not measured. Both lines above are startup-log observations, not a
controlled comparison. No A/B was run. Do not read this as a performance claim.
Minimal repro
large pages refused … error 1314.SeLockMemoryPrivilegeto the account, sign out / sign in, verifywhoami /priv.large pages are resident without a lock … large pages (2097152 B).@midhatn commented on GitHub (Oct 7, 2026):
One scope detail worth adding: the resident-budget path is different from the full expert arena. In v0.1.40.3,
FileExpertSourceallocates the resident complement withcudaHostAlloc, so granting Lock pages in memory alone doesn't route that allocation throughPinnedArena's explicit large-page path:https://github.com/Niko1221/Strata/blob/v0.1.40.3/src/core/expert_source.cpp#L2264
On Windows 11 / Ryzen 9 7940HS / RTX 4070 Laptop 8 GB / 64 GB RAM, I tested an opt-in local prototype that reuses
PinnedArenafor the 36 GiB resident complement, accepts it only with large-page backing and successful CUDA mapped registration, and otherwise falls back to the existing allocator.A standalone 36 GiB allocation and CUDA registration succeeded, with sampled page metadata confirming 2 MiB large pages. A later full-model run returned VirtualAlloc error 1450 and fell back to normal pinned RAM. The fallback passed the answer/tool/cache-restoration checks and clean engine unload. This is not a large-page inference speed result: the full-model run never obtained large-page backing.
This supports keeping 1314 and 1450 separate, and also checking which allocation path is actually active. I haven't established the exact cause of 1450 here. Windows needs contiguous physical space for each large page, not one physically contiguous 36 GiB region; fragmentation is a possible explanation, not something that error code alone proves.
https://learn.microsoft.com/en-us/windows/win32/memory/large-page-support
@Niko1221 commented on GitHub (Oct 8, 2026):
Thank you, that is accurate: Windows puts the privilege in the access token at logon, so granting "Lock pages in memory" takes effect only after the account logs off and on again (or the PC reboots). A line saying so is now in docs/DETAILS.md next to the Windows startup notes. And thanks to midhatn for the scope detail: the resident complement is allocated with cudaHostAlloc, which does not take the explicit large-page path, so the 2 MiB pages cover the expert arena and not every pinned buffer.