gpu: clip write-combined subranges from mixed copy-backs (VICTORY_WC_SUBRANGE_NO_BACK) #4998
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4998"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by danielibabet on 2026-12-01T17:01:58Z.
Summary
VICTORY_WC_SUBRANGE_NO_BACK=1(opt-in, off by default) to clip write-combined sub-ranges out ofShadow::gpu_writesandShadow::shader_writeson mixed copies (copies that span both write-combined and non-write-combined title memory, such as large graphics pools).VICTORY_WC_NO_BACKbehavior completely untouched.WRITE_COMBINED_BOUNDS(AtomicU64) ontitle_memory_write_combined/write_combined_freedfor a lock-free, zero-allocation fast path when a write declaration does not overlap any write-combined region.note_batch_writeandWC_LEFT, and compose cleanly withVICTORY_GPU_RO_SKIPon remaining non-WC sub-ranges inshader_writes.VICTORY_WC_SUBRANGE_NO_BACKinsay_separation_switches(host.rs) and add unit tests (split_wc_subranges_handles_disjoint_overlapping_and_mixed_ranges,wc_subranges_track_title_memory_write_combined_and_freed).Verification
cargo test --locked -p victory-gpu --lib -j 16 -- shadow::: 86 passed, 0 failed, 6 ignored.cargo clippy --workspace --all-targets --locked -j 16(default &--all-features, ignoring pre-existingorigin/mainlints inhost/{font,menu,panel}.rs): passed.cargo xtask policy:asset policy: 464 files ok.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-12-01T17:25:37Z.
Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree.
Base
5fabb46eaf6ed8771321787f8871051abde69b9b, heade4cb0e4ed763aea6a4192db29e1f988514220f55.git diff --numstat→ host.rs 1/0, shadow.rs 224/1.Both tests are new on the base (
git grep -F <name> 5fabb46e -- .→ no match, exit 1):shadow::gpu_readonly_tests::split_wc_subranges_handles_disjoint_overlapping_and_mixed_rangesandshadow::gpu_readonly_tests::wc_subranges_track_title_memory_write_combined_and_freed.git diff --check "5fabb46e..e4cb0e4e"→ no output, exit 0.Result, each:
running 1 test,test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1162 filtered out.Worth noting what the tests actually pin, since it is arithmetic only: the first is a
split_wc_subranges_incase over a mixed span 0x8000..0x68000 with overlapping write-combined intervals 0x30000..0x50000 and 0x40000..0x60000, expecting the merged interval out and the non-WC parts back; the second registers two ranges viatitle_memory_write_combined, checksis_write_combinedon a covered and an uncovered address, checks the three-way split, then frees the first range withwrite_combined_freed(.., 0)and expects the merged 0x10000..0x50000 span. Synthetic addresses only, no title memory mapped, no device; GPU/driver N/A. No game data.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.