Skip to content

Work around Mesa ANV descriptor index compiler crash - #2888

Merged
ItsNotRexed merged 4 commits into
ItsNotRexed:mainfrom
Eraxty:anv-desc-index-broadcast
Nov 23, 2026
Merged

ItsNotRexed merged 4 commits into
ItsNotRexed:mainfrom
Eraxty:anv-desc-index-broadcast

Conversation

@Eraxty

@Eraxty Eraxty commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #2516 (comment)

What and why

On Alder Lake UHD with Mesa ANV 26.2.7, the cs_sample_lz_int_d16 and ps_ssharp shader tests crash inside the Intel Vulkan driver during pipeline creation. Broadcasting the descriptor lookup result before using it as an image or sampler array index avoids the crash. The wave64 emulation path is unchanged.

Adds a translator regression test and documents the rule in docs/design.md.

Tested

  • tests/test_desc_cache.py
  • tests/test_docs_design_rows.py
  • Translator suite: 2,567 semantic and 707 pytest tests passed.
  • GPU tests on Intel Alder Lake UHD (Mesa ANV 26.2.7): both previously crashing tests pass with wave64 emulation off and on.
  • NVIDIA RTX 4050 Laptop: no regressions in the tested GPU suite.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

@tupacfan04

Copy link
Copy Markdown
Contributor

Code read of 0e5e539c (I didn't run it). Looks right. The descriptor words come from SGPRs, which are uniform across a hardware wave and therefore across any subgroup that is part of one, so OpGroupNonUniformBroadcastFirst on the lookup result doesn't change the value. It also tells the compiler the index is uniform, which avoids the ANV crash. Leaving it out under wave64 emulation is necessary (the emulated path must contain no subgroup op), and the reset of uses_bcast_first there keeps the GroupNonUniformBallot capability out of emulated modules. The new capability does make every non-emulated module that samples need subgroup ballot support in its stage. That's standard on the target GPUs, but worth a line if the index's features are meant to list it.

AI-assisted review (Claude Code).

@Eraxty

Eraxty commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

made new commit dd506da clarified that generated shader metadata records GroupNonUniform and GroupNonUniformBallot under capabilities, the features field lists optional Vulkan device features.

@CharlyRien

Copy link
Copy Markdown

Tested dd506da (merged on current main) on RTX 3090, driver 616.56, Windows 11 23H2: pass, as a non-ANV regression check. This does not exercise the Mesa ANV crash itself. With the workaround in the translator, run_gpu_tests.py gives 143/189 passed, 46 skipped (wave64 on a 32-wide GPU), the same as main on this GPU. ctest matches main here too: 3 failures, all known on this machine (d3d12_shader_cache, see #2167; and d3d12_vulkan_device / d3d12_typeless_rtv on the 23H2 in-box runtime, see #2498).

AI-assisted test run.

@javdc

javdc commented Nov 22, 2026

Copy link
Copy Markdown

Tested dd506da on Steam Deck LCD (Van Gogh, RADV Mesa 26.2.0-devel, SteamOS 3.9.5, kernel 7.2.7-valve2-2-neptune-72-g31504582a073): pass.

Commands run (from the PR worktree, against the existing runtime/build on ec8ec4c9):

  • python3 -I tests/test_desc_cache.py -> ok
  • python3 -I scripts/run_gpu_tests.py --build /home/deck/opencode/Leonida/runtime/build -> 175/189 passed, 14 skipped, 0 failed

The 14 skips are the expected D3D12-owned fixtures and ps_w64x_readlane on this RADV device (cannot require a 64-wide fragment subgroup); no failures. This change targets a Mesa ANV descriptor-index crash; on this RADV/RDNA2 Deck it shows no regression in the full GPU suite.

AI-assisted (OpenCode).

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new test fails on base (both lookup ids used directly by %images/%samplers OpAccessChains), and the full semantic suite passes 4137/4137. But the broadcast is not ANV-gated: it is emitted for every non---wave64-emulate lookup, so the workaround changes output on every driver, not just the affected Mesa path.

Also, uses_subgroup adds an unused GroupNonUniformShuffle, an %sg_lane Input and Flat, while docs/design.md claims only GroupNonUniform + GroupNonUniformBallot. The emulated wave64 output is byte-identical to main.

Please gate the broadcast to the affected ANV/Mesa path (or explain why a global broadcast is correct), and either remove the unused capability/interface or correct the docs. The GPU claims were not reproducible here.

@Eraxty

Eraxty commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for testing on both system but both machine dont use Intel ANV so neither of those directly reproduce the original Mesa crash, my Alder Lake ANV results cover that case.

also

Commit 0ea7175 now tracks the broadcast separately so it no longer adds the unused shuffle capability or subgroup-lane input, I left the broadcast in all non-emulated translations because the translator generates SPIR-V offline without knowing the eventual Vulkan driver and the descriptor key words come from SGPRs, making the broadcast an identity operation. The docs and regression test now cover the generated capabilities and interface.

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested 0ea7175 merged onto main 1628210 on an RTX 5090 (driver 616.92), Windows 11, Vulkan SDK 1.4.363. The GPU test programs were built from the same tree:

  • scripts/run_gpu_tests.py: 143/189 passed, 46 skipped, 0 failed. main 1628210 gives 143/189, 46 skipped, 0 failed. All 194 test shaders translate and pass spirv-val.
  • tests/test_desc_cache.py: .

AI-assisted (Claude Code).

@Eraxty
Eraxty requested a review from Kam471 November 22, 2026 20:08
@Eraxty

Eraxty commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

The original crash is specific to Intel ANV, so this test also doesn’t exercise the case too

Intel ANV is the open source Vulkan graphics driver for Linux within the Mesa 3D graphics library

@2-CD

2-CD commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Windows check: RTX 5080 + RTX 3070 Ti (NVIDIA 621.01) and AMD Radeon 610M iGPU (Ryzen 9 9950X3D, driver 32.0.13018.6), Windows 11, MSVC RelWithDebInfo/Ninja, Python 3.12. Tested head 0ea7175 (PR currently conflicts with main).

  • python -m compileall -q make_game.py tools tests: clean.
  • tests/test_desc_cache.py (new here) and tests/test_docs_design_rows.py: OK.
  • Translator regression suite: python -m unittest discover -s tests/semantic - 4137 tests OK (3 skipped).
  • Full ctest -C RelWithDebInfo -j 6: 125/125 on the RTX 5080 and 125/125 on the iGPU (the four window-showing present/swapchain tests excluded from the loops; the shader corpus including cs_sample_lz_int_d16 and ps_ssharp ran clean - the ANV crash is Intel-only, as expected).
  • The PR's dirty merge state is a rebase conflict, not a build or test failure: everything built and passed as-is.

Synthetic fixtures only, no game files. AI-assisted (opencode); runs on my machine.

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.

8 participants