Skip to content

Windows: opt-in release of mapped expert pages after GPU uploads - #818

Closed
jordicor wants to merge 1 commit into
Niko1221:mainfrom
jordicor:codex/windows-mapped-expert-release
Closed

jordicor wants to merge 1 commit into
Niko1221:mainfrom
jordicor:codex/windows-mapped-expert-release

Conversation

@jordicor

@jordicor jordicor commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

On a 32 GB Windows 11 laptop with an RTX 4080 Laptop and a Thunderbolt RTX 3090, file-backed expert pages remained in the engine's working set after their GPU copies. With IQ2_XS and the existing layer split, available RAM stayed near 0.5 GiB during the measured workload.

This adds opt-in Windows mapped-page release via STRATA_ARENA_RELEASE=1. Unset or 0 preserves the current behavior.

  • Implement FileExpertSource::release() for experts.bin and direct GGUF file views using Windows working-set trimming. Preserve shared boundary pages and never trim private/pinned staging buffers.
  • Release pages after prefill's lent expert slots have finished refilling, in both serving and one-shot generation. Existing completed-upload release calls also use the implementation.
  • Add focused C++ coverage, document the switch and tradeoff, and include the benchmark scripts and scoped measurements.

Measured result

The same prototype executable was run with explicit release OFF and ON: one warmup and three fresh requests each at 1K, 4K and 16K prompt tokens, 256 output tokens, context 32768, int8 KV, MTP, --mmap-experts --layer-split 12 --trim-stage-weights.

Metric OFF ON
Available physical RAM, median 0.512 GiB 12.187 GiB
Available physical RAM, minimum 0.277 GiB 6.110 GiB
Engine working set, median 23.379 GiB 11.946 GiB
System commit, median 51.880 GiB 51.973 GiB
Physical SSD reads, total 16.750 GiB 16.809 GiB

Prefill throughput was 3.7-4.4% lower. This improves physical-memory availability on this machine; it does not reduce commit, demonstrate fewer SSD reads, or establish a general speed improvement. Runs were sequential, the OS file cache was retained, and generated code-explanation responses differed. The submitted patch defaults to OFF; the measured prototype defaulted to ON, but both benchmark arms set the switch explicitly.

Full configuration, individual timings, hashes, reproduction commands and limitations: measurement report.

Validation

  • Fresh Windows Release build with MSVC 2019 and CUDA 13.1, SM 86/89, native experts enabled.
  • file_expert_source_test and expert_layout_test pass in separate processes with the switch unset, 0, and 1: page alignment and working-set behavior, unchanged bytes after repeated reads, invalid indices, closed sources, and three GGUF roles across two shards.
  • Eight benchmark-harness tests pass.
  • Final rebuilt engine completes fresh 1K/4K inference requests on both GPUs with release enabled.

The prototype also completed 30 functional requests without runtime errors. All 24 objective responses/statuses matched the official engine at the same placement: 21 passes and three unchanged Markdown-fenced-JSON failures; six prose responses were unscored. These limited checks do not prove general output parity.

Related prior work: #467 and #640. The existing multi-GPU implementation is reused; this PR contributes Windows mapped-page release.

Niko1221 added a commit that referenced this pull request Oct 6, 2026
STRATA_ARENA_RELEASE already exists and means the opposite (=0 keeps the experts a GPU holds, generate.cpp), so the
opt-in is renamed in the engine, the tests, DETAILS.md and the bench folder. The working-set assert in
file_expert_source_test reports, not fails, a trimmed page that Windows maps straight back with the switch on. The
bench folder keeps the README and the two scripts (the raw export and the harness self-tests are dropped).

Co-authored-by: jordicor <59069878+jordicor@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Niko1221

Niko1221 commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Merged in 0.1.40 with one change: the switch is STRATA_FILE_RELEASE=1, because STRATA_ARENA_RELEASE already exists and means the opposite (=0 keeps the experts a GPU holds). Default off. The bench folder keeps the README and the two scripts.

@Niko1221 Niko1221 closed this Oct 6, 2026
Niko1221 added a commit that referenced this pull request Oct 6, 2026
STRATA_ARENA_RELEASE already exists and means the opposite (=0 keeps the experts a GPU holds, generate.cpp), so the
opt-in is renamed in the engine, the tests, DETAILS.md and the bench folder. The working-set assert in
file_expert_source_test reports, not fails, a trimmed page that Windows maps straight back with the switch on. The
bench folder keeps the README and the two scripts (the raw export and the harness self-tests are dropped).

Co-authored-by: jordicor <59069878+jordicor@users.noreply.github.com>
anon761 pushed a commit to anon761/Strata-upstream that referenced this pull request Oct 6, 2026
…221#818)

STRATA_ARENA_RELEASE already exists and means the opposite (=0 keeps the experts a GPU holds, generate.cpp), so the
opt-in is renamed in the engine, the tests, DETAILS.md and the bench folder. The working-set assert in
file_expert_source_test reports, not fails, a trimmed page that Windows maps straight back with the switch on. The
bench folder keeps the README and the two scripts (the raw export and the harness self-tests are dropped).

Co-authored-by: jordicor <59069878+jordicor@users.noreply.github.com>
sskver pushed a commit to sskver/Strata that referenced this pull request Oct 7, 2026
…221#818)

STRATA_ARENA_RELEASE already exists and means the opposite (=0 keeps the experts a GPU holds, generate.cpp), so the
opt-in is renamed in the engine, the tests, DETAILS.md and the bench folder. The working-set assert in
file_expert_source_test reports, not fails, a trimmed page that Windows maps straight back with the switch on. The
bench folder keeps the README and the two scripts (the raw export and the harness self-tests are dropped).

Co-authored-by: jordicor <59069878+jordicor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants