gpu: deduplicate per-list ambient gather, scope UAV barriers, and widen mean/gather warps #2359
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!2359
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2359"
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?
@nidea1 on GitHub · 2026-11-29 12:21 UTC · original
nidea1:perf/ambient-dedup-and-scoped-barriers→main· +395 −22 · 2 files · 2 commits · openWhat it changes
Reduces GPU and barrier overhead in the ambient indirect-light stand-in (
crates/victory-gpu/src/ambient.rs,crates/victory-gpu/src/host.rs):meanreduction: replaces[numthreads(1, 1, 1)]looping over all 2,304 cells on a single thread with a[numthreads(64, 1, 1)]groupshared tree reduction.gather: widensgatherfrom[numthreads(8, 2, 1)](half-warp on 32-lane NVIDIA GPUs,Dispatch(20, 45, 1)) to[numthreads(16, 2, 1)](Dispatch(10, 45, 1)), covering the same160x90point grid at full warp utilization.uav_barrier_for(routed throughcrate::barstat::rb) sokeep,mean,place, andgathersynchronize onlypass.cellsorpass.pointsinstead of issuing globalNULLUAV barriers.place+gatherdeduplication: tracks the last gathered(depth_gpu_handle, depth_size)onHostList, skipping redundantplace+gatherdispatches when multipleResolve/Missdispatches on the same command list share the same depth and cells, and invalidating on list reset,Role::Radiance, or depth/copy-dest transitions (0x10 | 0x400).How it was tested
meanran 2,304 iterations on 1 lane,gatherran half-warps, every internal pass issued globalNULLUAV barriers, and repeatedMiss/Resolvedispatches on a list re-ranplace+gatherparallel_mean_and_full_warp_gather_match_cpu_referenceverifies exact match against CPU reference on both RTX 3060 Ti and WARP with 0 D3D12 debug layer errors; live session confirmed identical lighting with reduced GPU barrier overheadcargo testpassed for the crates it touches: yes (cargo test -p victory-gpu --lib --locked ambient::tests::— 15 passed, 0 failed)Checked for overlap
gather's inner loop; complementary to this PR's parallelmean, full-warpgatherthreadgroup size, scoped UAV barriers, and per-list gather deduplication)[pr-performance] gpu: deduplicate per-list ambient gather, scope UAV barriers, and widen mean/gather warpsto gpu: deduplicate per-list ambient gather, scope UAV barriers, and widen mean/gather warps998ef135a7to752b661434752b661434tod1b6ff656d@CLHelper on GitHub · 2026-11-30 17:59 UTC · original
Data point for this PR from an 8 GB laptop card, in case it helps review. Closed #961 made the same three changes
behind a switch (16x2 gather, a tree for the mean, the second gather of a list reused when the depth and cells are
unchanged); since this PR covers them and more, I will not reopen #961.
RTX 4060 Laptop GPU (8 GB), Series S profile, DLSS quality, no hardware ray tracing, on an earlier main (
63b902fe1),150 s runs through the opening, two sets of three runs, card time from GPU timestamps:
Bench on the same card without the title: gather 0.814 -> 0.416 ms, mean 0.045 -> 0.003 ms; the 16x2 gather's points
buffer was byte-for-byte equal to the 8x2 one's at 1280x720 and 640x360, the tree mean within 1e-5 relative.
Most of the saving is the wider gather: adding the tree mean and the reuse on top of it took another 0.01-0.02 ms
(the two were not measured apart). The frame rate did not move on that
laptop (the CPU side of submissions held the frame there), so the gain shows where the card is the limit. Not run
with this PR's code itself.
AI-assisted.
d1b6ff656dto6f957fbb04@nidea1 on GitHub · 2026-12-01 03:14 UTC · original
@CLHelper Thanks for the RTX 4060 Laptop 8 GB measurements (
2.38 -> 1.42 msstand-in GPU time) and closing #961 in favour of this PR! #2359 is now rebased cleanly onto currentmain(6f957fbb,MERGEABLE).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.