gpu: deduplicate per-list ambient gather, scope UAV barriers, and widen mean/gather warps #2359
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-11-29T12:21:26Z.
What 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)Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CLHelper on 2026-11-30T17:59:09Z.
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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T03:14:16Z.
@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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.