GPU: a withheld range holds back only its own bytes of a marked page (#1976) #2004
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!2004
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2004/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?
@Jitheswar on GitHub · 2026-11-25 02:44 UTC · original
fix/marked-page-withheld-range→main· +105 −9 · 1 files · 1 commits · closed without mergingFixes #1976. Claimed on #1633 at 02:21:19 UTC.
Bug:
copy_back_marksskips a whole 64 KiB marked page when any withheld range (a list whose shaders read memory with no copy) overlaps it. So another list's valid write on that page never reaches title memory, because the later per-rangecopy_backhas no snapshot for marked pages. This is exactly @yualk's fixture: same-page marked + miss retires00 00 00 00for both ranges.Fix: one page bit can't say whose write a byte is, so
copy_back_markednow takes the page's withheld byte ranges as holes:keep_writesleaves them and as the whole skipped page used to be.Test:
shadow::tests::a_withheld_range_holds_only_its_own_bytes_of_a_marked_page(synthetic, no game data):Without the fix it fails at step 1 (
[0,0,0,0]instead of[5a,5a,5a,5a]), the issue's symptom.Compared with the two other open PRs for this issue. I ran the same test against each one's head on the same machine:
0vs5a)0vs3c)0vs3c)withheld_ranges_are_cut_out_without_losing_the_gaps:(131122, 131152)vs(131122, 131172))The "next marked write" row is the case I got wrong first myself: leaving the page not taken keeps it marked as changed, and its next marked copy-back is then kept back as a title-changed page. Happy to have this folded into whichever PR the maintainers prefer.
Checked on an RTX 3050 6 GB Laptop (Linux, Proton 11, vkd3d-proton, real device):
victory-gputests: 130 passed / 14 failed. The 14 are identical to plain940d32fon this host (the view heap is capped at 1,000,000, plus vkd3d root-signature refusals).-D warningsis clean, with and withoutdiagnostics.cargo xtask policypasses. rustfmt adds no new differences.main(VRAM), so the world's marked pages weren't exercised in-game.AI-assisted (Claude Code).
🤖 Generated with Claude Code
@Calvix2k on GitHub · 2026-11-25 02:47 UTC · original
Independent run on Windows 10 19045 with an RX 7800 XT (RDNA3), your head at the time of writing:
shadow::tests::a_withheld_range_holds_only_its_own_bytes_of_a_marked_page— ok.shadow::tests— 5 passed, 0 failed.So the same-page case behaves the same on AMD as in yualk's NVIDIA/WARP fixture: the valid write at 64 and 128 reaches title memory, the withheld 4 bytes stay in the copy and out of title memory, and the no-withhold case publishes both pages.
On the code: clipping
holesper page (a.max(page)/(a+n).min(page+PAGE)) and testing them per byte is the only thing that can be right with one page bit, and theNone(no snapshot) branch keeps the “what differs is the shaders’” rule while skipping held bytes. Nothing I would change.(The one failing test in
victory-gpu --features diagnosticson this host is unrelated: the placed-view sharing test needsID3D12Device10, absent on the Windows 10 system runtime — tracked in #1999/#2005.)@welisonzika14-jpg on GitHub · 2026-11-25 03:01 UTC · original
RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC. No game files, unit tests only. Head
c14029d(base940d32f),cargo test -p victory-gpu --lib, run twice: 142 ok, 2 fail both times. The 2 are the view heap cap tests thatmainalready fails on NVIDIA (#1744). The newshadowtests pass.One note: in one earlier combined run (
-p victory-gpu -p victory-shader)bindless::tests::heap_views_are_currentfailed once (round 0, dword 0,left: 0,right: 1064). It passed 3 times alone and in the 2 runs above, so it looks intermittent. I cannot say if this PR is involved.#1998 covers the same issue (#1976); it also passes here.
Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
@jeremygold02 on GitHub · 2026-11-25 03:08 UTC · original · edited 2026-11-25 03:22 UTC
Triage verdict — Consolidate with #1998 (
c14029d)Evidence
c14029d,copy_back_markedleaves the withheld bytes different in the shadow, then still callst.takenfor a full page. It also writes the entire page span from a title snapshot, including the holes. A title write into a hole after that snapshot could be overwritten even though the GPU bytes there were withheld.Checks and limits
Next step
This verification was AI-assisted.
@BaggyALPHA on GitHub · 2026-11-25 03:13 UTC · original
I tested the next-refresh concern raised above on Windows/RTX 3080 with the same synthetic fixture on
940d32f+ this PR (c14029d) and separately on940d32f+ #1998 (3385794).This PR failed 3/3: the refresh copied zero bytes and the second copy-back overwrote the title-side value with the previously withheld bytes. #1998 passed 3/3 and all seven shadow tests passed with the added probe.
As a causal check, I locally prevented this PR from calling
takenwhen a page has holes. The new test passed, but the existing fixture's second write then failed in its sequence without an intervening refresh. So the guard is diagnostic evidence, not a complete patch by itself. This fixture tests the next-submission issue specifically. All inputs were synthetic, with no game files used.AI-assisted (OpenAI Codex).
@Calvix2k on GitHub · 2026-11-25 03:34 UTC · original
Correction to my verification above: I only checked the first submission and the full-page/no-withhold cases, which pass. @jeremygold02's next-refresh fixture (a title-side write into a withheld range, then a refresh and a second copy-back) fails 3/3 here — the unconditional
t.takenfor a page with holes lets the withheld bytes come back later. So "nothing I would change" was too strong.@Halfect's #1998 keeps the same regression and only marks a page taken when no withheld range was left different; it passes that fixture on an RTX 3080 (jeremygold02) and its six shadow tests pass on my AMD host. That is the one I would land for #1976.
@Jitheswar on GitHub · 2026-11-25 06:51 UTC · original
Thanks @BaggyALPHA, @jeremygold02 and @Calvix2k. You're right: calling
t.takenon a page with holes lets the withheld bytes come back after a refresh and overwrite the title's write. The comparison table in my description is also out of date: #1998's current head handles the "next marked write" row I listed as lost.I checked #1998 at
b49aa3fon my machine (RTX 3050 6 GB Laptop, Linux, Proton 11, vkd3d-proton): all 7shadow::testspass, 3 runs out of 3, includinga_title_write_does_not_suppress_the_next_marked_submissionanda_withheld_range_does_not_suppress_the_pages_other_writes(the same-page fixture this PR added).So #1998 covers everything this PR does and the case it gets wrong. I'm closing this in its favour for #1976.
AI-assisted (Claude Code).
Pull request closed