fix(shader): folded light-atlas lane-mask joins (24/7 interior stall, #3835) #3871

Merged
Still-Cam merged 2 commits from upstream-pr/3871 into main 2026-11-30 14:12:01 +00:00
Still-Cam commented 2026-11-30 09:52:57 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Still-Cam on 2026-11-30T09:52:57Z.


Summary

Fixes severe GPU stall inside 24/7 convenience store interiors on NVIDIA (#3835).

Open-world streets were playable (~20 fps), but walking into a 24/7 pinned the GPU (~143 ms/frame, 4–5 fps). Looking toward the store also dropped frame rate.

Cause

Folded wave64 compute for the particle light atlas (ptfx_CS_lightAtlas_Sprite, hash 2561af9577c47289) reads its EXEC lane-mask pair as a number to decide which half holds the first lane. Where that pair came through a join that only a loop header’s join reads, the join was not marked as read and its incoming masks became zero. From the second iteration on, the loop counter never advanced, so the loop ran to the 4096-iteration guard with the light’s whole body each round — tens of ms of GPU per dispatch, and lanes left without their store so the title kept asking for the same work every frame.

Same class of bug as open PR #2853 / issue #2750 (indoor light-atlas stall). This branch is a cherry-pick of that fix onto current main.

Fix

In victory-shader fill_phis, folded programs now also treat lane-mask joins as read (ballot form), so the back-edge mask is preserved. Other joins keep the previous shortcut. Of ~26k title programs, 18 emit differently (all folded): light atlas (2), shadow masks (6), water volume light (4), scattering gather (2), particle updates (4). All still translate.

Includes the synthetic regression tests from #2853 (CPU + host) for a loop whose header reads a mask join over its back edge.

Test plan

  • cargo test -p victory-shader --lib --locked folded_join — passed (a_folded_loop_header_reads_the_mask_join_on_its_back_edge)
  • Release build (cargo build --release --locked -p victory) on Windows MSVC
  • In-game A/B on real hardware (see Results)

Hardware / settings

  • GPU: NVIDIA GeForce RTX 4070 Ti (12 GB)
  • CPU: AMD Ryzen 7 7800X3D
  • Profile: Series X (1080→1440, DLSS, FrameGen 2x, no RT)
  • Build: this branch on top of 41adb551

Results

Before (v2026.11.29.05 / #3835) After (this branch)
24/7 interior ~4–5 fps, GPU ~142.8 ms/frame, GPU ~99% busy ~24.4 fps, ~41 ms/frame, 0.0 ms waiting on GPU
Streets ~20 fps Unchanged character (still heavier than interior; expected)

Before (from #3835):

victory_gpu::cardmeter: ... 142.8 ms in the title's 197 lists ...
victory_gpu::mesh_rest: ... (VICTORY_MESH_REST=Off): 462.6 bound, 0.0 rest ...

After (crowded 24/7 sample):

victory_gpu::host: 24.4 fps, 41.0 ms/frame (22.8 preparing: copies 10.8 ms ...; 0.0 on the GPU; ...)

Notes

  • Credits: original fix and tests from #2853 (wutzebaer / Peter Großmann et al.).

Fixes #3835

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5562915064 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3871). Originally posted by [Still-Cam](https://github.com/Still-Cam) on 2026-11-30T09:52:57Z. --- ## Summary Fixes severe GPU stall inside **24/7 convenience store interiors** on NVIDIA (#3835). Open-world streets were playable (~20 fps), but walking into a 24/7 pinned the GPU (~143 ms/frame, 4–5 fps). Looking toward the store also dropped frame rate. ### Cause Folded wave64 compute for the particle light atlas (`ptfx_CS_lightAtlas_Sprite`, hash `2561af9577c47289`) reads its EXEC lane-mask pair as a number to decide which half holds the first lane. Where that pair came through a join that only a loop header’s join reads, the join was not marked as read and its incoming masks became **zero**. From the second iteration on, the loop counter never advanced, so the loop ran to the **4096-iteration guard** with the light’s whole body each round — tens of ms of GPU per dispatch, and lanes left without their store so the title kept asking for the same work every frame. Same class of bug as open PR #2853 / issue #2750 (indoor light-atlas stall). This branch is a cherry-pick of that fix onto current `main`. ### Fix In `victory-shader` `fill_phis`, folded programs now also treat **lane-mask joins** as read (ballot form), so the back-edge mask is preserved. Other joins keep the previous shortcut. Of ~26k title programs, **18** emit differently (all folded): light atlas (2), shadow masks (6), water volume light (4), scattering gather (2), particle updates (4). All still translate. Includes the synthetic regression tests from #2853 (CPU + host) for a loop whose header reads a mask join over its back edge. ## Test plan - [x] `cargo test -p victory-shader --lib --locked folded_join` — passed (`a_folded_loop_header_reads_the_mask_join_on_its_back_edge`) - [x] Release build (`cargo build --release --locked -p victory`) on Windows MSVC - [x] In-game A/B on real hardware (see Results) ### Hardware / settings - GPU: NVIDIA GeForce RTX 4070 Ti (12 GB) - CPU: AMD Ryzen 7 7800X3D - Profile: Series X (1080→1440, DLSS, FrameGen 2x, no RT) - Build: this branch on top of `41adb551` ### Results | | Before (v2026.11.29.05 / #3835) | After (this branch) | |---|---|---| | 24/7 interior | ~4–5 fps, GPU ~142.8 ms/frame, GPU ~99% busy | ~24.4 fps, ~41 ms/frame, **0.0 ms waiting on GPU** | | Streets | ~20 fps | Unchanged character (still heavier than interior; expected) | Before (from #3835): ``` victory_gpu::cardmeter: ... 142.8 ms in the title's 197 lists ... victory_gpu::mesh_rest: ... (VICTORY_MESH_REST=Off): 462.6 bound, 0.0 rest ... ``` After (crowded 24/7 sample): ``` victory_gpu::host: 24.4 fps, 41.0 ms/frame (22.8 preparing: copies 10.8 ms ...; 0.0 on the GPU; ...) ``` ### Notes - Credits: original fix and tests from #2853 (wutzebaer / Peter Großmann et al.). Fixes #3835
JSa25 commented 2026-11-30 10:12:26 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by JSa25 on 2026-11-30T10:12:26Z.


RTX 5090 data on the same two programs, in case it helps compare this fix with #2261. Setup: Ryzen 9 9950X3D, Series X profile, 2560x1440 with DLSS Quality, frame generation off, ray tracing off, the opening cell route.

On main (folded light atlas):

  • The route has a stretch of about 10 s, roughly 25 s into the world, where the card's time per frame goes from 15-17 ms to 29-92 ms. The worst second was 10.9 fps, and 7 seconds were under 20 fps.
  • It came back at the same point in two runs on 41adb551.
  • An earlier run with VICTORY_CARD_METER_PIPELINES=1 (main of Nov 29) timed the two programs:
    • ptfx_CS_lightAtlas_Trail (c06aa62112ffba4c): 11.4 ms per binding;
    • ptfx_CS_lightAtlas_Sprite (2561af9577c47289): 3.7 ms average and 6.4 ms at most;
    • the next compute program: about 0.5 ms.

A third route we tried, not the fold: a local, opt-in switch that sends just these two programs to the exact wave-wide form (widen, WidenMode::All) before the fold.

  • Both translate and pass dxil.dll validation. Sprite comes to 20,399 instructions per thread against the fold's 44,157.
  • In two runs the stretch did not happen. The card stayed at or under 20.5 ms a frame after the entry into the world, the worst second was 27.9 fps, and neither program appeared in the per-pipeline meter's top list.
  • A third run with it ended about 10 s into the world on "a host command list did not close (0x80070057)". We had not seen that in 21 earlier logs, and we could not identify the command (no debug layer).

Given the loop-guard bug found here, the fold may well be fine once its joins are read, which would explain the 29-92 ms on our side as well. We have not tried this branch yet, and can run the same route on it if that's useful.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7275274395 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3871#issuecomment-7275274395). Originally posted by [JSa25](https://github.com/JSa25) on 2026-11-30T10:12:26Z. --- RTX 5090 data on the same two programs, in case it helps compare this fix with #2261. Setup: Ryzen 9 9950X3D, Series X profile, 2560x1440 with DLSS Quality, frame generation off, ray tracing off, the opening cell route. **On main (folded light atlas):** - The route has a stretch of about 10 s, roughly 25 s into the world, where the card's time per frame goes from 15-17 ms to 29-92 ms. The worst second was 10.9 fps, and 7 seconds were under 20 fps. - It came back at the same point in two runs on 41adb551. - An earlier run with `VICTORY_CARD_METER_PIPELINES=1` (main of Nov 29) timed the two programs: - `ptfx_CS_lightAtlas_Trail` (c06aa62112ffba4c): 11.4 ms per binding; - `ptfx_CS_lightAtlas_Sprite` (2561af9577c47289): 3.7 ms average and 6.4 ms at most; - the next compute program: about 0.5 ms. **A third route we tried, not the fold:** a local, opt-in switch that sends just these two programs to the exact wave-wide form (`widen`, `WidenMode::All`) before the fold. - Both translate and pass dxil.dll validation. Sprite comes to 20,399 instructions per thread against the fold's 44,157. - In two runs the stretch did not happen. The card stayed at or under 20.5 ms a frame after the entry into the world, the worst second was 27.9 fps, and neither program appeared in the per-pipeline meter's top list. - A third run with it ended about 10 s into the world on "a host command list did not close (0x80070057)". We had not seen that in 21 earlier logs, and we could not identify the command (no debug layer). Given the loop-guard bug found here, the fold may well be fine once its joins are read, which would explain the 29-92 ms on our side as well. We have not tried this branch yet, and can run the same route on it if that's useful.
akimfomin commented 2026-11-30 10:21:37 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by akimfomin on 2026-11-30T10:21:37Z.


@JSa25 Your timed Trail/Sprite split is useful. I backported the fold fix onto our pinned control and ran a 15-second house walk on RTX 4070 Ti SUPER, Series X native 2560×1440, full stock RT, no DLSS or FG. One run came in at 13.01 median / 12.05 average rendered FPS, around the 13.42 median of the previous tuned control. This is a different route, and the fresh branch still deferred some pipelines, so it does not settle whether your opening-cell stall is fixed. If you can run the same cell on this PR, I’d be interested in the two per-program times and whether the 29–92 ms stretch disappears without the wave-wide override.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7275482703 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3871#issuecomment-7275482703). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-30T10:21:37Z. --- @JSa25 Your timed Trail/Sprite split is useful. I backported the fold fix onto our pinned control and ran a 15-second house walk on RTX 4070 Ti SUPER, Series X native 2560×1440, full stock RT, no DLSS or FG. One run came in at 13.01 median / 12.05 average rendered FPS, around the 13.42 median of the previous tuned control. This is a different route, and the fresh branch still deferred some pipelines, so it does not settle whether your opening-cell stall is fixed. If you can run the same cell on this PR, I’d be interested in the two per-program times and whether the 29–92 ms stretch disappears without the wave-wide override.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!3871
No description provided.