Repository navigation
Conversation
…py_back_or_not In Shadow::copy_back_or_not(), `compared` deduplicates only whole 64 KiB PIECE chunks; partial ranges (< 64 KiB) or a partial range followed by an overlapping wider or full-page range in the same submission re-inspect bytes against the saved `before` snapshot segment. Because `merge_writeback(title, host, old)` copies CPU writes from `title` into `host` without updating `old` (`before`), a subsequent overlapping `copy_back()` in the same submission sees `host[i] != old[i]` on those CPU-written bytes, mistakes the earlier CPU write for a GPU write, and overwrites newer CPU writes in title memory back to the stale value. Update `old.copy_from_slice(host)` immediately after `merge_writeback` so already-merged bytes match the snapshot on subsequent overlapping copy-backs. Disjoint from Marvisak#2914 and Marvisak#2848. Assisted-by: T3 Code (Antigravity, gemini-4-neon)
|
Independent hardware verification at exact clean head I ran it inside the 9 GiB cgroup / 512 MiB swap safety scope with global available RAM >=2 GiB, GPU used <=6 GiB, disk >=10 GiB; no guard stop. Local log |
fuzeofficlal
left a comment
There was a problem hiding this comment.
Looks clean and sound on 1de058ca.
- Advancing
old.copy_from_slice(host)right aftermerge_writeback(and outsideif merge_writeback(...), sincemerge_writebackstill copies CPU bytes intohosteven whentitleis unchanged) accurately prevents a later overlapping copy-back in the same submission from mistaking earlier CPU writes inhostfor GPU writes and clobbering newer title writes. - Because
Shadow::writingmerges overlapping or touching ranges into a singlesegmentsentry, mutatingoldin place updates the shared snapshot seen by any subsequent overlappingcopy_backin that submission, whileread_into == falseleaves bothhostandolduntouched. - Both overlap shapes (
partial_then_widerandpartial_then_whole_page) are well-covered by the new regression test.
Note: the red CI run on 1de058ca failed on an unrelated flaky test (descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait at descriptor/host.rs:2011); all shadow::tests including the new test passed.
kotekompotek
left a comment
There was a problem hiding this comment.
LGTM — advancing the saved snapshot after merge_writeback (old.copy_from_slice(host)) keeps a second overlapping copy-back from re-detecting CPU-written bytes as GPU writes. iter_mut/&mut before are minimal; the test covers both partial-then-wider and partial-then-whole-page.
|
Automated triage for the maintainers. This fixes a real bug in CI: Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested locally merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):
- Diff review: Advancing
old(old.copy_from_slice(host)) aftermerge_writebackinShadow::copy_back_or_notensures a subsequent overlapping copy-back in the same submission does not mistake merged CPU writes for GPU writes and clobber newer CPU writes. cargo test -p victory-gpu shadow::tests -- --test-threads=1(RTX 5090 & WARP): 10 passed, 0 failed on both (includingoverlapping_copy_backs_do_not_clobber_newer_cpu_writes).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…pump coalescing & 16-bit/indirect completeness (Wave 29A) Adapts and integrates: - GPU-to-CPU title-window write-back with retire-ticket fencing, xmem dirty-stamp + byte-level CPU-write precedence, and LEONIDA_TITLE_WRITEBACK=0 kill switch (ubiquitarianism/leonida#2129, GPL-3.0). - Slot-133 shadow GPU-write preservation via 256-byte piece sums (LEONIDA_SHADOW_KEEP, ubiquitarianism/leonida#2163, GPL-3.0), saved-snapshot advancement after partial merge (Marvisak/VIctory#3031, GPL-3.0), and read-only hash skip for foreign PAGE_READONLY pages (ubiquitarianism/leonida#1897, GPL-3.0). - Held-batch fence-pump fix: snapshot has_shader_work / internal_staging on ExecuteCommandLists thread in VulkanQueue::Deferred and coalesce redundant back-to-back refresh_shadows() / refresh_console_heaps() inside a single QueueHolds::pump_ready() sweep when xmem epochs and shadow registry are unchanged. - Transient dedicated command-pool renewal for long recordings above LEONIDA_CMD_POOL_RENEW (default 512, Rubenpannen/VIctory-RTX5070@5df4fb3, GPL-3.0). - Complete 16-bit packed colour widening for B5G6R5_UNORM RT/UAV, B4G4R4A4_UNORM RT/UAV, and B5G5R5A1_UNORM RT/UAV (Marvisak/VIctory#2936, GPL-3.0; californiaAlmonds/OpenScarlett@ee7153c, MIT). - Compound graphics ExecuteIndirect host-visible expansion, Tier 1.1 incrementing-constant stride fix, and D3D12 state-leakage binding reset (ubiquitarianism/leonida#1937, GPL-3.0). AI-assisted; verified on NVIDIA GeForce RTX 3080 (Windows 11, VS 18 MSVC 19.51) with LEONIDA_VK_VALIDATION=1 (18/18 CTests passed, 0 validation errors).
In
Shadow::copy_back_or_not()(crates/victory-gpu/src/shadow.rs:414-454),compareddeduplicates only whole 64 KiBPIECEchunks (if n == PIECE && !compared.insert(...)). When two overlapping ranges in the same submission include a partial range (< 64 KiB) — e.g.[0, 0x1000)followed by[0, 0x2000)or[0x1000, 0x2000)followed by[0, PAGE)— the secondcopy_back()re-compares those bytes against the savedbeforesnapshot segment.Because
merge_writeback(title, host, old)copies concurrent CPU writes fromtitleintohostwithout updatingold(before), a subsequent overlappingcopy_back()in the same submission seeshost[i] != old[i]on those CPU-written bytes, mistakes the earlier CPU write for a GPU write, and clobbers newer CPU writes in title memory back to the stale value.Update
old.copy_from_slice(host)immediately aftermerge_writebackso already-merged bytes match the snapshot on subsequent overlapping copy-backs. Disjoint from #2914 (copy_back_marks) and #2848 (Backbuffer pooling).Verification
overlapping_copy_backs_do_not_clobber_newer_cpu_writescovering bothpartial_then_wider([0, 0x1000)->[0, 0x2000)) andpartial_then_whole_page([0x1000, 0x2000)->[0, PAGE)) on D3D12 WARP SM 6.6.--tests+--features diagnosticsclippy,xtask policy, full workspace tests): RVZO6/VIctory CI run #45748741503 (green, combined Wave 10 check on63bcca4).AI-assisted: T3 Code (Antigravity, gemini-4-neon).