Shaders: leave the reuse pass out on AMD, whose compiler crashes on it #61

Open
PikPakPik wants to merge 1 commit from upstream-pr/61 into main
PikPakPik commented 2026-11-25 08:09:09 +00:00 (Migrated from github.com)
First-time contributor

Imported from Zettrox/ztrx. Originally posted by PikPakPik on 2026-11-25T07:08:13Z.


Fixes the AMD crash a minute into the prologue: the title dies with 0xc0000005 inside amdxc64.dll, always at amdxc64.dll+0x861b9f, under CreateComputePipelineState.

Why: AMD's shader compiler (RX 9060 XT, driver 32.0.32029.2010) crashes compiling CS_RaytracingResolve (501f0865fdf45dfd), the first program of the ray-tracing resolve the prologue binds. The DXIL is valid (dxil.dll's validator passes it), so this is the driver. Retranslating that one program with each clean-up pass left out in turn (VICTORY_TRANSLATE_ONLY=501f0865fdf45dfd victory translate --pipelines), only leaving out pass 4, one instruction for one value (VICTORY_SHADER_OPT=59), compiles; leaving out any other pass still crashes. Capping host waves at 32 does not help.

What: emit::set_host_vendor(vendor) leaves the reuse pass out on AMD (0x1002) unless VICTORY_SHADER_OPT names it; the driver merges repeated values itself. Both the runtime device (victory-gpu) and the translator's test host (translate --pipelines) call it, and the shader cache already keys on shader_opt(), so translations cached with the pass are not served.

Verification: cargo test -p victory-shader -p victory-gpu passes (110 and 210), clippy is clean. On the RX 9060 XT, translate --pipelines --validate over that program now reports "pipeline created", and the title ran the prologue for 6 minutes without a crash at about 2 fps, where it crashed after about a minute before. One pipeline is still refused there (mesh f5e50eb2108c425b), the integer-target blending that #36 fixes.

<!-- greyfinch-sync:Zettrox/ztrx:issue:6599196264 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/61). Originally posted by [PikPakPik](https://github.com/PikPakPik) on 2026-11-25T07:08:13Z. --- Fixes the AMD crash a minute into the prologue: the title dies with `0xc0000005` inside `amdxc64.dll`, always at `amdxc64.dll+0x861b9f`, under `CreateComputePipelineState`. **Why:** AMD's shader compiler (RX 9060 XT, driver 32.0.32029.2010) crashes compiling `CS_RaytracingResolve` (`501f0865fdf45dfd`), the first program of the ray-tracing resolve the prologue binds. The DXIL is valid (`dxil.dll`'s validator passes it), so this is the driver. Retranslating that one program with each clean-up pass left out in turn (`VICTORY_TRANSLATE_ONLY=501f0865fdf45dfd victory translate --pipelines`), only leaving out pass 4, one instruction for one value (`VICTORY_SHADER_OPT=59`), compiles; leaving out any other pass still crashes. Capping host waves at 32 does not help. **What:** `emit::set_host_vendor(vendor)` leaves the reuse pass out on AMD (`0x1002`) unless `VICTORY_SHADER_OPT` names it; the driver merges repeated values itself. Both the runtime device (`victory-gpu`) and the translator's test host (`translate --pipelines`) call it, and the shader cache already keys on `shader_opt()`, so translations cached with the pass are not served. **Verification:** `cargo test -p victory-shader -p victory-gpu` passes (110 and 210), clippy is clean. On the RX 9060 XT, `translate --pipelines --validate` over that program now reports "pipeline created", and the title ran the prologue for 6 minutes without a crash at about 2 fps, where it crashed after about a minute before. One pipeline is still refused there (`mesh f5e50eb2108c425b`), the integer-target blending that #36 fixes.
iNaxxs commented 2026-11-25 10:11:23 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by iNaxxs on 2026-11-25T09:51:02Z.


Heads-up on an overlap: my #27 adds the same host adapter log at the same
place, with the same GetDesc1 / nul-trim / from_utf16_lossy shape, so the two
will conflict in crates/victory-gpu/src/host.rs.

#27 also changes which adapter the device is made on: on a laptop with
switchable graphics DXGI reports the integrated GPU first and
D3D12CreateDevice(None, ..) takes it, so on a Ryzen 5 8645HS with a Radeon
760M and an RTX 4050 every submission went to the Radeon. It asks DXGI for the
high-performance adapter instead and falls back to the default when there is
none. Your set_host_vendor call sits right where mine logs, so whichever
lands first, the other is a small rebase. Happy to do mine on top of yours if
that is easier.

<!-- greyfinch-sync:Zettrox/ztrx:comment:7158884916 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/61#issuecomment-7158884916). Originally posted by [iNaxxs](https://github.com/iNaxxs) on 2026-11-25T09:51:02Z. --- Heads-up on an overlap: my #27 adds the same `host adapter` log at the same place, with the same GetDesc1 / nul-trim / from_utf16_lossy shape, so the two will conflict in `crates/victory-gpu/src/host.rs`. #27 also changes which adapter the device is made on: on a laptop with switchable graphics DXGI reports the integrated GPU first and `D3D12CreateDevice(None, ..)` takes it, so on a Ryzen 5 8645HS with a Radeon 760M and an RTX 4050 every submission went to the Radeon. It asks DXGI for the high-performance adapter instead and falls back to the default when there is none. Your `set_host_vendor` call sits right where mine logs, so whichever lands first, the other is a small rebase. Happy to do mine on top of yours if that is easier.
PikPakPik commented 2026-11-25 10:11:23 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by PikPakPik on 2026-11-25T09:56:20Z.


Oh nice, hadn't seen #27. Yours is the better home for the adapter log anyway (and picking the right GPU is the real fix for those laptops), so I took mine out. #61 now just grabs the vendor id there and passes it to set_host_vendor. Whoever gets merged first, the other is a one-line rebase.

<!-- greyfinch-sync:Zettrox/ztrx:comment:7159005038 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/61#issuecomment-7159005038). Originally posted by [PikPakPik](https://github.com/PikPakPik) on 2026-11-25T09:56:20Z. --- Oh nice, hadn't seen #27. Yours is the better home for the adapter log anyway (and picking the right GPU is the real fix for those laptops), so I took mine out. #61 now just grabs the vendor id there and passes it to `set_host_vendor`. Whoever gets merged first, the other is a one-line rebase.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/61:upstream-pr/61'
git switch 'upstream-pr/61'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/61'
git switch 'upstream-pr/61'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/61'
git switch 'upstream-pr/61'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/61'
git switch 'main'
git merge --squash 'upstream-pr/61'
git switch 'main'
git merge --ff-only 'upstream-pr/61'
git switch 'main'
git merge 'upstream-pr/61'
git push origin 'main'
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
Zettrox/ztrx!61
No description provided.