GPU: copy title writes under ranges a submission's shaders write #1322
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!1322
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1322/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?
@KevinPratap on GitHub · 2026-11-24 17:24 UTC · original
KevinPratap:fix/shadow-busy-title-writes→main· +76 −1 · 1 files · 1 commits · merged 2026-11-25 00:23 UTCProblem
Shadow::updatecopies only the gaps aroundpendingranges: ranges that lists earlier in the same submission declared as written by shaders. The world binds unordered-access views of its whole 174 MB heap, so once one is declared, nothing the title writes anywhere in that heap reaches the host copy for the rest of the submission.Constants the title writes into that heap are then read stale. Seen on an RTX 4050 Laptop (32-lane waves): a depth-downsample compute dispatch read its sizes (1024, 512, 2560, 1440 in title memory) as zeros from the host copy. 1/0 made its loop bounds about 4 billion, and the GPU ran until the device was removed as hung (DRED: the list stopped in that dispatch; the bytes were read from both sides when the device was removed).
Fix
A submission waits for the one before it (
ExecuteCommandLists, then a fence wait), so when a submission refreshes, none of its own shaders have run. Under a pending range, the pages the title wrote are now copied as they are anywhere else (update_busy). The same bytes go into the snapshotwritingtook, socopy_backdoes not take them for a shader's write and does not undo the title's later writes with them.Verified
shadow::tests::title_writes_under_a_busy_range_are_copied(write-watched memory, synthetic data): fails onmain(shadow.update(...) > 0is false, the constant never reaches the copy) and passes with this change. It also checks that a shader's byte still goes back and that a title write made after the refresh is not undone.cargo test -p victory-gpu --release --lib: 52 passed, 1 ignored;cargo clippy -p victory-gpu --all-targets: no new warnings.VICTORY_D3D12_DRED=1): the submission holding that dispatch completes instead of removing the device. The device is still removed later at other dispatches on that card; those are separate.Only
crates/victory-gpu/src/shadow.rschanges.AI-assisted.
🤖 Generated with Claude Code
@crosettiremi on GitHub · 2026-11-24 17:34 UTC · original · edited 2026-11-24 17:44 UTC
Your depth-downsample investigation led to a reproducible neighboring-byte problem in XCL's sparse memory path. The mechanisms differ: XCL records a hash per 64-byte line. A four-byte GPU counter readback used to record the whole line as synchronized, including a CPU-written constant at byte 24 that had never been uploaded. The next dirty scan returned an empty list.
In an isolated local XCL patch, a partial readback updates the hash only if that line was clean beforehand. The native D3D12 regression now queues the expected 64-byte upload. A second fixture covers a readback spanning a dirty first line, a full line and a clean trailing line. The sparse test module passed 17 tests, with one timing test ignored. This verifies the lost-upload mechanism in XCL; the identity of its stalled game dispatch is still open.
Retail follow-up with only this XCL readback fix added to the previously tested integration build: Player1 input arrived at 47.017 s, assets streamed, and the last positive present sample was 228.288 s. The last captured frame remained dark. No device removal logged; the guest ended with an access violation writing zero at RVA 0x23cf683 after the 258 s sample. The last translated-pipeline counters had 22,659 skipped dispatches. Those counters do not identify the missing producer or a depth-downsample shader. One run on each build, with different account-selection timing.
@aycow on GitHub · 2026-11-24 18:13 UTC · original
Thanks @KevinPratap for the exact repro and patch. I verified the corresponding stale-constant failure on exact #185 and #387, including when the CPU update lands after command recording. Their synchronous branches now defer baseline snapshots until CPU refreshes complete (
f173d36and709647f). The fixed variants preserve both the real GPU write and an independent later CPU write on AMD, NVIDIA and WARP with full GBV. #595 has a distinct lifetime issue because an earlier native submission may still be active during the refresh. The synthetic passes do not yet attribute the title material failure.@KevinPratap on GitHub · 2026-11-24 22:32 UTC · original
Rebased onto today's
main(70564ae0), which rewroteshadow.rsaroundTrackedand snapshot segments. The bug is still there:updateskips the pending ranges entirely. The fix is nowupdate_busy: under a pending range it copies the pagesTracked::takereports, and writes the same bytes into the snapshot segmentswritingtook.shadow::tests::title_writes_under_a_busy_range_are_copieduses the tracked pool, like the existing shadow test. It fails onmain("the title's write is copied") and passes with this.cargo clippy -p victory-gpu --all-targets -- -D warningsis clean.cargo test -p victory-gpu --lib: the 3 failures are also there onmain, on an RTX 4050 Laptop (dynamic_slots_are_held_until_released,a_texture_written_in_one_format_reads_in_another_through_a_placed_view,lists_share_a_table_and_copies_keep_their_views).AI-assisted.