Leave a share of the card's memory to other processes on request #414
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-logs
old-names
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay!414
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-414"
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?
@safesearch77 on GitHub · 2026-11-28 13:26 UTC · original
safesearch77:feat/vram-headroom→main· +60158 −5432 · 206 files · 661 commits · closed without mergingVICTORY_VRAM_HEADROOM_MBis off by default and capped at 8,192. It takes that many MB off the card's budget inHost::video_memory(), so every rule that asks how much room the card has works from what is left:vram_keepevictioncard_limitsvideo_memory_groups()still reports the system's figure, and the video-memory log line names the headroom when it is set. (Note:victory-hle'sdlss.rsreads NGXparameters.video_memory(), notHost::video_memory().)Why: under Proton +
vkd3d-proton, the reported DXGI budget is roughly this process's use plus all of the card's free memory, and nothing pages this process's memory aside for the desktop compositor the way WDDM does. On an 8 GB RTX 4070 Laptop under Proton, the title used5,823 MBof a5,823 MBDXGI budget, leaving0 MBfree on the card; the compositor could not allocate its next buffer (nvidia-drm: Failed to allocate NVKMS memory for GEM object) and the desktop session crashed.1024is a starting value for that setup.What it doesn't cover:
vkd3d-proton's own allocations stay outside these rules.5,684 / 4,865 MBin steady state), while701–972 MBof free space remains inside partially-empty 64 MiB texture pool blocks.Verification (Linux,
GE-Proton11-14Wine runner,x86_64-pc-windows-msvc)crate::host::host()isNonethere. The 3 new tests are pure CPU tests, so they do run.the_vram_headroom_is_read_in_mib_and_is_off_unless_set,the_card_budget_leaves_the_headroom_free,a_full_card_is_trimmed_below_the_headroom(all pass).cargo +1.98.1 test -p victory-gpu --lib(Wine):525 passed(default) /591 passed(--features diagnostics), matching untouchedmain(fe7c6e5).cargo +1.98.1 clippy -p victory-gpu --all-targets -- -D warnings: clean, default and diagnostics.cargo +1.98.1 xtask policy:asset policy: 322 files ok.GE-Proton11-14-viewtree, Wayland,vkd3d-proton, Series S, DLSS Quality):5,823 / 5,823 MB(0 MBfree), compositor hitnvidia-drm: Failed to allocate NVKMS memory for GEM object.VICTORY_VRAM_HEADROOM_MB=1024(4m 03s): clamped budget4,865 / 5,889 MB,5,684 MBDXGI use (205 MBDXGI free),shadowobeyed clamp (40buffers turned down),nvidia-smipeaked at7,549 MiB(309 MiBfree) and plateaued at7,527 MiB(331 MiBfree),0NVKMSerrors.13.4–16.8 fpsat4,000–6,200draws/frame with the headroom on, in line with the run without it. The headroom keeps the compositor alive; it is not a speed change.@TaynanGT on GitHub · 2026-11-29 11:35 UTC · original
Thanks for making VRAM headroom explicit and opt-in. Please test the case where the requested reserve approaches or exceeds the reported budget, so no underflow or misleading available-memory value reaches the admission rules.
@safesearch77 on GitHub · 2026-11-29 13:20 UTC · original
Addressed the edge case where
VICTORY_VRAM_HEADROOM_MBapproaches or exceedsown.Budgetinbudget_less_headroom(noting#414is already integrated into#439at112df69; this follow-up cherry-picks cleanly ontocfd5ebd):Host::video_memory()callers (host::vram_keep_for,host::vram_idle_for,resource::room,resource::texture_floor_bytes,resource::targets_room_kept,pool::spares_for,shadow.rs,draw::staging_budget_per_frame,copystat.rs,panel.rs).own.Budgetall the way to0tripped thebudget == 0("adapter reported no budget") fallback invram_keep_forandvram_idle_for, relaxing eviction to5_000 ms(IDLE_MS/NORMAL_MS) instead of urgent1_500 ms/1_000 mseviction.budget_less_headroomto preserve0whenown.Budget == 0and keep a1-byte floor (budget.saturating_sub(headroom).max(1)) whenown.Budget > 0. Direct unit tests verifybudget_less_headroom,vram_keep_for, andvram_idle_forstay in urgent eviction without underflow whenheadroomapproaches, equals, or exceeds a positive budget; code inspection across admission callers (resource::room,resource::texture_floor_bytes,shadow.rs) shows they likewise clamp down (log prints0 MB) without underflow.saturated_headroom_keeps_urgent_eviction_activeand expandedthe_card_budget_leaves_the_headroom_freecovering approaching, equal, exceeding, and0-budget cases.Verified with Wine
victory-gpu --lib -- headroom(4/4pass),victory-gpu --lib -- vram_(5/5pass),clippy --all-targets -- -D warnings, andcargo xtask policy(322 files ok).@TaynanGT on GitHub · 2026-11-29 13:24 UTC · original
Thanks for catching the distinction between an exhausted budget and an unreported budget. I integrated the positive-budget floor and its regression cases locally. Keeping the urgent eviction path active when the reserve exceeds the budget is the intended behavior; I still need to validate the tests on Windows.
@TaynanGT on GitHub · 2026-11-30 17:08 UTC · original
mainhas moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the currentmainand open a new PR; I'll review it there.Pull request closed