perf(gpu): SEH AVX2 word_diff_copy, scoped WC-burst send::take, and fused copy_spans/refresh_front #3395
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!3395
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3395"
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-29 22:46 UTC · original
qlfu:pr/perf-safecopy-scoped-send-fused-front→main· +585 −114 · 4 files · 4 commits · closed without mergingSummary
Four verified CPU submitting-thread hot-path improvements measured in clean 90s Series X 1440p DLSS Balanced runs (Ryzen 7 5700X + RTX 4070 Ti 12 GB,
0 WARNs / 0 ERRORs):victory_safe_word_diff(safecopy.rs,shadow.rs): eliminates the 64 KiBTITLEbounce-buffer double-copy inShadow::take(watched == 1) with an 8-byteu64mask scan (emit_word_diff_masks) and zero-allocword_runs_and_update_into. Includes unit testword_diff_copy_matches_and_recovers_on_faultcovering exact partial progress onPAGE_NOACCESS.wide_each_scopedcombined scatter + copy insend::take+ 512 B WC burst scatter (host/send.rs,host.rs): threadsjoin_now = publishfromHost::submit->card_take->send::take, avoiding redundantcopy_besideheap allocations (Box/Arc/Mutex) when the caller joins immediately, and bursts 64 pairs (512 B = 8 WC cache lines) at a time into PCIe BAR underVICTORY_SEND_BAR=1.copy_spans+refresh_front+front_completefast-skip (host.rs): collectsfront_spansandfront_dueduring the existingcopy_spanswalk beforeask_once, eliminating the duplicate 25k-step traversal andlist.deferred()lock acquisitions inrefresh_front, and skipsBatch::addlookups inrun_deferredwhilefront_completeholds.Measured Results (90s idle-CPU gameplay, Series X 1440p DLSS Balanced,
0 W / 0 E)233659.log)012643.log)card_mem(mean)3.33 ms1.93 ms(002306)refreshes(mean)10.87 ms10.06 ms(002306)steps_oth(med)4.50 ms(002306)3.75 ms(012643)prep(med)27.70 ms26.15 ms26.09 / 41.826.39–26.46 / 44.7(65s011424:27.40 med / 28.55 mean / 44.9 max)Verification
git merge-tree --write-tree origin/main pr/perf-safecopy-scoped-send-fused-front: exit0cargo +1.98.1-x86_64-pc-windows-msvc test -p victory-gpu --lib --locked -- word_diff_copy --test-threads=1: passcargo +1.98.1-x86_64-pc-windows-msvc xtask policy --staged: pass19434b8f5eto28c1299368@qlfu on GitHub · 2026-11-30 00:12 UTC · original
Rebased cleanly onto
main(41adb551), combiningsend::takewith upstream#2509(parallel_copy_work) while preserving the BAR 64 KiB parallel threshold andjoin_now, keeping upstream#2530'sself.changed_runs(...)inshadow.rs, and guardingfront_spans_into/Touch::Partfor zero new warnings. Verifiedsafecopy::tests::word_diff_copy,host::send::tests::, and--features diagnostics.@DoubleD17 on GitHub · 2026-11-30 01:01 UTC · original
We ran a test of this PR on an 8-core Zen 3: picture fine, but slower on this machine.
Setup:
41adb551(the merge only adds this PR's own commits), against41adb551itself;We also ran a picture check: a burst of 10 captures a second at the end of each run, looked at frame by frame.
41adb551The gain in the description was measured with prep around 27 ms. Here the submitting thread is at about 62 ms, bound elsewhere, so the AVX2 path may simply not be where this machine spends its time. If one of the three parts has a switch, we can split them.
AI Assisted
github-bot referenced this pull request2026-11-30 01:14:29 +00:00
@qlfu on GitHub · 2026-11-30 10:35 UTC · original
@DoubleD17 Thanks a ton for testing this on stock
41adb551— your telemetry nailed two real regressions on stock defaults that were masked in our stacked testing:wide_each_scopedcontention inhost/send.rs:send::takewas switched fromcrate::land::each_under(dedicatedvictory-underpool) tocrate::shadow::wide_each_scoped. On stock41adb551,wide_each_scopedhas a singleq.scopedslot and falls back inline whenever another thread (such asrefresh_front) is already in a scoped pass — serializingsend::takeon the submitting/sending path. Restoredcrate::land::each_underfor both parallel copy+scatter and scatter-only paths.shadow.nothing_newwalk inhost.rs::refresh_frontwhenVICTORY_FRONT_SIFT=0(stock default): During the rebase onto41adb551, the defaultfront_sift == falsebranch fell back to a single-threadedspans.retain(|...| !shadow.nothing_new(...))loop over ~5,200 spans per frame (takingJOURNAL.read()per span) instead of checkingnothing_new_with(&self.ahead_snap, ...)inline in parallel inside the singlewide_each_scopedrefresh dispatch. Restored the lock-freeahead_snap+ parallel inline sift (check_inline).victory_safe_word_diff(128 B/iter with one combinedvpcmpeqd/vpandfast path + exact SEH fallback to the 32 B tail on mid-128B page faults, covered by an added shifted-page fault test inword_diff_copy_matches_and_recovers_on_fault).Pushed in the latest commit — if you have a chance to re-test on stock
41adb551, bothpreparingandrefreshesshould now be cleanly faster than baseline.@qlfu on GitHub · 2026-11-30 15:05 UTC · original · edited 2026-11-30 15:27 UTC
Skipped populating
Batch::aheadHashMap (~5,400 inserts/frame) inrefresh_frontwhenself.front_completeis true, sinceStep::Refreshskipsbatch.addwhilefront_completeholds andtitle_writtenclearsself.ahead. Verified:cargo check -p victory-gpu --all-targets --all-features --locked+host::tests(91 passed, 0 failed) + cleanmerge-treeonto41adb551.Pull request closed