perf(gpu): leaner passes for the stand-in of the indirect light (VICTORY_AMBIENT_LEAN, off by default) #961
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!961
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-961"
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?
@CLHelper on GitHub · 2026-11-28 10:11 UTC · original
CLHelper:pr/ambient-lean→main· +501 −10 · 3 files · 1 commits · closed without mergingWhat
VICTORY_AMBIENT_LEAN=<bits>(off by default; unset, every pass of the indirect-light stand-in runs as before):1- the gather (each of the 160x90 points sums the light of all 2,304 cells) runs in groups of 32 threads(
numthreads(16, 2, 1), dispatched 10x45) instead of 16 (8, 2, 1, 20x45). On a 32-lane card a group of 16leaves half of every wave idle. Each point is worked out by the same code from the same inputs, so the points
buffer holds the same bytes. The gather runs three times a frame (after both
CS_RayMissdispatches and afterthe diffuse resolve), so it was the largest of the stand-in's passes.
2- the mean of the cells' light by one group of 256 threads in a fixed tree instead of one thread adding2,304 values in turn. The sum is rounded in another order (the bench checks it to 1e-5 relative).
4- a gather is left out when the last gather was recorded into the same host list since its reset, of thesame depth view and size, with no keep of the cells' light recorded since: its points are what this one would
write. (In practice: the second
CS_RayMissdispatch of a frame reuses the first one's points.)The default HLSL is unchanged (
GATHER_Xdefaults to 8; the mean's lean form is behind its own define), so with theswitch unset the same bytecode is compiled. Lean pipelines are compiled only for the bits asked for; one that does
not compile is logged once and the plain pass runs.
New files:
ambient/lean.rs(switch, the lean mean's HLSL, the reuse decision, 2 tests) andambient/bench.rs(ignored on-device bench);
ambient.rs+48/-10.Measured
RTX 4060 Laptop GPU (8 GB), Series S profile, DLSS quality; 150 s runs through the opening into the first scenes,
card time from GPU timestamps around each run of commands (a diagnostic of ours, not part of this PR).
=1=7=1=7Bench on the same card, no title (
cargo test -p victory-gpu --release --features diagnostics --lib -- ambient::bench --ignored --nocapture --test-threads=1): gather 0.814 -> 0.416 ms, mean 0.045 -> 0.003 ms; the widegather's output is byte-for-byte equal to the plain one's at 1280x720 and 640x360. Picture scores of the captured
frames (noise, dark, luma; world and cutscene) are equal within run-to-run spread.
The frame rate did not move on this laptop (world median 56.0 / 54.8 / 55.8 ms in the first set, 55.9 / 56.2 /
54.4 ms in the second): here the frame is held by the CPU side of submissions, not by the card, and the card's idle
time grew by what was saved. The saving is card time (~0.9 ms of the stand-in's 2.4), so it shows where the card is
the limit. The worst cutscene frame varies from run to run on this machine with and without the switch, so no claim
is made about it.
Tests
ambient::lean::tests::bits_are_read_as_asked,a_gather_is_left_out_only_after_the_same_one_in_the_same_list.ambient::tests::the_passes_buildnow also builds the lean pipelines (on a machine with a card).ambient::bench::bench_the_stand_ins_passes(ignored): times each pass plain and lean, asserts the wide gather'sbytes equal the plain gather's and the lean mean within 1e-5.
AI-assisted.
@trustno1-coder on GitHub · 2026-11-28 19:23 UTC · original
Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.
github-bot referenced this pull request2026-11-30 16:52:02 +00:00
Pull request closed