GPU: copy a shadow's edge pages whole so they are not copied again #436
No reviewers
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!436
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/436/head"
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?
@desplmfao on GitHub · 2026-11-24 03:21 UTC · original
desplmfao:fix/shadow-edge-pages→main· +109 −0 · 1 files · 1 commits · closed without mergingStatus (2026-11-24): not needed if #185 lands as it is now. #185 was reworked after this PR was opened; its
copy_stalekeeps exact partial-page coverage, which does what this PR does more precisely, and the two conflict incopy_stale. Measured (world frames, median): old #185 6.1 s, old #185 + this and #462, #515, #600 4.3 s, new #185 alone 2.9 s. This PR only still helpsmainwithout #185. Details in the comments below; the rest of this description is as written before.Problem
Shadow::copy_stalecopies a 64 KiB page that is only partly inside the requested range in part, and never marks it as copied, so every later range in the same page copies it again. With few, large ranges that costs little. With many small, unaligned ranges in the same pages it dominates: #185 refreshes directly indexed SRVs before each submission (close to a million ranges per world frame), and there it came to about 11 GB of copies per frame.Change
copy_stalewidens the range to its first and last pages' bounds (within the buffer) when no pending range (shaders of a submission may be writing there) overlaps what that adds. The page is then marked and copied again only after the title writes to it. Next to a pending range the old behaviour stays.Measured
RTX 5080, Linux (proton-cachyos, vkd3d-proton 3.2.0), Series X 1.0.2.1. Diagnostics build of
maind2a4bae+ #185 + #259, #177, #151 (needed to reach the world here), with this change on and off in the same binary (a local switch), one 7 min run each, Enter into story mode at about 35 s, numbers from the first 2–3 min in the world:untracked_filled_mb)Xid 109(CTX SWITCH TIMEOUT) about 3 min into the world, then the title's watchdog crash (without #493; see the note above)mainalone this is not measured. #400 reports 25–29 GB requested per world frame there, mostly unchanged; how much of that this saves is open.Related
Shadow::writing,copy_back); same file, different functions.main(Windows, RTX 5070 Ti), including how much of each world frame goes to refreshes.Tests
Two tests in
shadow.rs: small ranges in one page copy it once (and again after a title write), and edge pages stay cut next to pending writes (the copy's GPU-written bytes are kept). Both fail without the change (16 bytes copied instead of 65,536, and 16 instead of 32).victory-gputests under Wine: the same 4 unrelated tests fail with and without it (watch::tests::written_pages_are_reported_to_every_asker,resource::tests::buffer_data_reaches_the_host_texture,indirect::tests::argument_clamp_builds,pipeline::library::tests::a_rejected_blob_gives_an_empty_library).AI-assisted (Claude Code).
🤖 Generated with Claude Code
@desplmfao on GitHub · 2026-11-24 05:47 UTC · original
Update: #185 has since been reworked (8 more commits, 04:04–04:57 UTC, after this PR was opened). Its
copy_stalenow keeps exact partial-page coverage (whole/partial), which solves the same repeated copy of partly covered pages more precisely than this PR's whole-page widening, and it conflicts with this PR incopy_stale.Measured on the same machine and input (RTX 5080, Linux / proton-cachyos, world frames, median over the same window after world entry, with #493 in all three):
So if #185 lands as it is now, this PR is not needed and I'd close it. It only still helps
mainwithout #185 (any refresh that requests many small ranges in the same pages). Leaving that call to you.AI-assisted (Claude Code).
@alexdeliu on GitHub · 2026-11-24 17:23 UTC · original
Merged onto
main@ffe310eb(PR heade914ed45), the PR's own test fails, the same on a retry:This is not GPU-specific, so CI should show it too on the next push.
Checked with CI's steps (both clippy runs with
-D warnings,cargo test --workspace) on Windows 11, AMD RX 9070. Every open PR: https://gist.github.com/alexdeliu/ef9ef0ebc1776ff104b5aa8eaea18e87Pull request closed