perf(gpu): snapshot placed-copy constants on GPU and enable VICTORY_PLACED_ORDER #34
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/trustno1-coder--VIctory-NVIDIA!34
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-34"
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?
@k0ma2k15 on GitHub · 2026-11-27 11:56 UTC · original
k0ma2k15:perf/card-steps→main· +178 −6 · 4 files · 1 commits · openSummary
HostList::place_constant) so constant buffers reading bytes written earlier in the same command list byHostList::place_copyno longer emit a CPUStep::Fill.VICTORY_PLACED_ORDERby default (VICTORY_PLACED_ORDER=0restores the previous behaviour), allowingcard_steps::cut_forto split cross-listStep::Placed->Step::Filldependencies instead of refusing the entire submission.Problem
When
card_stepsruns withVICTORY_RELAY=2andVICTORY_CARD_STEPS=2, submissions were repeatedly refused withBEHIND_PLACED(a copy at its place in a list writes what it reads, or reads or writes what it writes), stalling the submitting thread onwaiting for flights(8.6–8.7 ms/frameaverage, spikes up to43–51 ms/frame).Turning on
VICTORY_PLACED_ORDER=1eliminated cross-list refusals viacut_for, leaving 100% of remainingBEHIND_PLACEDrefusals as a single pattern: an earlierStep::Placedfollowed in the same command list by a constant-bufferStep::Fillwholly inside[placed.dst, placed.dst + placed.len). BecauseStep::Fillreads title memory on the CPU whileStep::Placedwrote the destination on the GPU,card_stepshad to refuse and wait for flights (and ifplace_copycopied shader-written bytes, the CPU view was also stale).Changes
HostList::place_constant(place.rs, wired in draw.rs):[dst, dst + len)destinations written byHostList::place_copyper recording (has_placedatomic fast-path onHostList,placed_writtenandplaced_cbvonDeferred, invalidated on overlappingHostList::defer_copy, cleared onHostList::reset).View::Constantdescriptors and unaligned constant-bufferroot_views wholly covered by the most recentplace_copyin the same recording (bailing to the normalStep::Fillpath on partial overlap or disjoint ranges), copies[src, src + len)directly on the GPU from the destination host copy into a per-list 256-byte-alignedDEFAULTbuffer (D3D12_RESOURCE_STATE_GENERIC_READ).VICTORY_PLACED_CONSTANTS=0disables GPU constant snapshots.host::place::tests::place_constant_reads_what_place_copy_wrote.placed_order()(card_steps.rs):VICTORY_PLACED_ORDERto enabled (VICTORY_PLACED_ORDER=0disables).Measured results
Measured on Windows 11, Ryzen 7 8845HS, NVIDIA GeForce RTX 4070 SUPER (USB4 eGPU), Series X profile, 2560x1440, DLSS Quality,
releasebuild, same gameplay area (excluding the initial scene-load transition frame):BEHIND_PLACEDsecondswaiting_for_flightsavg (max)0.0 mswaiton the GPUwait avgmain)6/115 s,9/117 s)VICTORY_PLACED_ORDER=1only19/68 s,10/69 s)VICTORY_PLACED_ORDER(default) +place_constant27/54 s)In the verification run,
7.3–10.0constants per frame were read in place,0errors were logged, and no visual regressions were observed.Verification
cargo test --workspace --exclude victory-gpu --locked(includingxtaskasset-policy tests): passedcargo test -p victory-gpu --lib host::card_steps --locked: 9 passed, 0 failed, 1 ignored (#[ignore]multi-process test)cargo test -p victory-gpu --lib host::place --locked(including new D3D12 testplace_constant_reads_what_place_copy_wrote): 9 passed, 0 failed, 1 ignoredcargo clippy -p victory-gpu --all-targets --locked&--all-features: 0 warnings in modified codecargo build --release --locked -p victory: passed@heklokate on GitHub · 2026-11-27 18:04 UTC · original
Test results on an RTX 3070 Laptop GPU
The GPU constant snapshot path was active, averaging nine constants read in place per frame in each window. The main runs had about 0.3 ms/frame of flight wait in this save. This did not reproduce the sustained flight waits in the PR description.
Hardware and setup. Intel Core i9-12900H, RTX 3070 Laptop GPU (8 GB, driver
32.0.16.1742), 32 GB DDR5-4800, Windows 11 build 26100. Release build, Series S, DLSS Quality, frame generation off. The same deck save and independently warmed caches were used throughout.Samples. Two valid runs per configuration, one 30-second PresentMon capture at 180–181 seconds after launch per run. The table lists each run. Warm-ups were excluded.
Revisions. Main
d12eb1band theaf242dapatch applied to that same revision. Both usedVICTORY_RELAY=2andVICTORY_CARD_STEPS=2.Draw counts were within 2% between the runs. One early PR attempt stopped during load with a guest access violation that also occurred during main warm-up. A completed run taken before the separate warm-up retry was excluded from the table.
Tested and documented by Codex.
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.