GPU: a submission's write ranges deduplicated through a set, not a scan #10
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!10
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@LICObr on GitHub · 2026-11-25 11:37 UTC · original
LICObr:gpu/dedup-write-ranges-hashed→main· +11 −20 · 1 files · 1 commits · openProblem
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.@Ekabusto on GitHub · 2026-11-25 12:47 UTC · original
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).
@gut0to on GitHub · 2026-11-27 14:48 UTC · original · reviewed
AI-assisted static review (ChatGPT); I inspected the diff but did not run tests.
@ -1201,1 +1203,4 @@let mut cpu_back: Vec<(std::sync::Arc<crate::shadow::Shadow>, usize, usize)> = Vec::new();let mut seen = std::collections::HashSet::new();let mut add = |shadow: &std::sync::Arc<crate::shadow::Shadow>, address: usize, len: usize| {if seen.insert((std::sync::Arc::as_ptr(shadow) as usize, address, len)) {@gut0to on GitHub · 2026-11-27 14:48 UTC · original
Could 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.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.