mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5344] [Engine] add fractional total-VRAM ceiling (--vram-frac) and setup scaling #5393
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#5393
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5344
Author: @atomicmilkshake
Created: 11/5/2026
Status: 🔄 Open
Base:
main← Head:vram-fractional-cap📝 Commits (2)
2bcf0c0engine: introduce total-VRAM fractional ceiling (--vram-frac) and quality mode4d22dd9setup: account for fractional VRAM in hardware check and model sizing (--vram-cap)📊 Changes
27 files changed (+1640 additions, -113 deletions)
View changed files
📝
CMakeLists.txt(+10 -1)📝
include/strata/core/expert_source.hpp(+2 -0)📝
include/strata/core/geometry.hpp(+1 -0)📝
include/strata/core/peer_experts.hpp(+1 -1)📝
include/strata/core/remote_experts.hpp(+2 -1)📝
include/strata/core/verify.hpp(+8 -1)➕
include/strata/core/vram_floor.hpp(+21 -0)📝
include/strata/kernels/cpu/expert_layout.hpp(+3 -1)📝
include/strata/prefill/prefill.hpp(+5 -0)➕
include/strata/program/vram_cap.hpp(+110 -0)📝
setup.py(+161 -44)📝
src/core/expert_source.cpp(+33 -10)📝
src/core/mtp.cpp(+27 -0)📝
src/core/peer_experts.cpp(+8 -3)📝
src/core/remote_experts.cpp(+16 -5)📝
src/core/verify.cpp(+64 -6)➕
src/core/vram_floor.cpp(+89 -0)📝
src/kernels/cpu/expert_layout.cpp(+10 -2)📝
src/kernels/cuda/native_router.cu(+4 -1)📝
src/prefill/kernels.cu(+12 -0)...and 7 more files
📄 Description
Problem and result
On consumer GPUs (e.g. 8 GB - 16 GB VRAM) running alongside desktop compositors, browsers, or concurrent background tasks, allocating up to 100% of physical VRAM frequently triggers desktop stutter, Windows display driver timeouts (TDRs), or out-of-memory errors during allocation spikes. Previously, Strata only offered
--vram-reserve-mibas a static megabyte subtraction.This change introduces an optional fractional ceiling on total VRAM (
--vram-frac <F>,0.0 < F <= 1.0, orSTRATA_VRAM_FRAC=F). When active, Strata dynamically sizes internal reserves and expert/KV cache allocations so total memory strictly adheres to the requested fraction (e.g.,--vram-frac 0.8on a 10 GB card enforces an 8,192 MiB ceiling).setup.pyalso accepts--vram-cap <F>, correctly reflecting usable memory in hardware checks and model sizing.Related discussion
none
Approach
--vram-frac <F>CLI argument ingenerate.cppandSTRATA_VRAM_FRACenvironment parsing.vram_cap.hppandvram_floor.cppto calculate dynamic reserves and assert memory floors during expert and prompt allocations. Added--vram-cap-mode fast|qualityfor miss routing.--vram-cap <F>insetup.py. Sizing calculations inlow_ram_vram(),gpu_table(), andamd_mem_text()scale usable VRAM by the cap factor.--vram-frac 1.0or omitted) remains identical to upstream.Validation
Passed:
python tools/test_setup_vram_cap.pyvram-fractional-cap(commit4d22dd99on top of9f7d977d)python tests/core/vram_cap_cli_test.py --exe J:/strata/Strata/build/strata.exevram-fractional-cap(commit4d22dd99)sm_86)python setup.py --check --vram-cap 0.8[ok] GPU: NVIDIA GeForce RTX 3080, 10.0 GB VRAM (8.0 GB usable with --vram-cap 0.8)and sized Qwen3.8 / DeepSeek variants against 8.0 GB VRAM.strata.exe --pack <pack> --tokens "1,2,3" --vram-frac 0.8sm_86speed switches active.Failed:
none observed
Not run:
sm_86testbed only).Limits
--vram-cap-mode qualityis targeted at single-GPU native configurations; multi-GPU splits fall back to fast mode.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.