GPU: a withheld range whose writes are marked could drop only its marked pages (copies 397 to 232 MB a frame here) #3089
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#3089
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Machad3x on GitHub · 2026-11-26 07:25 UTC · original
drop_withheld(address, len)in the copy-back drops every withheld declared range whole, so each of its pages is copied from title memory again at the next refresh. Where the range's writes are marked (themarkedflag ofStep::GpuWrite), only the pages with a mark hold anything the shaders wrote.Measured (cell window, Ryzen 7 5700X, RTX 3080 Ti, a fork with other copy changes on top of
main):The change:
markedas the AND over the steps naming the range.drop_withheld.copy_back_marks, the pages it filters out as withheld are dropped one by one (drop_withheld(page, PAGE)), after the marked pages' copy-backs. Pages from the title-memory bitmap that are held back are already dropped there.Caveat: this relies on the marks being complete, since a lost mark now leaves the shaders' bytes in the copy. #2269 (marks in the last dword of the bitmap cleared unread) is a prerequisite; here no bits from that dword are handed out any more.
Not tried: longer runs, other scenes, other hardware.
AI-assisted.
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 07:57 UTC · original
Picked this up on the fresh upstream/main (
63bcca4). Updating only the pages the GPU changed is not safe on this base yet, because of #2269.Shadow::copy_back_marks(crates/victory-gpu/src/shadow.rs:900) clears the whole last 32-bit word of the written-pages bitmap (bits[words - 1] = 0), so marks for offsets past the bitmap do not leak into a later copy. Marks that legitimately land in bits 0..30 of that word are dropped with it — up to 31 valid marks per pass.Synthetic WARP test, four 64 KiB pages:
0x99instead of0x200x20Full GPU suite: 247 passed, 1 skipped. Clippy and the repo file checks passed. No in-game measurement repeated.
Conclusion: the working tree keeps the full update. Selective copy stays blocked until the last bitmap word is handled.
Reproduction: branch
test/3089-withheld-page-refresh, commit0f6b078(on top of63bcca4), testwithheld_view_page_refresh_on_warp,shadow.rs:1565.@Machad3x
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 08:43 UTC · original
Follow-up on the same base (
63bcca4), local only.The page-selective copy from #3089 has a second blocker besides the last bitmap word (#2269): a declared range that only partly overlaps a withheld range of the same copy is withheld wholesale.
host.rs:1384: every range overlapping a withheld range of the same shadow is marked withheld (b.3 = !held.iter().any(...)), so the bytes of the valid range outside the overlap never go back either.Reproduction (WARP, one 64 KiB page, one copy, two declared ranges):
0xaaat offset 00xbbat offset 6463bcca40xaa0x10(still title memory)0x10(withheld)0x10Branch
test/3089-partial-range-overlap, commitf245720, testshadow::tests::withheld_partial_range_overlap_keeps_valid_prefix— it fails on63bcca4by design, asserting that the valid prefix goes back.That is the behaviour #1986 and #1998 change. Until one of them lands, page-selective copying would only move the same wholesale drop from ranges to pages: the measured 397 to 232 MB a frame cannot be taken while valid writes on shared pages are lost.
Also still open:
copy_back_marksclears the whole last 32-bit word (bits[words - 1] = 0), dropping up to 31 marks. With the expectation that the tail mark survives, the earlier fixture refreshes 0 pages instead of 1 (0x99instead of0x20at the next GPU read).@Machad3x