Shaders: retry wave64 programs without the stall guard when they stay… #142

Manually merged
github merged 2 commits from github-bot/gh-142 into main 2026-12-05 20:45:26 +00:00 AGit
Owner

@⁠Callimann8 on GitHub · 2026-12-05 19:37 UTC · original
Callimann8:fix/wave64-refused-after-stall-guard → main · +55 −1 · 2 files · 2 commits · merged 2026-12-05 20:42 UTC

Title

Shaders: NVIDIA refuses 3 compute pipelines since v1.0.10 (wave64 left at 64 lanes by the stall guard)

Body

Requested by Carlos · project thread

What is wrong

Since 9a42871 (the water mosaic fix for #24, in v1.0.10 and later), every run on an NVIDIA card logs:

WARN larp_gpu::pipeline::host: host pipeline: refused error=Invalid parameter. (0x80070057) shaders=[compute eae3498e6553afa8]
WARN larp_gpu::pipeline::host: host pipeline: refused error=Invalid parameter. (0x80070057) shaders=[compute 67353810417f6c19]
WARN larp_gpu::pipeline::host: host pipeline: refused error=Invalid parameter. (0x80070057) shaders=[compute 4e9b58cc637d9272]

and then one dispatch a frame is dropped (dispatch: dropped, no host pipeline). eae3498e6553afa8 is CS_CalcRasterClassificationListCounts; the other two are its variants. In game the lighting looks off. The same three refusals show up in #123 (vkd3d-proton with VKD3D_FORCE_WAVE32=1, so 32-lane waves too).

With the D3D12 debug layer (LARP_D3D12_DEBUG=1) the reason is:

ID3D12Device::CreateComputeShader: Shader wants wave lane count of 64 but maximum wave lane count for device is 32.

Why

9a42871 added a stall guard to ir::without_skips: it keeps an s_cbranch_execz skip when the region it skips holds a loop an empty wave would not leave. For these three programs the guard keeps skips that their 32-lane forms have to leave out. Every form emit_forms tries then still needs 64 lanes, so the program is emitted with WaveSize(64), and a 32-lane host refuses the pipeline. Before 9a42871 (for example the stock 1c2a608 build) the same programs came out as 32-lane forms and ran.

The change

emit_forms: when a console wave64 compute program on a host of 32-lane waves is still at 64 lanes after every other form, it tries the forms once more with the stall guard left out (ir::without_stall_guard, a thread-local switch read by without_skips). It keeps that result only if it came down to 32 lanes, else it returns the 64-lane result as before.

  • Programs the guard does not leave at 64 lanes translate exactly as before (the retry never runs for them).
  • Hosts with 64-lane waves translate exactly as before (the whole block is behind host_uses_wave32()).
  • A program that only got here was refused by the host anyway, so the retry can only turn a pipeline that never ran into one that runs.

Testing

On Windows 11, RTX 4070 (WaveLaneCountMax 32), current main (f209756) plus this commit:

  • larp translate <the three containers> --pipelines --validate with LARP_HOST_MAX_WAVE=32: 3 validated, 3 pipelines (before: 3 validated, 0 pipelines, "Falscher Parameter").
  • The DXIL of the three is byte-identical to what the stock 1c2a608 build emits for them (LARP_EMIT_DUMP, MD5 compared).
  • In game (Series X, DLSS): no host pipeline: refused line and no dropped dispatch; the lighting that looked off with v1.0.10+ looks right again.
  • Not tested on AMD (no card here); AMD wave64 hosts do not enter the changed path.
**@⁠Callimann8** on GitHub · 2026-12-05 19:37 UTC · [original](https://github.com/gamingwithhomie/larp/pull/142) `Callimann8:fix/wave64-refused-after-stall-guard` → `main` · +55 −1 · 2 files · 2 commits · merged 2026-12-05 20:42 UTC # Title Shaders: NVIDIA refuses 3 compute pipelines since v1.0.10 (wave64 left at 64 lanes by the stall guard) # Body <!-- claude-projects-attribution: {"github_login":"Callimann8"} --> _Requested by **Carlos** · [project thread](https://claude.ai/code/project/chan_014rNLXnE9ipmxjaZNxDP8hx?thread=cmsg_014rNLXnE9ipmxjaZNxDP8hx9RUFoAQVDVDTt6CfpFjniE)_ ## What is wrong Since 9a42871 (the water mosaic fix for #24, in v1.0.10 and later), every run on an NVIDIA card logs: ``` WARN larp_gpu::pipeline::host: host pipeline: refused error=Invalid parameter. (0x80070057) shaders=[compute eae3498e6553afa8] WARN larp_gpu::pipeline::host: host pipeline: refused error=Invalid parameter. (0x80070057) shaders=[compute 67353810417f6c19] WARN larp_gpu::pipeline::host: host pipeline: refused error=Invalid parameter. (0x80070057) shaders=[compute 4e9b58cc637d9272] ``` and then one dispatch a frame is dropped (`dispatch: dropped, no host pipeline`). `eae3498e6553afa8` is `CS_CalcRasterClassificationListCounts`; the other two are its variants. In game the lighting looks off. The same three refusals show up in #123 (vkd3d-proton with `VKD3D_FORCE_WAVE32=1`, so 32-lane waves too). With the D3D12 debug layer (`LARP_D3D12_DEBUG=1`) the reason is: ``` ID3D12Device::CreateComputeShader: Shader wants wave lane count of 64 but maximum wave lane count for device is 32. ``` ## Why 9a42871 added a stall guard to `ir::without_skips`: it keeps an `s_cbranch_execz` skip when the region it skips holds a loop an empty wave would not leave. For these three programs the guard keeps skips that their 32-lane forms have to leave out. Every form `emit_forms` tries then still needs 64 lanes, so the program is emitted with `WaveSize(64)`, and a 32-lane host refuses the pipeline. Before 9a42871 (for example the stock `1c2a608` build) the same programs came out as 32-lane forms and ran. ## The change `emit_forms`: when a console wave64 compute program on a host of 32-lane waves is still at 64 lanes after every other form, it tries the forms once more with the stall guard left out (`ir::without_stall_guard`, a thread-local switch read by `without_skips`). It keeps that result only if it came down to 32 lanes, else it returns the 64-lane result as before. - Programs the guard does not leave at 64 lanes translate exactly as before (the retry never runs for them). - Hosts with 64-lane waves translate exactly as before (the whole block is behind `host_uses_wave32()`). - A program that only got here was refused by the host anyway, so the retry can only turn a pipeline that never ran into one that runs. ## Testing On Windows 11, RTX 4070 (WaveLaneCountMax 32), current `main` (f209756) plus this commit: - `larp translate <the three containers> --pipelines --validate` with `LARP_HOST_MAX_WAVE=32`: **3 validated, 3 pipelines** (before: 3 validated, 0 pipelines, "Falscher Parameter"). - The DXIL of the three is **byte-identical** to what the stock `1c2a608` build emits for them (`LARP_EMIT_DUMP`, MD5 compared). - In game (Series X, DLSS): no `host pipeline: refused` line and no dropped dispatch; the lighting that looked off with v1.0.10+ looks right again. - Not tested on AMD (no card here); AMD wave64 hosts do not enter the changed path.
Since 9a42871 (water mosaic fix, #24), `ir::without_skips` keeps the skips
in front of a loop an empty wave would not leave. On a host of 32-lane
waves (NVIDIA) that keeps CS_CalcRasterClassificationListCounts
(eae3498e6553afa8) and its two variants (67353810417f6c19,
4e9b58cc637d9272) at `WaveSize(64)`: every stripped form still needs 64
lanes, so the host refuses the pipeline ("Shader wants wave lane count of
64 but maximum wave lane count for device is 32", E_INVALIDARG) and one
dispatch a frame is dropped. Before 9a42871 the same programs became
32-lane forms.

When a console wave64 compute program on a 32-lane host is still left at
64 lanes after every other form, `emit_forms` now tries the forms once
more with the stall guard left out (`ir::without_stall_guard`). It takes
that result only if it came down to 32 lanes. Programs the guard does not
leave at 64 lanes, and 64-lane hosts, translate as before.

Checked on an RTX 4070 (driver's WaveLaneCountMax 32):
- `larp translate --pipelines --validate` with LARP_HOST_MAX_WAVE=32 on
  the three containers: 3 validated, 3 pipelines (before: 0 pipelines).
- The DXIL of the three is byte-identical to the stock 1c2a608 build's.
- In game: no "host pipeline: refused" line and no dropped dispatch; the
  lighting that looked off with v1.0.10+ looks right again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 19:43:31 +00:00
Author
Owner

@⁠Kassadd on GitHub · 2026-12-05 20:00 UTC · original

Ran it on CachyOS + Proton, RTX 4080 SUPER, vkd3d-proton 3.2.0. In short: it works, and the cost is visible.

What it fixes, confirmed. host pipeline: refused goes from 3 to 0 for the whole run, and the lighting problem is gone — shadows are cast again (the player, bollards, the canopy, the poles), and the sky stops being blown out white. That last part I did not expect: CS_CalcRasterClassificationListCounts failing was washing out the whole exterior, not only removing shadows.

The cost. With the stall guard left out there are now shadow artefacts on some geometry: dark patches with no caster behind them, and very hard edges. Which is roughly what removing the guard would predict — the 32-lane form runs where the guard would have kept a wave from executing.

Two notes that may help:

  • 0 indirect executions in the frame line still reads 0 even with the shadows back, so whatever that counter tracks is not the shadow pass. It is not a useful signal here.
  • The three refusals reproduce on a build without #135 as well, so it is not the Wine fixes interacting with it.
**@⁠Kassadd** on GitHub · 2026-12-05 20:00 UTC · [original](https://github.com/gamingwithhomie/larp/pull/142#issuecomment-7444450225) Ran it on CachyOS + Proton, RTX 4080 SUPER, vkd3d-proton 3.2.0. In short: it works, and the cost is visible. **What it fixes, confirmed.** `host pipeline: refused` goes from **3 to 0** for the whole run, and the lighting problem is gone — shadows are cast again (the player, bollards, the canopy, the poles), and the sky stops being blown out white. That last part I did not expect: `CS_CalcRasterClassificationListCounts` failing was washing out the whole exterior, not only removing shadows. **The cost.** With the stall guard left out there are now shadow artefacts on some geometry: dark patches with no caster behind them, and very hard edges. Which is roughly what removing the guard would predict — the 32-lane form runs where the guard would have kept a wave from executing. Two notes that may help: - `0 indirect executions` in the frame line **still reads 0** even with the shadows back, so whatever that counter tracks is not the shadow pass. It is not a useful signal here. - The three refusals reproduce on a build without #135 as well, so it is not the Wine fixes interacting with it.
The retry for programs left at 64 lanes on a 32-lane host turned the whole
stall guard of `ir::without_skips` off. The guard has two tests: a loop
that provably never ends for a wave with no lane (`decided_cycle`), and a
cautious one that holds for any region that reads lanes and has a loop at
all (`reads_lanes && any_cycle`). Only the second fires for
CS_CalcRasterClassificationListCounts (eae3498e6553afa8) and its two
variants: it keeps the skip in front of the thread-0 prefix sum over the
group's waves (0xfb8 in eae3...), whose two loops are bounded by scalar
counters (`s_cmp_eq_u32` / `s_cmp_gt_u32` against constants) and end on
any wave.

`stall_guard_off` now leaves out only the cautious test; a skip in front of
a provably endless loop is kept in the retry too. The DXIL of the three
programs is byte-identical to the previous commit's (and to the stock
1c2a608 build's).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠Callimann8 on GitHub · 2026-12-05 20:22 UTC · original

Ran it on CachyOS + Proton, RTX 4080 SUPER, vkd3d-proton 3.2.0. In short: it works, and the cost is visible.

What it fixes, confirmed. host pipeline: refused goes from 3 to 0 for the whole run, and the lighting problem is gone — shadows are cast again (the player, bollards, the canopy, the poles), and the sky stops being blown out white. That last part I did not expect: CS_CalcRasterClassificationListCounts failing was washing out the whole exterior, not only removing shadows.

The cost. With the stall guard left out there are now shadow artefacts on some geometry: dark patches with no caster behind them, and very hard edges. Which is roughly what removing the guard would predict — the 32-lane form runs where the guard would have kept a wave from executing.

Two notes that may help:

Thanks for testing this on Proton, and for the note about the sky. That was the "washed out" look I first reported too.

I looked into whether the artefacts come from leaving the guard out, and I don't think they do:

  • For these three programs the guard only ever fires through its cautious test (reads_lanes && any_cycle), never through decided_cycle. I checked this with a debug print on the stall test. The skip it keeps is the one at 0xfb8 in eae3498e6553afa8, in front of the thread-0 prefix sum over the group's waves (B15-B20). Both loops in it are bounded by scalar counters compared against constants (s_cmp_eq_u32 s4, N and s_cmp_gt_u32 s5, N), so a wave with no lane walks them a fixed number of times and leaves. Its LDS writes and the final stores are all under EXEC, so an empty wave writes nothing.
  • The emitted DXIL of all three is byte-identical to what the stock 1c2a608 build (before 9a42871) emits for them, MD5-compared. So these passes now run exactly as they did in v1.0.9 and earlier.

I pushed a follow-up commit (5cb4487) that makes this explicit. The retry now leaves out only the cautious test, and a skip in front of a loop that provably never ends for an empty wave is kept even in the retry. The output for the three programs doesn't change (same hashes), but nothing else can slip through that path now.

So my guess is that the dark patches and hard edges come from somewhere else in the shadow path that was hidden while these three never ran. Two checks would tell us:

  1. Do the same artefacts show up on a pre-9a42871 build such as v1.0.9 on your setup? If they do, they're older than this PR.
  2. Do they show up on Windows with an NVIDIA card? I'm on an RTX 4070 and haven't seen them yet. I'll look for them specifically.
**@⁠Callimann8** on GitHub · 2026-12-05 20:22 UTC · [original](https://github.com/gamingwithhomie/larp/pull/142#issuecomment-7444758053) > Ran it on CachyOS + Proton, RTX 4080 SUPER, vkd3d-proton 3.2.0. In short: it works, and the cost is visible. > > **What it fixes, confirmed.** `host pipeline: refused` goes from **3 to 0** for the whole run, and the lighting problem is gone — shadows are cast again (the player, bollards, the canopy, the poles), and the sky stops being blown out white. That last part I did not expect: `CS_CalcRasterClassificationListCounts` failing was washing out the whole exterior, not only removing shadows. > > **The cost.** With the stall guard left out there are now shadow artefacts on some geometry: dark patches with no caster behind them, and very hard edges. Which is roughly what removing the guard would predict — the 32-lane form runs where the guard would have kept a wave from executing. > > Two notes that may help: > > * `0 indirect executions` in the frame line **still reads 0** even with the shadows back, so whatever that counter tracks is not the shadow pass. It is not a useful signal here. > * The three refusals reproduce on a build without [Wine fixes: pipeline worker stack, hot guard blocks, no reserved buffers; opt-in preload #135](https://git.gtahub.st/github/gamingwithhomie--larp/pulls/135) as well, so it is not the Wine fixes interacting with it. Thanks for testing this on Proton, and for the note about the sky. That was the "washed out" look I first reported too. I looked into whether the artefacts come from leaving the guard out, and I don't think they do: - For these three programs the guard only ever fires through its cautious test (`reads_lanes && any_cycle`), never through `decided_cycle`. I checked this with a debug print on the stall test. The skip it keeps is the one at 0xfb8 in eae3498e6553afa8, in front of the thread-0 prefix sum over the group's waves (B15-B20). Both loops in it are bounded by scalar counters compared against constants (`s_cmp_eq_u32 s4, N` and `s_cmp_gt_u32 s5, N`), so a wave with no lane walks them a fixed number of times and leaves. Its LDS writes and the final stores are all under EXEC, so an empty wave writes nothing. - The emitted DXIL of all three is byte-identical to what the stock 1c2a608 build (before 9a42871) emits for them, MD5-compared. So these passes now run exactly as they did in v1.0.9 and earlier. I pushed a follow-up commit (5cb4487) that makes this explicit. The retry now leaves out only the cautious test, and a skip in front of a loop that provably never ends for an empty wave is kept even in the retry. The output for the three programs doesn't change (same hashes), but nothing else can slip through that path now. So my guess is that the dark patches and hard edges come from somewhere else in the shadow path that was hidden while these three never ran. Two checks would tell us: 1. Do the same artefacts show up on a pre-9a42871 build such as v1.0.9 on your setup? If they do, they're older than this PR. 2. Do they show up on Windows with an NVIDIA card? I'm on an RTX 4070 and haven't seen them yet. I'll look for them specifically.
github-bot referenced this pull request from a commit 2026-12-05 20:45:09 +00:00
github manually merged commit fdd5924f5a into main 2026-12-05 20:45:22 +00:00
Author
Owner

@⁠HeyOkay on GitHub · 2026-12-05 20:42 UTC · original

Additional Windows / RTX 5070 Ti result for the three affected compute programs.

This is an isolated output-workaround test on the existing v1.0.11 NVIDIA binary, not a build or validation of the current PR head.

Environment: Windows, RTX 5070 Ti 16 GB, i5-14600K; Series S; configured 2560x1440, DLSS Quality, sharpening 0.5, FG 2x, 30 base-FPS cap. The existing final 3840x2160 swapchain limitation remains separate.

Method:

  • Extracted only the three local cached containers, verifying their full BLAKE3 hashes: eae3498e6553afa8, 67353810417f6c19, 4e9b58cc637d9272.
  • Re-emitted them with the retained pre-water-guard stock runtime (EXE SHA256 CFB9F1CE9E95F89A83CA2546B9EEBD928FB03437DF6A2753F86376FA77EDFC47), LARP_HOST_MAX_WAVE=32 and LARP_VIEW_LIMIT=999999, using CPU-only translation first.
  • Disassembly confirmed WaveSize=32 for these outputs versus WaveSize=64 in the v1.0.11 outputs. Compared the emitted user-data/root-resource interfaces; all three matched. The existing v1.0.11 runtime accepted all three replacements, validated all three DXIL programs, and created all three D3D12 pipelines on this GPU.
  • Installed only those three .compute.dxil replacement files into the existing runtime. The EXE was unchanged (SHA256 7812152786646B40B7081A18D1F469217C3AC443AC29BF1745BFDA6217B29F71); all 154 pre-existing replacement files remained SHA256-identical; the existing cache and saves were retained.

Observed result:

  • All three replacement-load messages are present in the actual game log; host-pipeline refusals went from 3 to 0 and the previous per-frame dropped-pipeline count went to 0.
  • The player confirms that the bright white silhouette halos around hair/palm trees disappeared, incorrect scene lighting was corrected, and metallic-surface artifacts disappeared too.
  • Prior same-scene checks with sharpening off, then FG off and DLSS off did not remove the halos.
  • Recent game-render log intervals show about 30 base FPS; this is a capped short-session observation, not an uncapped benchmark or a long-session stability claim. Generated frames are excluded from that base counter.

The existing face-related replacement files were untouched; a separate post-fix close-up face regression check has not yet been recorded. I have not established whether the hard-edged shadow artifacts reported on Proton are absent in every scene on this Windows setup.

This supports the three restored Wave32 outputs as an explanation for the visible regressions on this machine, without claiming that the current/general retry implementation has been tested here. No game containers, translated shader binaries, or private logs are attached.

**@⁠HeyOkay** on GitHub · 2026-12-05 20:42 UTC · [original](https://github.com/gamingwithhomie/larp/pull/142#issuecomment-7445045786) Additional Windows / RTX 5070 Ti result for the three affected compute programs. This is an isolated output-workaround test on the existing v1.0.11 NVIDIA binary, not a build or validation of the current PR head. Environment: Windows, RTX 5070 Ti 16 GB, i5-14600K; Series S; configured 2560x1440, DLSS Quality, sharpening 0.5, FG 2x, 30 base-FPS cap. The existing final 3840x2160 swapchain limitation remains separate. Method: - Extracted only the three local cached containers, verifying their full BLAKE3 hashes: eae3498e6553afa8, 67353810417f6c19, 4e9b58cc637d9272. - Re-emitted them with the retained pre-water-guard stock runtime (EXE SHA256 CFB9F1CE9E95F89A83CA2546B9EEBD928FB03437DF6A2753F86376FA77EDFC47), LARP_HOST_MAX_WAVE=32 and LARP_VIEW_LIMIT=999999, using CPU-only translation first. - Disassembly confirmed WaveSize=32 for these outputs versus WaveSize=64 in the v1.0.11 outputs. Compared the emitted user-data/root-resource interfaces; all three matched. The existing v1.0.11 runtime accepted all three replacements, validated all three DXIL programs, and created all three D3D12 pipelines on this GPU. - Installed only those three .compute.dxil replacement files into the existing runtime. The EXE was unchanged (SHA256 7812152786646B40B7081A18D1F469217C3AC443AC29BF1745BFDA6217B29F71); all 154 pre-existing replacement files remained SHA256-identical; the existing cache and saves were retained. Observed result: - All three replacement-load messages are present in the actual game log; host-pipeline refusals went from 3 to 0 and the previous per-frame dropped-pipeline count went to 0. - The player confirms that the bright white silhouette halos around hair/palm trees disappeared, incorrect scene lighting was corrected, and metallic-surface artifacts disappeared too. - Prior same-scene checks with sharpening off, then FG off and DLSS off did not remove the halos. - Recent game-render log intervals show about 30 base FPS; this is a capped short-session observation, not an uncapped benchmark or a long-session stability claim. Generated frames are excluded from that base counter. The existing face-related replacement files were untouched; a separate post-fix close-up face regression check has not yet been recorded. I have not established whether the hard-edged shadow artifacts reported on Proton are absent in every scene on this Windows setup. This supports the three restored Wave32 outputs as an explanation for the visible regressions on this machine, without claiming that the current/general retry implementation has been tested here. No game containers, translated shader binaries, or private logs are attached.
Author
Owner

@⁠Proudnoob4 on GitHub · 2026-12-05 21:27 UTC · original

Confirmed on RTX 4080 / Windows 10 19045, Series X, 2560x1440 DLSS Quality, frame generation off. Our baseline e80ff0f logged each of the three named 0x80070057 pipeline refusals once, plus one dropped-dispatch warning. With only 101e63b and 5cb4487 applied to that baseline, a first boot and a warmed boot both reached gameplay with zero host-pipeline refusals and zero dropped-dispatch warnings. Caps were 30 for the first boot and 60 for the warm boot. Both runs ended at our harness deadline. The input replay diverged, so this is a pipeline/startup confirmation, not a matched visual or FPS comparison.

**@⁠Proudnoob4** on GitHub · 2026-12-05 21:27 UTC · [original](https://github.com/gamingwithhomie/larp/pull/142#issuecomment-7445678821) Confirmed on RTX 4080 / Windows 10 19045, Series X, 2560x1440 DLSS Quality, frame generation off. Our baseline e80ff0f logged each of the three named 0x80070057 pipeline refusals once, plus one dropped-dispatch warning. With only 101e63b and 5cb4487 applied to that baseline, a first boot and a warmed boot both reached gameplay with zero host-pipeline refusals and zero dropped-dispatch warnings. Caps were 30 for the first boot and 60 for the warm boot. Both runs ended at our harness deadline. The input replay diverged, so this is a pipeline/startup confirmation, not a matched visual or FPS comparison.
This discussion has been locked. Commenting is limited to contributors.
No description provided.