fix: send the title's bytes under shader writes as their own runs, not coalesced #292
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!292
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-292"
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?
@Skyfrye on GitHub · 2026-11-26 01:28 UTC · original
Skyfrye:nep/under-writes-exact→main· +67 −6 · 1 files · 1 commits · draftDraft: an in-game check is pending (the change and its test are done).
Change
VICTORY_COPY_COALESCE=<bytes>(08f8a1b, set to 256 by the launcher's fast set since #265) joins changed runs that lie fewer bytes apart into one range sent up to a copy in the card's memory. Its comment gives the reason it is safe: "the bytes between them are the same on the CPU side and the card (nothing of the stretch is being written by shaders:updatecut those ranges out)". That holds for the refresh (Shadow::copy's changed spans), but the same helper,Shadow::card_changed_runs, is also whatShadow::merge_under_writessends with. That function exists for the opposite case: it puts "the bytes the title changed into the copy, in the ranges shaders may be writing, and only those bytes, so that what the shaders write beside them stays". There, the bytes between two runs are the flights' shaders' on the card, and a range joined across them puts the CPU side's older bytes back over them (withVICTORY_UNDER_WRITES_MASKS=1the mask is built from the joined range, so it covers the gap too).card_changed_runsnow takes the gap from its caller: the refresh passescopy_coalesce_gap()as before,merge_under_writespasses 0. The switch's comment says it is for refreshes only.What this is not: the GPU hangs at world entry I see with the launcher's fast set (DXGI_ERROR_DEVICE_HUNG, the same 35 submissions in the air each time) still happen with
VICTORY_COPY_COALESCE=0(2 of 2 runs), so this change is not their fix. It is a fix of the switch's own premise.Linked issue: none.
Verification
Windows 11 26300, Rust 1.98.1 (MSVC), on upstream
mainat578098b(merges cleanly onc4c93bd), fromthird_party/victory:The 3 failures are the same on
mainwithout this change (183 passed, 3 failed):descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed,indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots,indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others.New test
title_words_under_shader_writes_go_up_on_their_own: a copy in the card's memory (software adapter) over write-watched memory, the whole range declared as written by a flight's shaders, the title changes two words 96 bytes apart;merge_under_writesmust send[(100, 104), (200, 204)]. Revert check: with the old call (copy_coalesce_gap()) andVICTORY_COPY_COALESCE=256set, as the launcher sets it, it fails withleft: [(100, 204)]. Without the switch it passes either way (the gap is then 0 for both callers), which is why it has to be run with the switch set.Pending: a game run with the fast set where the picture of the world is compared (the gap bytes are the shaders' between flights; what reads them is the next submission's shaders).
Oracle and test data
No game file. The test builds its memory itself.
Checklist
VICTORY_COPY_COALESCE=256, said above).E_NOTIMPL), never a fake success. (Nothing unimplemented here.)AI assistance: written with Claude Code. Claude Opus 5.5 found the mismatch while looking for the cause of the GPU hangs, wrote the change and its test, and wrote this description.
🤖 Generated with Claude Code
@mauroalvare on GitHub · 2026-11-26 01:46 UTC · original
Independent D3D12 readback on NVIDIA and WARP
I ran the same synthetic probe against
c4c93bdc413191a9dc909998d2d53080a3f0c880(the PR base) and the exact PR head770a1a2b48fc1304eb0883aa159b0fd31534f743. The PR branch joinsmainat578098b96f0b3140c9e082a8747782d940f0a1d2. The VIctory tree is identical at that merge base and the tested base.The probe registers a 64 KiB write-watched title buffer, fills the device-side UAV with
0x5a5a5a5ausing a synthetic compute shader, then writes CPU words at offsets 100 and 200. It runs the realShadow::merge_under_writes→Host::card_beforeupload prelude. After a fence it reads all 64 KiB back and checks both CPU words and every other GPU-written word.At byte 148 the readback was
0x00000000on base with gap 256 and0x5a5a5a5aon the PR. The CPU values were0x11111111and0x22222222on both revisions. The probe checked DXGI adapter identity (0x10de, RTX 5070 Ti, NVIDIA driver621.40and0x1414, Microsoft Basic Render Driver with the software flag) and required one mask dispatch with masks enabled and zero with direct copies. All 12 cases executed. Windows x64, Rust 1.98.1 MSVC, Cargo test profile. The fixture uses synthetic memory and shaders.The PR's own WARP range test passed with
VICTORY_COPY_COALESCE=256.cargo test --locked --offline -p victory-loader --test load_probepassed 2/2 on base.cargo xtask policypassed on the PR (199 files). GitHub Actionstestspassed at this head (run #667).One test isolation issue reproduced locally. With
cargo test --locked --offline -p victory-gpu --lib --features diagnostics -- --test-threads=1, base had 196 passed / 3 failed / 3 ignored, while the clean PR head had 196 passed / 4 failed / 3 ignored. The pre-existing failures werespans_say_the_next_start_and_the_lowest_level_viewed,warp_card_fetch_copies_flagged_pieces_to_their_slots, andwarp_card_patch_writes_the_masked_bytes_and_no_others. The extra failure waswatch::tests::written_pages_are_reported_to_every_askeratassert!(before.is_empty()). It passed alone and failed once in three runs of the pair below. Excluding only the PR's WARP regression from the full suite on the PR restored the base result. This is consistent with the process-wide write-watch journal retaining a stamp when an address is freed and reused in the same test process.Reproduce the GPU readback
Apply the test-only diff below to each SHA and run from
third_party/victory.Set
VICTORY_D3D12_WARP=1for WARP and leave it unset for the 5070 Ti. Repeat withVICTORY_UNDER_WRITES_MASKS=0for the direct copy path, and withVICTORY_UNDER_WRITES_MASKS=1 VICTORY_COPY_COALESCE=0for the control.This validation was prepared with AI assistance (OpenAI Codex).
@KainanP on GitHub · 2026-11-26 10:32 UTC · original
Test report for #292 on three adapters.
Merges cleanly onto current main. Setup: current
origin/main(c4c93bd) merged with this PR, Windows 11,cargo test --lockedinthird_party/victory. Adapters: RTX 4060 Laptop (DXGI 0), Intel UHD 8086:a78b (16-lane waves, no FP64), WARP. The hardware adapter is picked by name through a local, uncommitted test hook and confirmed in its log; WARP for victory-gpu is--features diagnostics+VICTORY_D3D12_WARP=1. victory-gpu runs with--test-threads=1.victory-gpu --lib"main's 3" =
descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed,indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots,indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others. They fail on all three adapters on main too.New failure:
watch::tests::written_pages_are_reported_to_every_askeratwatch.rs:2022,assertion failed: before.is_empty(). It depends on test order and is not tied to an adapter:title_words_under_shader_writes_go_up_on_their_own, or with all ofshadow::: passes;--skip title_words_under: passes (3/3, RTX);So something the new test leaves behind (its write-watched region freed with
VirtualFree, or whatmerge_under_writesrecorded for it) is seen by a later test that gets a fresh write-watched allocation, probably at the reused address. It could be thependingrange it pushes, or watch state kept for that range. I did not find which. Clearing that state, or keeping the region alive to the end of the process, should fix it.The new test passes in every run.
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.
770a1a2b48to8ca6d516f5@Skyfrye on GitHub · 2026-11-26 15:03 UTC · original
Rebased on
mainat2cc6593. Since #291 and #340 came in through #358,Cardhas two more fields (me,prints), so the test'sCardnow sets them; the change itself is the same.VICTORY_D3D12_WARP=1 cargo test --locked -p victory-gpu --lib title_words_under_shader_writes-> 1 passed. It is also in the integration build with #354, #345 and #360-#362, #381 and #382: 259 passed and the 3 failures main has.🤖 Generated with Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.