perf(host): parallelize HostList prelude recording and skip empty copying map #1397
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1397
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1397"
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?
@qlfu on GitHub · 2026-11-28 18:50 UTC · original
qlfu:pr/parallel-prelude-perf→main· +194 −31 · 3 files · 1 commits · openSummary
Splits
HostList::preludeinto two phases incrates/victory-gpu/src/host.rs:HostList::prepare_prelude(serial, in exact submission order): updatestwin.behindandcopy.stateand builds aPreludePlancontaining the required barriers, twin copies, and prelude uploads. Whensyncsanduploadsare both empty (the common case), it skips allocating/probing thecopyingmap entirely; otherwise it usesByCopy<u32>(AddressHash) instead of default SipHash.HostList::record_prelude/record_preludes(parallel viacrate::land::each_under): when a submission has>= 4non-empty prelude plans across distinctHostLists (guarded byall_unique_ptrs), D3D12allocator.Reset/list.Reset/ResourceBarrier/CopyTextureRegion/Closerecording runs in parallel acrosseach_underworkers, and the resulting command lists are assembled intolistsandfirstsin exact submission order.Correctness & Safety
copy.state.swap) and depth-twinbehindupdates still happen serially in exactrunssubmission order insideprepare_prelude.ID3D12Resourcepointers embedded inD3D12_RESOURCE_BARRIERstructs are kept alive byruns(HostList::states/twins) andPreludePlan(syncs/uploads) acrossrecord_preludes.all_unique_ptrsoverjob.listso no two workers ever touch the sameHostListor D3D12ID3D12CommandAllocator/ID3D12GraphicsCommandList; duplicate list references fall back sequentially.prelude_tests::unique_ptr_check_guards_parallel_prelude_recording.Verification
cargo +1.98.1-x86_64-pc-windows-msvc clippy -p victory-gpu --lib --tests --lockedand--all-features: 0 warnings inhost.rs.cargo +1.98.1-x86_64-pc-windows-msvc test -p victory-gpu --lib --locked -- --test-threads=1 --quiet: 455 passed, 0 failed, 36 ignored.cargo +1.98.1-x86_64-pc-windows-msvc build --release --locked -p victory: exit0.Clean Idle-PC 90s A/B Benchmark (RTX 4070 Ti 12 GB + Ryzen 7 5700X,
-FrameGen, vsorigin/main)origin/mainsteps - refreshes - copies(prelude/loop) median5.45 ms4.10 ms-1.35 ms(-24.8%)steps - refreshes - copiesmean5.41 ms4.11 ms-1.30 ms(-24.0%)in the lists' stepstotal median19.50 ms17.80 ms-1.70 ms(-8.7%)sub_all) median50.85 ms48.70 ms-2.15 ms(-4.2%)53.80 ms51.60 ms-2.20 ms(-4.1%)18.6019.40+4.3%71%74%+3 pp0 / 00 / 02503b467b1to4e35ab3afd4e35ab3afdto9e8bb5b3b9@qlfu on GitHub · 2026-11-29 10:14 UTC · original · edited 2026-11-30 15:27 UTC
Rebased onto current
main(829188e9): preservedalias_rt::resolve_preluderesource lifetimes insidePreludePlanandbarstat::rbbarrier accounting. Verified withcargo clippy,prelude+alias_rtunit tests, and a clean 90s gameplay run on829188e9(steps_oth7.95 ms -> 6.25 ms,-1.70 ms/frame).@DoubleD17 on GitHub · 2026-11-30 07:58 UTC · original · edited 2026-11-30 09:57 UTC
We ran a test of this PR on current main (
41adb551with this PR merged), on a CPU-bound machine.We compare only the seconds where the idle camera shows the same lighter views (about 7,500 draws a frame). Its heavier view (about 15,000 draws, half the frame rate) takes 10 to 60 s of each 150 s run, and it moved whole-run means by several ms.
No difference we can measure. The five main runs of the session agreed within 1.3 ms on these seconds. But we also ran main again, built in another folder, eight times: it ranged from 57.5 to 65.5 ms. Its first four runs were 2.4 ms slower than main on average, and the last four 4.2 ms faster. All nine PRs we tested in this session came out 0.4 to 3.9 ms slower than main, and fps moved with it. So we read the difference as a newly built executable, not as this PR.
Picture: 0 defects in 160 frames.
Setup:
41adb551(only its own commits on top), against41adb551itself;Picture check: a burst of 10 captures a second at the end of each run (80 frames), looked at frame by frame.
AI Assisted
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.