Shaders: run the particle light atlas programs as local waves, not folded (indoor 4-8 fps -> 26-31 fps on NVIDIA) #3896
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!3896
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3896"
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?
@nyxctura on GitHub · 2026-11-30 10:48 UTC · original
nyxctura:pr-lightatlas→main· +17 −2 · 1 files · 1 commits · merged 2026-11-30 14:12 UTCWhat this fixes
Indoors (shops, petrol stations, anywhere with many lights and some particles) the frame rate on NVIDIA fell to 4-8 fps. The card was the limit, and nearly all of its time went to one list:
ptx_prerender:ptfx_CS_lightAtlas_Sprite(2561af9577c47289) and_Trail(c06aa62112ffba4c), which light the particles into the light atlas. The card meter put that list at 13 to 135 ms a frame.This PR runs those two programs as
local wavesinstead of folding them. Same picture, and the list drops out of the card meter's table entirely.Why they were slow
Both are wave64 compute programs, and NVIDIA only has 32-lane waves, so since
05d1c564they are folded (crate::fold): each host lane runs two console lanes and holds both lanes' registers. These two use 129 VGPRs, so the folded program needs 258+ registers a lane. That is past the 255 an NVIDIA thread can have, so it spills to local memory. On top of that, every step of the light loop does both halves' work.This is not what #3501 fixed. #3501 removed the
SAMPLED_MARKSatomics in this shader. Our runs already hadVICTORY_SAMPLED_MARKS=0, and a build with #3501 merged in still hit 131.7 ms (c25 below).Why local waves are exact here
Without folding, the translator falls back to
local waves (APPROXIMATE)for these two, and that is usually a real approximation. For these two programs it isn't. From the console code (shader-info --disasm):v_min_u32/v_max_u32over the wave,v_readlane) to see whether all lanes share a cell.v_or_b32with DPP andv_permlanex16).s_ff1. Each lane only takes a light where its own mask has the bit (v_and_b32with the lane's mask, thenv_cmpx_ne_u32).Every wave operation is a union of lane data, used only to decide which lights to visit. When each 32-lane half does this on its own, every lane still gets exactly its own lights; the half just skips lights none of its lanes need. There is no LDS and no barrier in either program. The
WAVE64-RETRYmessages for both point at exactly these reductions (a count or sum over the wave used as data,a wave OR used as data).The wave-wide form is not a fallback here: the comment above
wide_optionalready notes that it lost the card on exactly these two programs (runs 121-124). Turning folding off globally (VICTORY_WAVE_FOLDED=0) also lost the device for me, which is why this is limited to these two.The change
fold_namedalready takesVICTORY_WAVE_FOLDED_SKIP. When that is unset, it now uses a default list,UNFOLDED_BY_DEFAULT = ["lightAtlas"]. Setting it to empty (VICTORY_WAVE_FOLDED_SKIP=) restores the old behaviour. The switch is already part of the shader cache key.I checked which programs the text matches by translating every compute program with
VICTORY_WAVE_FOLDED_ONLY=lightAtlasandVICTORY_WAVE_WHY=1: exactly these two get folded, nothing else.NonLocalLights_Sprite/_Trailaren't wave64, andCS_GenerateLightAtlasArgumentsis spelled with a capital L.Results
RTX 5070 12 GB, Ryzen 7 7800X3D, 32 GB, Windows 11, game 1.0.2.1, Series S profile, DLSS Ultra Performance. Same base build and settings in every run; B only adds the skip. Numbers come from the log's 5-second fps lines and the card meter tables, over every window in the world.
The mean fps mixes indoors and outdoors. Outdoors the game is CPU bound at about 19-20 fps either way, so the gain is all indoors: 4-8 fps before, 26-31 fps after in the same kind of shop.
Same kind of place, both with the F3 panel (top left FPS is real frames):
I saw no difference in particle lighting (sparks, smoke, fire) between A and B while playing.
From the bench tool, the same two runs over time (x: minutes since world entry; A solid, B dashed). A sits at 4-6 fps for over a minute indoors, B stays at 18-30:
Testing
cargo test -p victory-shader --lib --release: 462 passed, 0 failed, 9 ignoredtranslate --warmof the three programs in the list with and without the skip. Folded: 129 console VGPRs, 84 and 88 KB of code. Skipped:local waves (APPROXIMATE), without early-outs: wave Some(32).🤖 Generated with Claude Code
@Aniseto on GitHub · 2026-11-30 12:05 UTC · original
Ran the
victory-shadersuite at38c1d10aon an NVIDIA Blackwell desktop part.System
rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5Results
VICTORY_D3D12_ADAPTER=NVIDIA cargo test -p victory-shader --lib --release: 462 passed, 0 failed, 9 ignored (416.0 s).What this adds
All tests pass on a real 32-lane NVIDIA host for the change that runs the two particle light-atlas programs as local waves instead of folding them. The thread has no comments yet, so this is the first datapoint in it and the first from an RTX 5070 Ti. This is a suite result only: I did not repeat the author's indoor FPS A/B and claim no FPS number.
Not tested
A retail title, an indoor FPS A/B, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, game data.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - ran the command above on this machine and wrote this report; no game data was used.