Keep alias-safe VICTORY_WC_NO_BACK under VICTORY_HW_RT and always copy back DXR postbuild sizes #4760
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4760
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4759"
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?
@steven-seagull27 on GitHub · 2026-12-01 05:47 UTC · original
steven-seagull27:perf/hwrt-wc-noback-postbuild→main· +211 −39 · 2 files · 1 commits · closed without mergingWhat it changes
Commit
9a427c14disabled bothVICTORY_UNIFIED_BACKandVICTORY_WC_NO_BACKwheneverVICTORY_HW_RT=1is requested (!crate::hwrt::requested()), forcing all declared shader writes into>= 1 MiBwrite-combined GPU buffers through readback and compare passes under hardware ray tracing. In addition,HwRtManager::emit_postbuild(crates/victory-gpu/src/hwrt.rs) recorded its 8-byte compacted BLAS postbuild size answers throughShadow::gpu_writesrather than an explicit CPU-readback path.Shadow::gpu_writes_backforHwRtManager::emit_postbuild(hwrt.rs,shadow.rs): Routes DXR postbuild size writes throughShadow::gpu_writes_backso host-emitted compacted BLAS size answers are always scheduled for CPU copy-back even when their destination lies inside a large write-combined buffer pool.VICTORY_WC_NO_BACKunderVICTORY_HW_RT=1(shadow.rs): Re-allowsVICTORY_WC_NO_BACK=1underVICTORY_HW_RT=1viaVICTORY_HWRT_WC_NO_BACK(1by default: leaves>= VICTORY_WC_NO_BACK_MIN_KBpure write-combined shader writes on the GPU unlesshas_smaller_overlapdetects a smaller registered sub-buffer or loose window overlapping the written range;2: leaves all>= minWC shader writes on the GPU;0: restores full copy-back).has_smaller_overlapscans theBTreeMapbuffer table andLOOSEwindows without heap allocation, catching inner sub-buffers even before theirShadowcopy has been lazily instantiated.How it was tested
origin/main+ this commit alone were not recorded here.wc_no_back()unconditionally returnedfalsewhencrate::hwrt::requested()wastrue, andHwRtManager::emit_postbuildcalledsh.gpu_writes.VICTORY_WC_NO_BACK=1remains active for non-aliased>= minwrite-combined buffers underVICTORY_HW_RT=1(VICTORY_HWRT_WC_NO_BACK=0opts out), inner sub-buffer overlaps fall back to copy-back, andemit_postbuildalways copies back postbuild sizes.cargo testpassed for the crates it touches: yes (targeted suites onec5e14f7, based on5fabb46e):cargo test --locked -p victory-gpu --lib overlapping_tests: 3 passed, 0 failed (includinghwrt_wc_mode_and_smaller_overlap_detect_inner_subbuffers).cargo test --locked -p victory-gpu --lib hwrt::tests: 19 passed, 0 failed.cargo clippy --locked -p victory-gpu --lib --tests: 0 warnings inhwrt.rsandshadow.rs(origin/main5fabb46ecurrently has 5 pre-existing warnings inhost/{font,menu,panel}.rsfrom#4634, tracked in#4679/#4707).cargo run --locked -p xtask -- policy: 464 files ok (git diff --check origin/main...HEADclean; full--workspacesuite not run).Checked for overlap
VICTORY_WC_NO_BACKunderVICTORY_HW_RTor routesemit_postbuildthroughgpu_writes_back).@KruIN689 on GitHub · 2026-12-01 09:29 UTC · original
Independent in-game test: a clear gain with hardware RT on a CPU-bound PC. This is the first in-game run of this PR.
Setup
9a427c14. One build as is ("main"); one with this PR'sec5e14f7cherry-picked, which applies cleanly.VICTORY_HW_RT=1, Series X native 1440p, our play defaults (VICTORY_WC_NO_BACK=1,VICTORY_WC_NO_BACK_MIN_KB=1024).VICTORY_HWRT_WC_NO_BACKunset = 1); "PR m2" isVICTORY_HWRT_WC_NO_BACK=2.What I read from it
has_smaller_overlap's lookup costs nothing visible. Mode 1 sits close to mode 2.cargo test -p victory-gpu --lib overlapping_testsgives 3 passed.9a427c14:VICTORY_CAPTURE(every 8th frame, standing still at the save, outdoors in daylight,VICTORY_HW_RT=1), the PR's frames show the same lighting from capture to capture: no swap between two lighting states, and no corruption.I'm porting this to our fork with authorship kept (it goes in only after review there). Thanks for picking up #4756 so quickly.
Tested with the help of Claude Code (Claude Opus 5.5).
@cafeoh on GitHub · 2026-12-01 10:01 UTC · original
Tested on Turing: RTX 2080 Ti 11 GB (driver 617.14), Ryzen 7 7800X3D, Windows 10 22H2, Series S, DLSS off, ray tracing on with
VICTORY_HW_RT=1, release build, the launcher's defaults (VICTORY_WC_NO_BACK=1,VICTORY_WC_NO_BACK_MIN_KB=1024), pipelines made beforehand, the same scripted prologue run, PresentMon over the last 40 s, two runs a side. Base:e1251c319plus #4568's revert and a structure-size copy fix of ours, the same on every side.About +2.2 fps on this card with the default. Mode 2 may be a little faster, but the gap is within this scene's noise (about ±1 fps). No lost device. A recorded run with the mode-2-like switch showed no one-frame flashes over about 1,900 frames (café, cell).
Tested: the above, one scene. Not tested: the picture with mode 1 itself, other scenes, long sessions.
@KruIN689 on GitHub · 2026-12-01 11:24 UTC · original
Picture check by a human player, same PC (RTX 5080),
VICTORY_HW_RT=1, real driving and walking:9a427c14was about.VICTORY_HWRT_WC_NO_BACK=0: the lights don't blink. fps is lower again: 14.6 fps in the first minute of driving, against 20.4–29.5 with the PR.So the flicker is real with the alias-safe mode too. Some write that the title, or our own CPU side, reads back for the lights still needs the copy back. Next I'm trying to find which copies those are, to keep the copy back only for them. If anyone already knows which buffer the light pass reads back, say so here.
Tested with the help of Claude Code (Claude Opus 5.5).
@andrewpozdnakov7-jpg on GitHub · 2026-12-01 11:32 UTC · original
The RTX 5080 report shows distant lights flicker with mode 1 on this PR. Setting
VICTORY_HWRT_WC_NO_BACK=0in the same build and scenes removed the flicker.4227a69ccefca884e4378f787245acc82c8cd47e makes that copy-back mode the default when hardware RT is requested. Modes 1 and 2 stay available explicitly, invalid values fall back to 0, and the separate DXR postbuild-size copy-back fix stays in place. The change is in one function and its doc comment on top of
ec5e14f7. Review commitI exercised the exact selector on Windows with unset, 0, 1, 2, an out-of-range number, and a malformed value. The commit keeps the non-RT behavior and matches explicit 0 for unset and invalid values. The staged policy passed. The in-game result above is from KruIN689's run with explicit 0. Keeping the faster modes opt-in lets the team continue isolating the buffer that needs copy-back.
Please keep the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change in.AI-assisted with OpenAI Codex.
@MrDenn on GitHub · 2026-12-01 12:44 UTC · original
A data point from a weaker CPU, where hardware RT is most CPU-bound. The copy-back cut works here too, but the fps gain is smaller than on the 9950X3D.
Setup
e1251c31) plus onlyec5e14f7, which cherry-picks cleanly. Release build, warm caches.VICTORY_HW_RT=1, Series X, native 1440p, DLSS Performance, no frame cap, play defaults (VICTORY_WC_NO_BACK=1,MIN_KB=1024), no leave list.VICTORY_HWRT_WC_NO_BACKset at start. Runs in the order 0, 1, 2, 0, 1, 2. The routes were free play and not identical, and the second round's runs were short. Gameplay seconds only.(Per frame. "Copied back" and "uploads" are from the host stats line, "fetched" from the host copies line.)
What I read from it
VICTORY_LAND_LEAVE) on the plain release earlier gave 17.5 fps with 16.5 MB copied back. This PR gets more of the copy back off the thread, with no list.Picture.
(Analysis done with Claude Code.)
ec5e14f7c1to5c310421cd@paales on GitHub · 2026-12-01 17:17 UTC · original
Written by 🤖:
With this PR and
VICTORY_HW_RT=1the light goes wrong: in the first scene of a save (two officers at a car, evening) the picture is dark and red, the white car pinkish. RTX 5070 Ti, Series X 1440p, DLSS Performance, cherry-picked onto a build ofmainfrom 30 Nov with #4338, #4579, #4171 and #4144.The mean colour (R/G/B, 0-255) of the captures from 0.5 to 2.5 s measures it:
VICTORY_HW_RT=1VICTORY_BVH_BUILDER=1(the console walk)VICTORY_HW_RT=1VICTORY_HWRT_WC_NO_BACK=0VICTORY_WC_NO_BACK_MIN_KB=4096VICTORY_WC_NO_BACK_MIN_KB=16384The same 73 ranges keep their shader writes on the card with and without ray tracing; without it the picture is right. So in its ray tracing mode the title reads back some of them: by the sizes, the copies of 11.8 to 12.6 MB (one of 12,600,000 bytes, two of 12,582,912, seven of 11.8 MB). The note on
wc_no_back_mindescribes the same failure (exposure read back stale). Telling the structure builder's own CPU reads apart did not help (the colour stayed 54 / 44 / 40).What I run now: a minimum of its own under hardware ray tracing,
VICTORY_HWRT_WC_NO_BACK_MIN_KB(16 MB by default), so the 1 MB minimum without ray tracing stays. Median frame in the save with hardware ray tracing: 45.2 ms with it and the right colour, 51.3 ms withVICTORY_HWRT_WC_NO_BACK=0, 36.0 ms with this PR's default and the wrong colour. A rule by size may not hold in every scene; the real fix is to know which copies the title reads back.@andrewpozdnakov7-jpg on GitHub · 2026-12-01 17:25 UTC · original
The mode-0 run matches the new default. At current head
5c310421, an unsetVICTORY_HWRT_WC_NO_BACKalready takes the mode-0 copy-back path when hardware RT is enabled. The PR description still says mode 1 is the default, which makes a test with no explicit override hard to interpret. Current selectorCould you include the patch SHA and effective mode in the report? For the next comparison, the most useful pair is the same scene at current head with the switch unset and with mode 1 explicitly set. The existing figures already show the red shift with the earlier behavior and its recovery at mode 0.
@trustno1-coder on GitHub · 2026-12-01 18:32 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed