perf(gpu): filter no-op refresh spans before ask_ahead and chunk wide_each #1133
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!1133
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1133"
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?
@adwen-007 on GitHub · 2026-11-28 13:51 UTC · original
adwen-007:pr/perf-refresh-filter-wide-each→main· +40 −20 · 2 files · 1 commits · merged 2026-11-29 08:16 UTCProblem
In draw-heavy scenes,
Batch::flushfrequently processes 500–2,000+ spans per flush (~7,000–9,000 per frame), of which ~85% arenothing_new. Becausespans.len() > 256skipped the pre-filter:watch::ask_ahead(&ranges).shadow::wide_each, hammering the shared atomicFLUSHES[2]cache line from every worker thread.shadow::wide_eachclaimed 1 index perfetch_add(1)across all worker threads and allocatedArc/Box/Veceven whenn <= 1.Fix
!shadow.nothing_new(...)beforeask_aheadandwide_eachinBatch::flushandBatch::refresh_ahead(crates/victory-gpu/src/host.rs), returning early if no dirty spans or textures remain.n <= 1fast path and chunked dynamic claiming (chunk = (n / (threads * 8)).clamp(1, 16)) inshadow::wide_each(crates/victory-gpu/src/shadow.rs).Verification
cargo check -p victory-gpupasses cleanly onv2026.11.28.01(63b902f).3,971 -> 1,119per frame) with zero regressions.@urielbeaupre on GitHub · 2026-11-28 17:06 UTC · original
An A/B on top of other copy-path work, for the record. RTX 4070 Ti 12 GB, Ryzen 9 7900X, Series S profile, DLSS off, same save, warm caches.
Base: main
63b902fwith #1038 and #1184 (lazy landing/fetch on). That base already removes most per-frame refresh and copy-back work on the 21 MB buffer. #697 and #1133 merged cleanly on top;VICTORY_ASK_HOLD_ALL=1gives #1133 alone. Cutscene = 60–110 s after input, after = 110–165 s. Warm runs only (the new build's first run built pipelines and isn't counted):On this setup neither shows a gain. Both are within about ±1.5 fps of the base, which is run-to-run noise here, and with both the copying is about 1.3 ms higher on average. No errors, and draw counts match.
This doesn't say the PRs are wrong. Where most refresh spans are already
nothing_newand the big buffer no longer goes round the CPU, there's little left for them to save. In heavy scenes on this machine, the submit thread's biggest cost now is the refreshes themselves: about 23 ms a frame over ~6,500 spans, of which ~5,200 copy nothing.🤖 Generated with Claude Code
@timorjay on GitHub · 2026-11-28 17:07 UTC · original
Hardware follow-up at
acc6df7d45on an RTX 5090 D v2 and Ryzen 7 9800X3D. I compared Windows release builds on63b902fe17, with #703 in every build. Each run started in a fresh, offline Windows Sandbox with the same save, Series S profile,RELAY=1,THIN=0,TEXTURE_POOL=0, DLSS and frame generation off. The host has 32 GB of RAM and the guest was configured for 20 GiB.For each run I replayed the same 72 s of camera and movement inputs starting at the prologue cell window. The FPS column divides actual presents by elapsed time across complete frame-time log intervals, including stalls. The final camera position varied across runs.
The patched runs report roughly half as many spans dispatched to workers in both comparisons. That counter reflects the change in which spans are dispatched. The median refresh times were 16.6 → 17.7 ms without the reflection hold and 15.5 → 18.9 ms with it. One run per configuration, unequal draw counts and cold caches leave the whole-frame effect unresolved on this hardware. The combined build also reached the city-memory shop and handled aiming inputs for the full 95 s observation.
Test automation and analysis assisted by Codex.
@unueberlegt on GitHub · 2026-11-29 01:23 UTC · original
Data point from an independent pass over the same problem (#1521's first point, measured standalone before I saw this): on our side the no-op filter stays parallel on the workers instead of serial on the submitting thread — each worker claims
VICTORY_WIDE_CHUNK(we landed on 16 as the default, up from 1) spans at a time, takes oneJOURNALread guard per claim, and does oneFLUSHES[2].fetch_add(noop)per claim, so the journal RMWs and the shared counter line drop by the chunk size. Filtered survivors then go to the copies per-index as before, and the filter runs afterask_ahead(inside the ahead-covered window), where the no-op answer is cheapest. Measured on RTX 5070 12 GB, Ryzen 9 9950X3D (16C/32T), Series X 2560x1440, prologue, steady windows, medians: refreshes 7.2 → 6.8 ms/frame against the unfiltered baseline (the flush wall time there is bounded by the ~16% real copies, so the win case is again the CPU-bound 8-core of the issue).One thing to weigh in your version:
nothing_newbeforeask_aheadanswers from the previous submission's ahead window (or the published bits), so it filters less than a filter that runs inside the window — and the serial cost of ~7,000 spans on the submitting thread is the mill figure #1521 wants off that thread. The numbers above are with the filter parallel and inside the window, for comparison.GPU and profile: NVIDIA RTX 5070 12 GB, AMD Ryzen 9 9950X3D, 31 GB RAM, Windows 11 26300; release builds, steady-window medians.