Repository navigation
GPU: a withheld range on a marked page does not hold back valid writes there - #1986
0xkn0wh3r3 wants to merge 2 commits into
Conversation
VIctory V2: community PRs, merged and testedOpen PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: Unofficial community fork of Marvisak/VIctory, GPL-3.0. |
|
I found one more case on your exact 1c2c216. The marked-page path subtracts withheld ranges, but the snapshot fallback can still copy the overlap of an allowed range and a withheld range into title memory. 5b6583d is one commit on your head. Its WARP regression submits two actual buffer copies through VIctory. List A writes two 0x5a5a5a5a words, then B writes two 0xa5a5a5a5 words starting at A's second word. With B withheld, the original head retired [0x5a5a5a5a, 0xa5a5a5a5, 0] to title memory. The fix retires [0x5a5a5a5a, 0, 0] and all three GPU-copy words stay intact. When both lists are allowed, all three words retire. The focused test passed 10/10 after the fix. The full WARP GPU suite passed 149 tests with 2 ignored, including your marked-page regression. Strict GPU Clippy and asset policy passed. |
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Withheld range on a marked page doesn't hold back valid writes — part of the withheld-range cluster with #1998 and #2004 (fixes issue #1976): three PRs attacking the same bug; maintainer should pick one. This one looks the most targeted.
|
Thanks @andrewpozdnakov7-jpg, that's a real hole, and thanks for the clear reproduction.
The new test @catminou4: on the #1998 and #2004 cluster, this branch now covers both the marked-page and snapshot paths for #1976. |
…hold back valid writes there
|
Automated triage for the maintainers. Needs work: needs the maintainer's decision. Thanks for the test and the explanation. Your argument holds up against I no longer see a correctness problem. What remains is that #1998 fixes #1976 in the same functions, and only a maintainer can choose between the two. CI: passing. Generated by Claude Code |
82ef681 to
0f302f0
Compare
…back valid writes ther) into demo
0f302f0 to
01a0007
Compare
…s there After a submission, `copy_back_marks` puts the pages shaders marked as written through views into title memory, but skipped every page a withheld range touches (a range whose writes stay out of title memory: a program using title memory declared it in a list that missed memory). A page is 64 KiB, so another range's declared write on the same page was lost with it (issue 1976: list A's bytes at offset 64 retired as zeros because list B's withheld range sat at offset 256). `copy_back_marks` now takes the submission's declared ranges with whether each goes back. On a page a withheld range touches, what the ranges that go back declared there goes back, less the withheld ranges (`Shadow::copy_back_marked` with `only`). Bytes a withheld range covers, and bytes no list declared, stay out of title memory and the copy keeps them, as before; the page is not taken, since the copy differs from title memory there. Pages no withheld range touches go back whole, unchanged, and the marks of shaders using title memory are held back as before. The new test declares a valid range and a withheld one on the same marked page plus a valid one on the next page: with the whole-page skip, the valid write on the shared page reads back as zeros.
01a0007 to
b6ae3a0
Compare
…o demo (already here: rebased only)
A marked page that a withheld range touched goes back in part and stays changed, with no saved bytes. The new test runs a second marked submission on that page the way a submission prepares a marked view: its refresh of the view's whole pages takes the page, so the shaders' writes and a title write made during the run both go back.
|
Thanks for the review. I added the test you suggested in 487598d: The first half of your description is right. On the partial path, The second half doesn't happen in a real submission, because the page doesn't stay changed until the next copy-back. Every marked UAV view is refreshed by whole pages before its lists run:
So when the next submission's I left the page changed on purpose rather than calling |
…o demo (its new commit)
Fixes #1976.
The problem
A list's valid write could be lost because another list's withheld range sat on the same 64 KiB page. In issue 1976, list A's bytes at offset 64 retired as zeros because list B's withheld range sat at offset 256 of the same page.
The mechanism: after a submission,
copy_back_marksputs the pages that shaders marked as written through views into title memory. It skipped every page a withheld range touches. A withheld range is one whose writes stay out of title memory: a program using title memory declared it in a list that missed memory. Since a page is 64 KiB, skipping the whole page also dropped any valid list's declared write on it.The fix
copy_back_marksnow takes all of the submission's declared ranges, each with whether it goes back (host.rspasses them all instead of only the withheld ones).Shadow::copy_back_markedwith the newonlyargument; the ranges are cut with a newsubtracthelper).Marks still do not tell lists apart: a page that a withheld list and another list both wrote through views goes back unless the withheld list declared it (the existing shortcut, left as is).
Testing
shadow::tests::a_withheld_range_does_not_hold_back_a_valid_write_on_its_page: declares a valid range and a withheld one on the same marked page, plus a valid one on the next page. It fails with the old whole-page skip (the valid write on the shared page reads back[0, 0]) and passes with the change.shadow::tests::subtract_cuts_ranges_and_joins_overlapscovers the range helper.shadow::tests::a_page_that_went_back_in_part_takes_the_next_marked_writes_back: after a partial copy-back the page stays changed with no saved bytes; a second marked submission on it, refreshed as a marked view is (whole pages), takes the page, and its shader writes plus a title write made during the run reach title memory. With the refresh left out, the second write is lost, so the test would catch a path that skipped it.cargo test -p victory-gpuon an RTX 5070 Ti (driver 621.24): all pass exceptdescriptor::host::tests::dynamic_slots_are_held_until_releasedandmemory::tests::lists_share_a_table_and_copies_keep_their_views, which fail the same way onmain(the NVIDIA 1,000,000-descriptor heap cap, NVIDIA D3D12 (70564ae): stride_tests & synthetic_tests fail due to HEAP_VIEWS (2M > 1M NVIDIA limit) and Stride::Structured with rawBufferLoad #1835).cargo clippy -p victory-gpu --all-targets, with and without--features diagnostics: clean.Not covered
Rebased onto 13f91ca
host.rsnow passes all ofbacktocopy_back_marks. The separatewithheldlist (and its slot inrelease_later) is gone.