Repository navigation
GPU: Speed up shadow buffer writeback merging - #2054
Conversation
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.
Shadow buffer writeback merging sped up — perf work on the writeback path; benchmark evidence would help but the change is plausible.
Keep bytewise guest/GPU reconciliation semantics unchanged. Verified the source oracle with exact extracted code, measured sparse and dense synthetic merges, and cross-checked all workspace tests/features for Windows. Native source GPU test results report the same single unrelated failure on their baseline.
|
The 64 KiB piece size used in
Each row processes 1 MiB total, split into equal spans. Windows/MSVC, rustc 1.98.1 The four-byte row deliberately calls the merge on every span, including unchanged ones. The saved-page path does that after clipping; the other caller first checks |
|
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at AI-assisted (Claude Code). |
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):
cargo test -p victory-gpu --lib shadow::— 5 passed, 0 failed (includingwriteback_merge_matches_bytewise_oracle)cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean fast-path shadow-buffer writeback merging verified against a bytewise oracle. Looks good.
AI-assisted (Gemini 4 Neon).
|
Automated triage for the maintainers. In Overlap: #1867 does the same merge with AVX2, CI: passing ( Recommending a look, not approving. Generated by Claude Code |
Xvania7
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, head 857f630, Windows 10 x64 19045, NVIDIA GeForce RTX 5060, Rust 1.98.1 MSVC):
cargo test -p victory-gpu --lib -- --test-threads=1 shadow::tests::— 4 passed, 0 failedcargo test -p victory-gpu --lib -- --test-threads=1 host::tests::— all 6host::tests::*passed (1 unrelated baseline failure on NVIDIA indescriptor::host::tests::dynamic_slots_are_held_until_releaseddue to #1835)cargo clippy -p victory-gpu --all-targets -- -D warnings— 0 warningscargo xtask policy— 182 files ok
Clean optimization to shadow buffer writeback merging.
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.
Share a branch-free byte merge between the two shadow-buffer writeback paths so the compiler can vectorize the loop. The GPU byte still wins only when it differs from the saved byte; otherwise the guest byte is preserved. The helper reports whether guest memory needs to be written, as before.
Validation
cargo test --locked -p victory-gpu --lib --features diagnostics: 146 passed, 1 failed, 2 ignored. Unmodified base940d32f: 145 passed, 1 failed, 2 ignored. Both failed the same assertion indraw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view.git diff --checkpassed.An earlier diagnostic comparison measured merge cost of 0.392 vs. 0.088 ms/MB. The workloads differed; this measures only the merge step and does not establish an end-to-end frame-time improvement.
Prepared with assistance from GitHub Copilot.