Shaders can mark the pages they write through views: the translator's half (from VIctory and neonbyte1; off until the layer asks) #3641
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!3641
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3641"
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?
@banaanpapa on GitHub · 2026-11-30 02:26 UTC · original
banaanpapa:port/view-marks→main· +434 −21 · 5 files · 2 commits · closed without mergingPart 1 of 2: the shader translator's half of write marks, a port from Marvisak/VIctory (cd94d353) and neonbyte1/VIctory (GPL-3.0-or-later, as this tree). It changes nothing by itself: the marks are emitted only when the host asks (
emit::set_view_marks), and nothing asks yet. The layer's half follows as its own pull request. No game was run.Why
A copy in the card's memory whose shader writes are declared is compared on the card after every submission, every declared 64 KiB piece, to find what shaders wrote.
host/lazy.rshas the figure for one copy: "2.2 GB of the card's reads a frame to find about 2.6 MB that shaders wrote", and its answer (VICTORY_LAZY_COMPARE_MB) is off because it can lose bytes. On the RTX 5080 here the compare reads 680 to 850 GB/s (indirect::tests::card_compare_costs), so those 2.2 GB are about 3 ms of the card a frame for that one heap; on a card a third as fast, three times that.VIctory answered the same question on 2026-11-25 by having the shaders say what they write ("2.8-4.5 GB a frame, 98 % unchanged" before it). That mechanism is what this ports.
What a program does with marks on
Every store and atomic through an unordered buffer view it takes from the view heap (a table's, or one picked at an index) also sets a bit in the host's bitmap, the root UAV
u249(SLOT_VIEW_WRITES, 2^22 bits). The bit comes from the root SRVt249(SLOT_VIEW_MARKS), two dwords for each title slot: a base bit and a phase. A write of bytexof the view sets bitbase + ((phase + x) >> 16), for its first and its last byte. A base ofVIEW_MARK_NONEmarks nothing.What differs from VIctory's
ROOT_CBV_SPACEbeside this tree's others (strides, sampled marks), not views of a space of their own.SLOT_TABLE_STRIDES); structured stores go through structured handles here, so their byte is the index times the stride, computed only with marks on.set_view_marks), not a switch of the translator's: a program with the two root views under a layer that does not bind them would read and write what is not there.What was run
emit::waterfall_tests::stores_through_a_tables_view_mark_their_pages, on the RTX 5080 and on WARP, validated bydxil.dll: a program that stores 24 dwords through a table's unordered view sets exactly the bits of the pages it writes: one page; two, with the view beginning 40 bytes before a page's end; two, with only the last byte of the last write in the next page; one, a view that begins three pages in; and none for a view without bits (the whole bitmap is read back, its last bit too). The stored dwords are as without marks. All of it with one lane marking for the wave and with every lane marking, to the same bits.cargo test -p victory-shader --release --lib: 463 pass, none fail, with the marks off (the default). Forced on for the whole suite, no program fails validation; the tests that then fail are those whose host does not bind the two views, which is what the host's flag is there to prevent.Limits
f72cec77; it was built and tested merged with41adb551, and the merge is clean.The check
The
checkjob fails here as it does onmain: Clippy stops atcrates/victory-loader/src/crash.rs:804(unwind_copyis never used), a file this branch does not touch.Merged with
main(2026-11-30,c71899d9)Two files conflicted:
maingaveheap_handle_noteda key by which a sampled mark is made once along dominated paths (fc07cc51), and this branch gave it the title's slot. Both are kept. Run again on the merged branch: the write-marks test passes on the card and on WARP; of the crate's 546 tests 535 pass and one fails,emit::bitcode::opt::tests::hw_tests::split_lds_wave32_read_after_read_barrier_coalescing_and_parity, which fails the same way onmainbuilt by itself (opt.rs:7736, a file this branch does not touch).Measured in play: the marks cost more card time than they save (2026-11-30)
One 9-minute session in the title's world on an RTX 5080 (driver 621.40,
e1251c31with #3641 and #4174, about 4,800 draws a frame, the card 99 % busy), compared with sessions in the same scene without marks:VICTORY_VIEW_MARKS=1The extra card time holds through the session (31-32 ms in each quarter, no pipelines being made). Coverage was high: per frame 300 compared copies were left to their marks and 18 were compared whole. But on a card that is the frame's limit, the work each marked store does costs about 27 % more card time, and the compare it saves is only 0.2 ms. So on this card the marks are a loss as built, and should stay off. A slower card whose compare costs milliseconds might come out differently; that hasn't been measured.
🤖 Generated with Claude Code
@mstrmoos on GitHub · 2026-11-30 19:22 UTC · original
Picked together with #3626 on the RTX 5080 16 GB, Ryzen 7 9800X3D, Windows 11, Series X profile, same save and 90 s bench route each run.
The frame median was 40.0 ms before and 40.4 ms after, which is within noise. That's expected: this is the translator's half, and nothing reads its marks until the layer's half lands.
cargo test -p victory-gpuand-p victory-shaderpassed after a one-line fix in aland.rstest:jobswas shadowed. That fix came from the merge with #3626, not from this PR.@banaanpapa on GitHub · 2026-11-30 20:00 UTC · original
Thank you for running it in the game. As you say, this half on its own changes nothing: the marks are read only with #4174 and
VICTORY_VIEW_MARKS=1, and then the translations change, so the shader cache has to be filled again.To set expectations for #4174: on my RTX 5080 the in-game logs put our compare lists at about 0.3 ms of card time a frame. That's all the marks can save on a card that fast, and that PC is limited by the submitting thread, not the card. The bench in #4174 shows a 15x cut of that compare work, so slower cards should gain more.
@trustno1-coder on GitHub · 2026-12-01 18:50 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