Repository navigation
GPU: marked UAV refreshes cover whole 64 KiB pages - #2172
Conversation
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):
cargo test -p victory-gpu --lib marked_subpage_uav_writes_copy_back_and_keep_neighbor_bytes— passed on RTX 5090cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean whole-64 KiB-page coverage for marked UAV refreshes preserving neighbor bytes on subpage writes. Looks good.
AI-assisted (Gemini 4 Neon).
From Marvisak/VIctory#2172 (GPL-3.0-or-later, fuzeofficial), adapted to our tree (kept ensure_buffer_state on the refreshed range): - Marked UAV refreshes (table views, root UAVs, heap hulls) widen to the 64 KiB pages they touch, cut to the copy (Shadow::page_range); the range declared as written stays exact. Tracked copies take the refreshed range in one call, still updating the snapshots under ranges shaders write. - Shadow::update no longer splits tracked refreshes at the ranges earlier lists' shaders write, so Tracked::take sees the whole enclosing page: the page is guarded and taken, and copy_back_marked keeps GPU writes. - Tests: 5 marked-UAV page tests (sub-64 KiB, unaligned/cross-page, CPU disjoint three-way merge, after a copy, root+bindless hulls). (cherry picked from commit a78c1e93edcdecf65b96d4325ee9d4ac268462dd)
|
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head AI-assisted (Claude Code); no game data. |
Xvania7
left a comment
There was a problem hiding this comment.
Hardware verification on real hardware: NVIDIA GeForce RTX 5060, Windows 10 x64, Rust 1.98.1.
Tested a78c1e9 checked out into an isolated tree:
cargo clippy -p victory-gpu --target-dir ... -- -D warnings: 0 warnings, clean.cargo run -p xtask -- policy: clean (asset policy: 182 files ok).shadow::tests: 4/4 passed:mark_runs_are_reused_and_joined: oktitle_writes_under_a_busy_range_are_copied: oksnapshots_cover_the_declared_ranges_and_writes_go_back_once: okmarked_pages_go_back_by_the_bytes_the_gpu_changed: ok
draw::testsmarked subpage UAV test suite: 5/5 passed:marked_subpage_uav_and_cpu_disjoint_write_three_way_merge: okmarked_subpage_uavs_after_copy_in_same_list: okmarked_subpage_uav_writes_copy_back_and_keep_neighbor_bytes: okmarked_subpage_uav_unaligned_and_cross_page_shadow_bounds: okmarked_unaligned_root_uav_and_bindless_subpage_refresh: ok
Ensuring marked UAV refreshes align to full 64 KiB page boundaries cleanly prevents partial unaligned copy-backs across subpage chunks while preserving adjacent bytes. LGTM.
|
Automated triage for the maintainers. Recommended for a maintainer's look (re-reviewed after the rebase). Marked UAV refreshes ( CI: Generated by Claude Code |
A marked UAV view shorter than 64 KiB, or not page-aligned, refreshed only its own range, and Shadow::update split tracked refreshes at the ranges earlier lists' shaders write. Either way Tracked::take saw only part of the enclosing 64 KiB page, so the page was neither guarded nor taken: it stayed changed, and copy_back_marked kept the title's bytes, dropping every GPU write to the page. Marked UAV refreshes (table views, root UAVs, heap hulls) now widen to the 64 KiB pages they touch, cut to the copy (Shadow::page_range); the range declared as written stays exact. Tracked copies take the refreshed range in one call, still updating the snapshots under ranges shaders write. Only pages the title changed are copied, and no shader of the submission has run yet, so the wider refresh overwrites no GPU writes.
a78c1e9 to
d813e33
Compare
Upstream model everywhere, our additive diagnostics kept. 15 files conflicted, all resolved file-by-file: - README: our fuzz_tests/ship-profile/VICTORY_DIFF_ONLY/VICTORY_NAME_SHADERS notes beside upstream's status/blake3-paths/translate-jobs wording. - descriptor/host.rs: upstream Marvisak#2462 (no typed UAV in a format the host cannot store to) lands untouched through the merge; keeps its device-removal fix, no behavior change on capable hosts. - descriptor.rs: our monotonic heap-id guard + upstream Marvisak#2234 (released view heap takes its page table with it). - pipeline/library.rs: upstream Marvisak#2179 (lock-free loads via Shared) + our best-effort periodic save (try_lock on state). - capture.rs: our Marvisak#2607 signed-32 decode + test beside upstream's r32_integer_to_rgba. - draw.rs: our buffer_state tracking + root-signature test beside upstream's marked page-range refresh (Marvisak#2172) + sampler-heap test. - pipeline/host.rs: upstream vertex/depth-bounds/integer-blend model (stream_pipeline, host_blend, depth_with_bounds) + our padding-zeroing clean_* and Stream zeroing; both test batches kept. - pipeline/make.rs: keep lost/screen fields + upstream skipped_shader. - pipeline.rs: keep bytes()/pipelines_waiting() beside for_test. - host.rs: multi-plane present (Marvisak#1997, Compositor) + our previous-frame wait, presented/probed frame tracking, keep-textures, drain-before-save; both test modules (submissions + present_plane_tests). - queue.rs: upstream blinks (Option<bool>) supersedes ours. - shadow.rs: upstream update_tracked/update + merge_writeback (Marvisak#2054) + our stale/submission_done/Part snapshots/buffer_states; update_free and update_busy retired as subsumed (no callers left). - xmem.rs: upstream shared system_commit() supersedes our inline version. - emit/host.rs: our fence-event wait() + upstream SharedDevice/Marvisak#244 (shared/serialized WARP device). - emit/lower.rs: upstream i64 dword ordering (Marvisak#1599) + our f/t lane path and RDNA2 opcode names; tests moved verbatim to lower_tests.rs via #[path] (lower.rs exceeded the 512 KiB asset-policy limit after the merge; module path unchanged, content byte-identical). - emit/valu_tests.rs: our s_load_dwordx4_at + upstream sopk helper. - gfx10/opcodes.rs: upstream pub(crate) + our RDNA2 names. - fuzz_tests.rs: Host::from_device() for upstream's new warp field. Test adaptations (same execution-model class as the 13f91ca merge): 8 upstream tests written for synchronous execute() drain explicitly on our async-completion queue (marked-UAV/placed-view/rebind tests); Host::from_device() port; words() accessor for privatized field. Gates: cargo test --workspace --locked green, clippy --workspace --all-targets --all-features -D warnings clean, xtask policy 197 ok.
Problem
A marked UAV view that is shorter than 64 KiB, or not page-aligned, inside a tracked buffer copy refreshed only its own byte range, and
Shadow::updatesplit tracked refreshes at the ranges earlier lists' shaders write. Either wayTracked::takesaw only part of the enclosing 64 KiB page, so the page was neither guarded nor taken. It stayed changed, and after the submissionShadow::copy_back_markedhitsaved.is_none() && t.changed(page)and kept the title's bytes, dropping every GPU write to that page.Changes
Shadow::page_rangewidens a range to the 64 KiB pages it touches, cut to the copy.readable), root UAVs (State::root_view) and heap hulls (bindless::refresh). The range declared as written (gpu_writes) stays exact.Tracked::take, still updating the snapshots under ranges shaders write. Only pages the title changed are copied, and no shader of the submission has run yet at that point, so the wider refresh overwrites no GPU writes. Untracked copies are unchanged.Verification
cargo test -p victory-gpu --lockedon hardware and withVICTORY_D3D12_WARP=1: all pass exceptdynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views, which fail the same way on main (HEAP_VIEWS limit).VICTORY_D3D12_DEBUG=1and no debug-layer messages. All 5 new tests fail without the page widening.cargo clippy --workspace --all-targets [--all-features] --locked -- -D warningsandcargo xtask policypass.