play: the sampled-slot marks off by default (5-7 ms a frame on an RTX 3090) #4506
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4506"
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 Kenzim on 2026-11-30T21:31:49Z.
VICTORY_SAMPLED_MARKS=1is a default ofvictory play. It adds, at every texture a shader picks from the view heap, a read of the marks' buffer, a compare and an atomic OR behind awaveIsFirstLaneguard. This turns it off by default;VICTORY_SAMPLED_MARKS=1has the marks again.Measured (RTX 3090, native 2560x1440, no DLSS, ray tracing off, 2026-11-30)
victory replay --compare --shaders/--shaders-b, same picture)One run each in the title after a warm-up; the two stretches are the same scenes second for second. A later run on main with the marks on again read 37.2 ms where the default (off) read 33 ms.
Where the time goes
839 of the frame's 1231 shaders carry the mark (22,093
atomicBinOpand 20,679waveIsFirstLanecalls over them). From per-pipeline times of the two shader sets, about 6.9 of 8.4 ms is in pipelines with a pixel stage:waveIsFirstLaneguard: about 1.5 ms.The read, compare and rare atomic themselves are cheap. (A version of the marks that forces early depth where that is safe and leaves the discarding programs unmarked measured about +1.4 ms against marks off; it is not in this change.)
What the marks fed
sampled::sampled_lately(the order of uploads of textures picked by index, and first uploads over the room line) and slot eviction by marks (VICTORY_SAMPLED_EVICT, already off by default). Without them every such slot counts as sampled lately.Checked at the opening's scene cuts, marks on against off: the upload backlog and the volume uploaded in the 65 s after the first cut are alike (peak backlog 7,520-9,815 off against 10,466 on; 15.8-15.9 GB off against 15.5 GB on), so textures do not arrive later without them.
Not measured: cards with little memory, which may want the marks back together with eviction.
Launchers and the shader cache
VICTORY_SAMPLED_MARKSis part of the shader translation's key, so after this change every existing shader cache is translated once more (a preload does it ahead of play).scripts/play-nvidia.ps1set the switch to1whenever the settings file did not name it, to ask for the translationvictory preloadmakes (#4067). It now sets0in that case, the valuevictory playpasses, so a run started from the script (orPLAY_FRAMEGEN.cmd) gets the same translation and the same gain. Thanks to @IRennie74 for catching this in review.Also in this change
The shader census (
VICTORY_SHADER_CENSUS,victory translate) had one count for all wave and quad operations. Its line now ends withcalls=and eachdx.opfunction called with its count, which is what showed the marks.Checks
cargo check --locked -p victory --features diagnosticspasses on this branch.cargo xtask policyreports onlycrates/victory-shader/src/native.rs, which is main's and not touched here.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by IRennie74 on 2026-11-30T22:39:03Z.
The script launcher still turns the marks on:
scripts/play-nvidia.ps1:392(on main) setsVICTORY_SAMPLED_MARKS=1whenever the settings file does not name it, besideBVH_MISSandNAN_SCRUB, because the switch is part of the shader translation key (#4067). With onlyplay.rschanged:play-nvidia.ps1/PLAY_FRAMEGEN.cmdkeep the marks, so they get none of the card time this measures;victory play's own preload now translates with the marks off while a script-launched run asks for them on, so that preloaded cache is not hit and shaders are translated again in play: the stutter #4067 fixed.Dropping
'VICTORY_SAMPLED_MARKS'from that line (or giving it'0'there) keeps the two in step. A line in the description that the flip changes the translation key would also help: every existing shader cache is translated once more after updating.On a smaller PC this may matter in the busiest frames: on a Ryzen 5 5600X with an RTX 3060 (Series S, 960x540, DLSS Performance) the card is 34-38 ms of a 55 ms frame standing, but 57-62 ms in frames of 5,000+ draws, where it is the wall. We can A/B it there with the launcher line fixed.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Kenzim on 2026-12-01T10:54:38Z.
Thanks for catching this. It is fixed in the second commit (now
3857efe6):scripts/play-nvidia.ps1setsVICTORY_SAMPLED_MARKS=0unless the settings file names it, the same valuevictory playpasses. A launcher run and play's own preload now ask for one translation, and the launcher gets the gain too. The description now says that the switch is part of the translation key, so every existing shader cache is translated once more after updating.I have also rebased the branch onto
main(5fabb46e). It had been cut from the v2026.11.30.03 release line (#4152), which is why it showed 34 files and a conflict. It is now these two commits, four files.An A/B on the 5600X / 3060 would be very welcome, especially the frames with 5,000+ draws where the card is the limit. With the launcher line fixed,
VICTORY_SAMPLED_MARKS=1in the settings file brings the marks back for the other side.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.