GPU: reduce CPU overhead in submission preparation #3096
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3096
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3096"
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?
@maksimkaosipov75-design on GitHub · 2026-11-26 07:45 UTC · original
maksimkaosipov75-design:codex/victory-submit-cpu→main· +47 −32 · 2 files · 1 commits · openWhat changed
Verification
The patch applies cleanly to
63bcca4. A standalone Rust harness built from the before/after functions matched the page runs across 10,000 generated cases and matched deferred-step order and copy byte counts in both build configurations.On an ARM64 Mac, median synthetic measurements were 3.37 ms to 0.033 ms for classifying 8,192 pages with half unmapped, and 2.54 ms to 0.22 ms for walking 100,000 stubbed deferred steps with 2% copy/fill steps. These timings cover the isolated CPU paths. Windows workspace checks and in-game frame timing are pending.
@Dukestar69 on GitHub · 2026-11-26 07:49 UTC · original · approved these changes
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):cargo test -p victory-gpu watch::tests -- --test-threads=1: all tests passed.cargo test -p victory-gpu shadow::tests -- --test-threads=1: 9 passed, 0 failed.cargo test -p victory-gpu draw::tests -- --test-threads=1: 20 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@oni-swr on GitHub · 2026-11-26 08:06 UTC · original
Independent Windows verification of #3096 at
0b65499c27d728d2c2834e427ea549a5f63eac48against its exact parent63bcca43c6a00a758510398fa43096ce7e4f7df0(claim: #1633). Head, state and coordination were rechecked just before posting: the head is unchanged, the PR is open, and there is no other report on it besides the existing review.Setup: Windows 11 Pro 10.0.26200 x64, AMD Ryzen 7 5700X3D, rustc/cargo 1.98.1 (from
rust-toolchain.toml),cargo -j 4, separate clean worktrees for parent and head with one shared target dir. No physical GPU was used. The suites below only create a device throughwarp_adapter()(software), and nothing else here created one, so nodxil.dllwas needed.Existing tests (
cargo test -p victory-gpu --lib,--test-threads=1per module):watch::testspage_runs_preserve_missing_pages_gaps_and_partial_bounds)shadow::testshost::draw::testsAlso clean on head:
cargo check --features diagnostics --tests,cargo clippy -p victory-gpu --all-targets -D warningswith and without--features diagnostics, andcargo xtask policy(191 files ok).Page-run classification, old inline loop vs
split_page_runs: a local-only harness (not committed, removed afterwards) compared the parent's loop against the new function on 256,196 cases with identical output in all of them:In
take_split,pagescomes from aBTreeSetrange,wholeis a filter of it, andprotect_notingpushes unmapped pages in input order. So the sorted and subset assumptions in the new doc comment hold on the real path.Deferred-step order: this was not exercised by a running test, because the walk is private and has no unit test. The arms were compared in the diff. Each step still performs its counter,
title_writtenand copy actions in the same order, and the removedcontinues are equivalent because the match is the last statement of the loop. Both feature configurations compile and pass clippy.CPU timing (not frame timing): release build, 21 samples per run, 5 runs, each cell the median of the 5 per-run medians (ranges are the per-run medians).
These are isolated CPU loops that mimic the changed code, not the runtime. They say nothing about frame time. The half-unmapped pattern is also a favourable case for the old
containsscan.AI use: Claude Code (Claude Sonnet 5.5) ran the checks, coordinated by Codex (gpt-6.2-sol). Synthetic inputs only; no game files, dumps, shader names or hashes. No source changes and no competing PR. I left source-review commentary to the human reviewers.
@Marvisak on GitHub · 2026-11-26 08:20 UTC · original
Automated triage for the maintainers.
Merge candidate.
crates/victory-gpu/src/watch.rs:Tracked::take_splitnow callssplit_page_runs, which walks the sorted pages and their unmapped subset together instead of runningunmapped.containsonce per page. I checked thatpagescomes from aBTreeSetrange and thatprotect_notingpushes unmapped pages in input order, so the ordering assumption holds.crates/victory-gpu/src/host.rs: the deferred-step walk now reads the timer outside diagnostics builds only forCopy/Fillsteps.title_writtenand thecopy_mappedflag stay per kind as before, and the removedcontinues are equivalent because thematchis the loop's last statement. A new unit test covers gaps and clipped ends, and an independent Windows run is posted here.Optional: a
debug_assert!thatunmappedis exhausted at the end ofsplit_page_runswould catch a broken ordering assumption, which would otherwise classify an unmapped page as a copy without any error.CI: passing.
Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-26 08:25 UTC · original · approved these changes
Clean, focused optimization in both files:
HostList::run_deferred(crates/victory-gpu/src/host.rs): avoidsInstant::now()on non-copy/fill steps in non-diagnosticsbuilds while preserving exact step ordering,batch.title_written()semantics,PREPARINGtotals, anddiagnosticscounters (Timed,C::RunUs,C::Copies, etc.).split_page_runs(crates/victory-gpu/src/watch.rs): replaces the O(|pages| * |unmapped|)unmapped.contains(&p)scan with a linearstrip_prefixpass. The sorted-subset precondition holds becausepagesis collected fromBTreeSet::range,wholepreserves order, andprotect_notingpushes unmapped pages in that same order. (Optional non-blocking nit: addingdebug_assert!(unmapped.is_empty());at the end ofsplit_page_runswould guard that invariant against future edits.)Verified locally on Windows 11 (RTX 5090 + WARP):
cargo clippy -p victory-gpu --all-targets -- -D warnings(default and--all-features): cleanwatch::(16/16, including the newpage_runs_preserve_missing_pages_gaps_and_partial_bounds),shadow::(9/9), andhost::(34/34; skipping the pre-existing NVIDIAdynamic_slots_are_held_until_releasedcap failure) all passed--features diagnostics,VICTORY_D3D12_WARP=1):watch::,shadow::, andhost::62/62 passedcargo xtask policy: 191 files okLGTM.
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.