victory-gpu: ray-tracing arenas count against their own most, not the windows' card room #971
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/971"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by eleboucher on 2026-11-28T10:20:58Z.
by_addressin shadow.rs added every ray-tracing arena's length toWINDOW_CARD_BYTES, including arenas that spilled to PC memory, so the arenas used up the windows' card cap (window_card_most) and later windows went to shared memory. Its localUSEDcounter was also never decremented when an arena was dropped or when the card buffer could not be made.Arenas now count in their own
ARENA_CARD_BYTES(held to the same 4 GiB / VICTORY_MEMORY_CARD_MB most as before), aCardremembers whether its arena is on the card or spilled, and drop subtracts from the right counter. The HUD and live-span totals include both counters. Unit testarenas_do_not_use_the_windows_roomis added.Tested on RTX 4070 Ti SUPER 16 GB, Ryzen 7 9800X3D, 16 GB RAM, Windows 11, ray tracing on (VICTORY_RT_NATIVE=1): several runs including 7-minute ones with no regressions. This branch type-checks for x86_64-pc-windows-msvc with and without victory-gpu/diagnostics; the unit test was not run here (Windows-only crate).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Bj0rnis on 2026-11-28T12:52:33Z.
Independent Windows / RTX 5070 Ti 16 GB headless verification of
bc34ae72(Windows 11, Ryzen 7 9800X3D, 32 GB RAM, driver621.24, Rust 1.98.1):main(63b902f).cargo test --locked -p victory-gpu --lib arenas_do_not_use_the_windows_room): 1 passed, 0 failed (0.00 s).victory-gpusuite on RTX 5070 Ti (--features diagnostics --lib --locked): 507 passed, 0 failed, 36 ignored (7.07 s).victory-gpusuite on WARP (VICTORY_D3D12_WARP=1,--features diagnostics --lib --locked): 506 passed, 1 failed (pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws— confirmed pre-existing onmain63b902f, unrelated toshadow.rs).cargo clippy --locked -p victory-gpu --lib -- -D warnings): 0 new warnings in this PR's diff (1 pre-existingclippy::manual_is_multiple_ofat untouchedshadow.rs:1738).cargo xtask policy: 294 files ok.Not tested: live RT gameplay workload (
VICTORY_BVH_BUILDER=1/VICTORY_RT_NATIVE=1). No game data, logs, or captures attached.AI-assisted test run and summary.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CuteBooty on 2026-11-28T15:02:53Z.
I ran this in the game with ray tracing on, on an 8 GB card: RTX 3070 8 GB (driver 621.24, PCIe 3.0), Ryzen 7 5800X3D, 32 GB, Windows 11 26200. Build: main
63b902fe, my local patches, and this PR.VICTORY_BVH_BUILDER=1,VICTORY_MEMORY_CARD_MB=768, Series S, DLSS performance, frame generation 2x. Played for 6.6 minutes, no crash.Against an earlier ray-tracing session without this PR (same card, 11.3 minutes, no
VICTORY_MEMORY_CARD_MBsetting; that session also had the water light left out and a keep-awake helper on, and drew 6-7k draws a frame against 4.7-6k here, so not like for like):What differed: the earlier session slowed from minute 8. In this one, usage exceeded the reported budget by minute 2, and DLSS started refusing to record upscales. The arenas line passed 768 MB although
VICTORY_MEMORY_CARD_MB=768was set. The log doesn't say how much of the arenas sat on the card and how much spilled to shared memory, so I can't tell whether the refunds let arenas take card room sooner. A line with both counters would settle it.What the player saw:
One run, so I'm not crediting or blaming the PR for the frame times. The memory curve and the DLSS warnings differed most between the runs.
(Measurements and text prepared with my AI assistants, Claude Code and Codex. No game files.)
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by eleboucher on 2026-11-28T16:00:07Z.
Thanks @Bj0rnis for the checks and @CuteBooty for the 8 GB run. The run found a real problem, and I pushed two commits for it.
Why card use went up with this PR. Before, the arenas counted their bytes against the windows' 1024 MB limit, and that count never went down when an arena was freed. So it acted as a lifetime cap: after enough arenas had come and gone, new ones stopped going to the card. This PR gave the arenas their own count and refunded freed bytes, which removed that accidental cap. But the arenas could then fill the card up to 97% of the budget, which leaves no room for the textures and DLSS. That matches your log: usage over budget from about minute 2, then DLSS refusing to record.
What the new commits change:
43a998a8: arenas and windows go to the card only below the texture queue's line (budget minus the larger of 768 MB and 5%, never under 90%), the same line the texture queue already keeps. Past it, they go to shared memory. The arenas line now says how much is on the card and how much is in shared memory:N MB in N arenas (X MB on the card of at most Y, Z MB in shared memory).11cb2ddc: windows also keep a fifth of the budget free, as title buffers do.About
VICTORY_MEMORY_CARD_MB=768. The old line counted every arena, including the ones that had spilled to shared memory. So passing 768 MB on that line did not mean the card held more than 768 MB. The new line shows the two parts separately.Tested here:
copies_stop_at_the_texture_lineandarenas_do_not_use_the_windows_roompass on an RTX 4070 Ti SUPER 16 GB. I couldn't get a live number on this PC. It has 16 GB of system RAM, and withVICTORY_RT_NATIVE=1plain main63b902fealready fails while loading, before the arenas fill:a host command list did not close (0x8007000E). The PR build fails at the same point. That failure is system RAM and is unrelated to this PR.Not tested on an 8 GB card. @CuteBooty, if you can rerun your session on
11cb2ddc, the new arenas line plus the DLSS out-of-VRAM count would show whether usage now stays under the budget.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tupacfan04 on 2026-11-28T23:36:36Z.
Test data from an RTX 5070 12 GB, in case it helps judge this one.
Setup: RTX 5070 12 GB (driver 621.40), i9-14900F, 32 GB, Windows 11. Series X, 2560x1440, DLSS Quality (model K), frame generation 2x,
VICTORY_BVH_BUILDER=1. Unattended 6-minute runs on one walking route, built from source.What I ran: not this branch as is. I ported only the counter part (by-address copies counted against their own most, not the windows' card room) onto a local branch behind a switch, so I could A/B it inside one build. Treat it as a test of the idea, not of your exact diff.
(An earlier own-room run gave 7.7 fps and the same 529 / 960 MB split, but a compile was running on the PC during it, so I only count its memory figures.)
Reading: on a 12 GB card the arena counter is not what sends these copies off the card; it showed 529–657 of 4096 MB. By reading
resource.rs, the deciding test is the card's budget (use + the copy + targets to come under 97 %). With own room on, the windows take up to about 1 GB of the card, and the budget test then refuses more arenas, so more of them land in PC memory and the frame gets slower even thoughmemory::readyitself gets cheaper (12–13 ms per frame against 15–24). The budget-test explanation is from reading the code; I have not confirmed it with a run yet.So on 12 GB this change alone looks like a loss; on a card with more room it may well be the win you measured. The per-frame timings I quote come from the log line in #1468. Run summaries: https://gist.github.com/tupacfan04/0dbd2a5d33dd78e208d4914306dd175b (the full play logs of these runs have rotated out; I can attach fresh ones on request).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by eleboucher on 2026-11-29T13:28:30Z.
@tupacfan04 thanks for the A/B, and sorry for the late answer.
Your reading fits the code as I understand it. Before this change the arenas were charged to the windows' room, which capped how much card memory the windows could take; that cap kept room free that the budget test later gave to arenas. With the double count removed, windows can take up to their own cap, and on a 12 GB card the budget test (use + copy + targets under 97 %) then refuses arenas first. Arenas are read by every ray-walk step, so arenas in PC memory cost more than windows in PC memory: a loss on 12 GB, as you measured.
The exact fix is not to restore the double count but to order the two: when the budget is short, arenas keep their card room ahead of windows (a window spills, or is refused, before an arena does). I'll try that and A/B it here with the card's budget held near a 12 GB card's. I'll post the numbers in this thread, or in a new PR referencing this one.
If you still have the 529 / 960 MB runs' setup, one log of each with the "title memory by address" and "card room" lines around 6 minutes would let me check that the refused arenas are the ones the walks read.