GPU: a submission's write ranges deduplicated through a set, not a scan #10
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10"
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 Belobug/VIctory-Belobug-AMD. Originally posted by LICObr on 2026-11-25T11:37:20Z.
Problem
HostQueue::executecollects the GPU write ranges of every list in a submission (Step::GpuWrite, thenbatch.bindless_writes) intocard_writesandcpu_back. It keeps each range once by scanning the ranges kept so far (target.iter().any(...)), so the cost grows with steps × distinct ranges on the submitting thread.defer_gpu_writedoes not dedupe at push time (unlikedefer_refreshwithrefreshed). Every list of a world frame declares its UAV ranges again, so the same ranges show up many times per submission.Change
HashSetof(Arc::as_ptr(shadow), address, len)beside the two vectors. A range is pushed only the first time it is seen.host.rsonly.Verification
cargo check -p victory-gpu --all-targets --all-features --target x86_64-pc-windows-msvc: builds.cargo clippy -p victory-gpu --all-targets: no new warning in the changed code. The crate does not build under-D warningstoday because ofvictory-shader(#2).VICTORY_PROFILErun before and after would tell. I'm happy to adjust or drop it if it doesn't show up.Imported from Belobug/VIctory-Belobug-AMD. Originally posted by Ekabusto on 2026-11-25T12:47:24Z.
Checked locally:
victory-gpubuilds andcargo test -p victory-gpu --libpasses (106 passed, 4 ignored; this branch is on4cbe9d7, which has 3 fewer tests thanmain). It merges into currentmainwithout conflicts, and clippy has one warning fewer than onmain.The change keeps behaviour: a shadow is either card or CPU for its whole life, so keying the set on
(shadow, address, len)without the target picks the same vector the scan did, and the first occurrence keeps its place, so order is unchanged. Looks good to me; as you say, whether it shows up depends on how many ranges a world submission declares.Reviewed on Windows 11 (build 26300), Rust 1.98.1, each PR in its own worktree; no game data, not run in the game. AI-assisted (Claude Code).
Imported from Belobug/VIctory-Belobug-AMD. Originally posted by gut0to on 2026-11-27T14:48:26Z.
Code review location:
crates/victory-gpu/src/host.rs; line 1206Could the range-key logic get a deterministic helper test? The set spans both per-list
GpuWriteentries andbatch.bindless_writes, so correctness depends on deduplicating only the full(Shadow identity, address, length)tuple. A test could feed the same tuple from both sources, then reuse the same bounds with a differentShadowand a different range on the original, asserting only the true duplicate is removed. That would guard against silently dropping write or copy-back ranges if this key changes later.Imported from Belobug/VIctory-Belobug-AMD. Originally posted by gut0to on 2026-11-27T14:48:26Z.
Review: COMMENTED
AI-assisted static review (ChatGPT); I inspected the diff but did not run tests.
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.