Skip to content

Fix Wine pipeline worker overflows in shader translation - #12

Open
gmankab wants to merge 1 commit into
PastiiJay:betafrom
gmankab:fix/klbf-vkd3d-shader-loops
Open

gmankab wants to merge 1 commit into
PastiiJay:betafrom
gmankab:fix/klbf-vkd3d-shader-loops

Conversation

@gmankab

@gmankab gmankab commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

This ports powplusplus's shader-loop normalization and pipeline worker stack size from Fxceless. The DXIL conversion path expects a single back edge per loop header. Joining multiple back edges through a block also joins their phi inputs.

On an RX 6800, the unpatched beta reported six pipeline-worker stack overflows with its default stack and six again with a verified 64 MiB reservation. With this patch, the longer run drained the startup pipeline queue, logged zero worker stack overflows, and rendered the prologue courtyard in Series S mode with FSR 3.1.6. The run later hit the null-write exception at title offset 0x23cf683, which also occurred in an earlier stable build.

The smoke and prologue tests used commit 7bcfe20 with the same executable source as this branch. The intervening beta commits only changed documentation. The runs used different warm cache states, so the main evidence here is queue completion and disappearance of the overflow reports.

Based-on: fxceless/victory-fork#737
Tested-on: RX 6800, Fedora Linux 45, Wine/vkd3d-proton, FSR 3.1.6
Assisted-by: gpt-6.2 sol xhigh

…ine stack

vkd3d-proton's DXIL-to-SPIR-V converter keeps a single back edge per loop
header and treats additional back edges as forward edges, recursing
indefinitely over the resulting cycle in shaders with wave shuffles.
Large traversal shaders also overflow the default 2 MiB thread stack during
vkd3d-proton DXIL conversion under Wine, hanging the worker thread instead
of returning an error.

Add Module::single_latches() before bitcode emission to route multi-latch
loop headers through a single synthetic latch block joining their phi
values, and raise the pipeline worker stack size to 256 MiB (reserved
virtual space, committed on demand) in both victory-gpu and the translate
CLI.

Fixes all 6 previously hanging ray-tracing shadow shaders on RTX 3080
under Wine/vkd3d-proton (0 timeouts, 6/6 pipelines created).
@PastiiJay

Copy link
Copy Markdown
Owner

Thanks @gmankab! Since this touches the shader translator for every card, we'll run it in game on our RX 9070 XT first (it goes into our next test build) and merge here once it holds. Will report back in this PR.

@HandshakeHackin

Copy link
Copy Markdown
Contributor

I checked the loop rewrite on native Windows with a synthetic compute shader whose two back edges update a counter and an accumulator differently. The fixture runs 128 threads, including eight that skip the loop. It validates the generated DXIL, dispatches it on WARP, and compares both values from every thread with a CPU reference.

All 256 output dwords matched in each of four runs on the parent (39cd1f4) and the PR (7b916df), each with optimizations off and at their default. The CPU reference took the two back edges 448 and 256 times respectively. This covers the values carried around the loop on Windows. Runnable test · Four Windows runs

@PastiiJay

Copy link
Copy Markdown
Owner

Thanks for checking the loop rewrite on native Windows, that settles the Wine-only worry. We'll give it a run in game too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants