fix(vk): keep NumWorkgroups live in native mesh shaders for RADV < 26.2.5 #2338

Merged
HumanBean merged 2 commits from GrimVisage/Longshot:fix/radv-mesh-num-workgroups into main 2026-11-23 16:07:26 +00:00
Contributor

Summary

Native VK_EXT_mesh_shader mesh shaders (Stage::Mesh when !runtime_info.mesh_fallback) can trigger a GPU hang (RING_GFP_TIMEOUT / invalid SET_SH_REG with reg_count == 0) on RADV RDNA 3/4 GPUs running Mesa < 26.2.5 (before upstream Mesa MR !45092) when a mesh shader does not reference gl_NumWorkGroups (spv::BuiltIn::NumWorkgroups).

Following Lichii PR #1203 (see #1285), this declares spv::BuiltIn::NumWorkgroups on native Stage::Mesh modules for RADV before Mesa 26.2.5 and keeps a load of NumWorkgroups.x live through NIR dead-code elimination by gating the primitive count passed to OpSetMeshOutputsEXT with OpSelect(NumWorkgroups.x != 0, count, 0). Since every launched mesh workgroup has NumWorkgroups.x > 0, the emitted primitive count is unchanged while ensuring ac_nir_lower_ngg_ms reserves the mesh grid-size registers.

This PR keeps RADV's default mesh mode unchanged (compute fallback remains the default on RADV pending #2291 and maintainer decision on flipping defaults).

Files to read first:

  • gpu/vk/eden/shader_recompiler/backend/spirv/spirv_emit_context.h / spirv_emit_context.cpp (DefineInputs)
  • gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_mesh.cpp (MeshEpilogue)
  • tests/global_load_16_ir.cpp (check_mesh_num_workgroups)

See #1285.

Testing

Tested:

  • Fedora 45 Linux, AMD Radeon RX 9070 XT (RADV GFX1201, Mesa 26.3.1), Ryzen 5 5600X: ran Longshot with RX_VK_MESH_FALLBACK=0 (native VK_EXT_mesh_shader) across kokiri-forest and castle-gate (paired A/B runs, 1440p and 67% resolution); shaders translated, validated, and rendered cleanly with no hangs or visual regressions.
  • Focused real-IR SPIR-V fixture (tests/global_load_16, Clang 23.1.5 C++20): global_load_16_ir passed all checks including the new mesh-num-workgroups-native (verifies BuiltIn::NumWorkgroups input + OpLoad + OpSelect feeding OpSetMeshOutputsEXT) and mesh-num-workgroups-fallback (verifies compute mesh fallback is untouched), and all 34 emitted .spv modules passed spirv-val --target-env vulkan1.3 --uniform-buffer-standard-layout.
  • mise run test-changed: 20 passed, 0 failed, 0 skipped.
  • mise run test: 933 passed, 6 failed, 18 skipped on main @ 0e32bc10 (the 6 failures are unrelated local environment/workspace checks: tests/test_audio_source.py, tests/test_crash_record.py, tests/test_dev_packs.py, tests/test_mise_build.py, tests/test_pipeline_state_computes.py, tests/test_saveload_warm_cache.py).
  • pre-commit on 4 changed files: passed.

Still to test:

  • Linux, AMD RDNA 3/4 on RADV Mesa < 26.2.5: run with RX_VK_MESH_FALLBACK=0, expecting no RING_GFP_TIMEOUT GPU hang on native mesh shaders (by hand, or @Beanstalk run on Linux AMD with RX_VK_MESH_FALLBACK=0).
  • Windows and Linux NVIDIA/AMD Tier 1 hardware: verify native mesh shaders continue to compile and render with no regressions (@Beanstalk build and run smoke test on Windows and Linux).

Measurements

Nothing to measure: this is a correctness/stability workaround for native Stage::Mesh SPIR-V emission on RADV < 26.2.5 (adds one OpLoad + OpINotEqual + OpSelect in MeshEpilogue on RADV before Mesa 26.2.5 when RX_VK_MESH_FALLBACK=0); no default or switch is changed.

Risks

  • Low risk: only affects native Stage::Mesh shaders (!runtime_info.mesh_fallback) on RADV before Mesa 26.2.5, adding a constant-true OpSelect on NumWorkgroups.x != 0 to OpSetMeshOutputsEXT's primitive count. Compute mesh fallback (mesh_fallback == true) is untouched.
  • A player notices nothing by default on RADV (compute fallback remains default); players opting into RX_VK_MESH_FALLBACK=0 on RADV < 26.2.5 avoid the RING_GFP_TIMEOUT hang.
  • A simple revert removes the workaround cleanly.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

Assisted-by: Antigravity
Co-Authored-By: Antigravity [email protected]

## Summary Native `VK_EXT_mesh_shader` mesh shaders (`Stage::Mesh` when `!runtime_info.mesh_fallback`) can trigger a GPU hang (`RING_GFP_TIMEOUT` / invalid `SET_SH_REG` with `reg_count == 0`) on RADV RDNA 3/4 GPUs running Mesa < 26.2.5 (before upstream Mesa MR `!45092`) when a mesh shader does not reference `gl_NumWorkGroups` (`spv::BuiltIn::NumWorkgroups`). Following Lichii PR `#1203` (see #1285), this declares `spv::BuiltIn::NumWorkgroups` on native `Stage::Mesh` modules for RADV before Mesa 26.2.5 and keeps a load of `NumWorkgroups.x` live through NIR dead-code elimination by gating the primitive count passed to `OpSetMeshOutputsEXT` with `OpSelect(NumWorkgroups.x != 0, count, 0)`. Since every launched mesh workgroup has `NumWorkgroups.x > 0`, the emitted primitive count is unchanged while ensuring `ac_nir_lower_ngg_ms` reserves the mesh grid-size registers. This PR keeps RADV's default mesh mode unchanged (compute fallback remains the default on RADV pending `#2291` and maintainer decision on flipping defaults). **Files to read first:** - `gpu/vk/eden/shader_recompiler/backend/spirv/spirv_emit_context.h` / `spirv_emit_context.cpp` (`DefineInputs`) - `gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_mesh.cpp` (`MeshEpilogue`) - `tests/global_load_16_ir.cpp` (`check_mesh_num_workgroups`) See #1285. ## Testing **Tested:** - Fedora 45 Linux, AMD Radeon RX 9070 XT (RADV GFX1201, Mesa 26.3.1), Ryzen 5 5600X: ran Longshot with `RX_VK_MESH_FALLBACK=0` (native `VK_EXT_mesh_shader`) across `kokiri-forest` and `castle-gate` (paired A/B runs, 1440p and 67% resolution); shaders translated, validated, and rendered cleanly with no hangs or visual regressions. - Focused real-IR SPIR-V fixture (`tests/global_load_16`, Clang 23.1.5 C++20): `global_load_16_ir` passed all checks including the new `mesh-num-workgroups-native` (verifies `BuiltIn::NumWorkgroups` input + `OpLoad` + `OpSelect` feeding `OpSetMeshOutputsEXT`) and `mesh-num-workgroups-fallback` (verifies compute mesh fallback is untouched), and all 34 emitted `.spv` modules passed `spirv-val --target-env vulkan1.3 --uniform-buffer-standard-layout`. - `mise run test-changed`: 20 passed, 0 failed, 0 skipped. - `mise run test`: 933 passed, 6 failed, 18 skipped on `main` @ `0e32bc10` (the 6 failures are unrelated local environment/workspace checks: `tests/test_audio_source.py`, `tests/test_crash_record.py`, `tests/test_dev_packs.py`, `tests/test_mise_build.py`, `tests/test_pipeline_state_computes.py`, `tests/test_saveload_warm_cache.py`). - `pre-commit` on 4 changed files: passed. **Still to test:** - Linux, AMD RDNA 3/4 on RADV Mesa < 26.2.5: run with `RX_VK_MESH_FALLBACK=0`, expecting no `RING_GFP_TIMEOUT` GPU hang on native mesh shaders (by hand, or `@Beanstalk run on Linux AMD with RX_VK_MESH_FALLBACK=0`). - Windows and Linux NVIDIA/AMD Tier 1 hardware: verify native mesh shaders continue to compile and render with no regressions (`@Beanstalk build and run smoke test on Windows and Linux`). ## Measurements Nothing to measure: this is a correctness/stability workaround for native `Stage::Mesh` SPIR-V emission on RADV < 26.2.5 (adds one `OpLoad` + `OpINotEqual` + `OpSelect` in `MeshEpilogue` on RADV before Mesa 26.2.5 when `RX_VK_MESH_FALLBACK=0`); no default or switch is changed. ## Risks - Low risk: only affects native `Stage::Mesh` shaders (`!runtime_info.mesh_fallback`) on RADV before Mesa 26.2.5, adding a constant-true `OpSelect` on `NumWorkgroups.x != 0` to `OpSetMeshOutputsEXT`'s primitive count. Compute mesh fallback (`mesh_fallback == true`) is untouched. - A player notices nothing by default on RADV (compute fallback remains default); players opting into `RX_VK_MESH_FALLBACK=0` on RADV < 26.2.5 avoid the `RING_GFP_TIMEOUT` hang. - A simple revert removes the workaround cleanly. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. Assisted-by: Antigravity Co-Authored-By: Antigravity <[email protected]>
fix(vk): keep NumWorkgroups live in native mesh shaders for RADV < 26.2.5
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
c4fd9cc36c
Declare spv::BuiltIn::NumWorkgroups on native Stage::Mesh modules
(!runtime_info.mesh_fallback) and gate OpSetMeshOutputsEXT's primitive
count with OpSelect(NumWorkgroups.x != 0, count, 0), following Lichii
#1203 (see #1285). This keeps the load live through NIR dead-code
elimination into ac_nir_lower_ngg_ms so RADV < 26.2.5 reserves the mesh
grid-size registers and avoids invalid SET_SH_REG (reg_count == 0) GPU
hangs on RDNA 3/4.

Adds game-free SPIR-V checks in tests/global_load_16_ir.cpp for both
native and fallback Stage::Mesh modules (validated with spirv-val).

Assisted-by: Antigravity
Co-Authored-By: Antigravity <[email protected]>
Author
Contributor

Tested in game: Fedora 45 Linux, AMD RX 9070 XT (RADV GFX1201, Mesa 26.3.1), Ryzen 5 5600X: ran Longshot with RX_VK_MESH_FALLBACK=0 on kokiri-forest and castle-gate (paired A/B); native mesh shaders translated, validated, and rendered cleanly with no hangs or visual regressions.

Tested in game: Fedora 45 Linux, AMD RX 9070 XT (RADV GFX1201, Mesa 26.3.1), Ryzen 5 5600X: ran Longshot with RX_VK_MESH_FALLBACK=0 on kokiri-forest and castle-gate (paired A/B); native mesh shaders translated, validated, and rendered cleanly with no hangs or visual regressions.
Owner
@review
BeanBot left a comment

Recommendation: Approve. The emitted SPIR-V keeps NumWorkgroups connected to the primitive count, but the workaround has not been tested on the affected RADV versions. Native mesh shaders also change on other drivers, where rendering and performance remain unverified. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

This aims to prevent a GPU hang on older RADV drivers when native mesh shaders are enabled. It adds a workgroup-count load and conditional selection to every native mesh shader; the practical cost and the fix on affected drivers are unmeasured.

Should fix (1): not blocking, but worth doing before merging.

  • L3 tests/global_load_16_ir.cpp:973: The fixture follows the dependency chain but does not verify the comparison value or the selected values. (more on the line) Do: Check that the comparison is against zero and that the true and false operands preserve the original count and zero respectively, or evaluate the emitted expression for representative workgroup counts.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L1 gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_mesh.cpp:497: The claimed hang fix has not been exercised on the affected driver. (more on the line) Do: Reproduce the hang on the base and repeat the same workload on this head with an affected RADV version and native mesh enabled.
  • L2 gpu/vk/eden/shader_recompiler/backend/spirv/spirv_emit_context.cpp:2235: The workaround is emitted for native mesh shaders on all drivers, including drivers that do not need it, without comparative performance or cross-driver results. (more on the line) Do: Run native-mesh rendering smoke tests on the affected Tier 1 Windows and Linux drivers and compare interleaved base/head frame times and 1% lows in representative scenes. (@fix does its part first: Restrict the workaround to affected RADV driver versions so other native-mesh drivers retain their existing shaders.)

@fix can do L2 and L3.

Checks: Still running: 9 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven. The fixture checks the emitted SPIR-V and the RX 9070 XT run rendered cleanly on Mesa 26.3.1, but that driver is newer than the affected versions and the reported run does not reproduce the original hang on the base.

Other systems: Native mesh shaders on Windows and Linux NVIDIA and AMD drivers receive the new instructions; only newer RADV has an in-game result. Compute mesh fallback returns before the changed epilogue and does not declare the new input. Translator changes invalidate the program cache, so shader preparation is also affected.

Switches: None added, changed or removed. The existing RX_VK_MESH_FALLBACK setting was used for testing.

Reviewed: c4fd9cc36c against 0e32bc100d: Read the repository rules, PR template, standards, diff and commit, and inspected the changed files and the surrounding input declaration, mesh epilogue, SPIR-V patching, fixture and cache paths. The large changed source files were not all read in full; no recorded runs, translations or generated files were included in the diff. The sibling Tooling AGENTS.md and docs/review-checklist.md were absent.; nothing run (a code review).

Checked and fine:

  • The native-only declaration and fallback early return agree.
  • The commit includes the required AI-assistance trailers.
  • No game-derived files, generated headers, API changes or switch changes appear in the diff.

Testing: Read-only review; no commands from the project, builds or tests were run. The supplied CI still has checks running.

Overlaps and merge order: Not checked; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The emitted SPIR-V keeps NumWorkgroups connected to the primitive count, but the workaround has not been tested on the affected RADV versions. Native mesh shaders also change on other drivers, where rendering and performance remain unverified. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. This aims to prevent a GPU hang on older RADV drivers when native mesh shaders are enabled. It adds a workgroup-count load and conditional selection to every native mesh shader; the practical cost and the fix on affected drivers are unmeasured. **Should fix (1)**: not blocking, but worth doing before merging. - **L3** `tests/global_load_16_ir.cpp:973`: The fixture follows the dependency chain but does not verify the comparison value or the selected values. (more on the line) **Do:** Check that the comparison is against zero and that the true and false operands preserve the original count and zero respectively, or evaluate the emitted expression for representative workgroup counts. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L1** `gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_mesh.cpp:497`: The claimed hang fix has not been exercised on the affected driver. (more on the line) **Do:** Reproduce the hang on the base and repeat the same workload on this head with an affected RADV version and native mesh enabled. - **L2** `gpu/vk/eden/shader_recompiler/backend/spirv/spirv_emit_context.cpp:2235`: The workaround is emitted for native mesh shaders on all drivers, including drivers that do not need it, without comparative performance or cross-driver results. (more on the line) **Do:** Run native-mesh rendering smoke tests on the affected Tier 1 Windows and Linux drivers and compare interleaved base/head frame times and 1% lows in representative scenes. *(`@fix` does its part first: Restrict the workaround to affected RADV driver versions so other native-mesh drivers retain their existing shaders.)* `@fix` can do L2 and L3. **Checks:** Still running: 9 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven. The fixture checks the emitted SPIR-V and the RX 9070 XT run rendered cleanly on Mesa 26.3.1, but that driver is newer than the affected versions and the reported run does not reproduce the original hang on the base. **Other systems:** Native mesh shaders on Windows and Linux NVIDIA and AMD drivers receive the new instructions; only newer RADV has an in-game result. Compute mesh fallback returns before the changed epilogue and does not declare the new input. Translator changes invalidate the program cache, so shader preparation is also affected. **Switches:** None added, changed or removed. The existing RX_VK_MESH_FALLBACK setting was used for testing. **Reviewed:** c4fd9cc36c21 against 0e32bc100dbe: Read the repository rules, PR template, standards, diff and commit, and inspected the changed files and the surrounding input declaration, mesh epilogue, SPIR-V patching, fixture and cache paths. The large changed source files were not all read in full; no recorded runs, translations or generated files were included in the diff. The sibling Tooling AGENTS.md and docs/review-checklist.md were absent.; nothing run (a code review). **Checked and fine:** - The native-only declaration and fallback early return agree. - The commit includes the required AI-assistance trailers. - No game-derived files, generated headers, API changes or switch changes appear in the diff. **Testing:** Read-only review; no commands from the project, builds or tests were run. The supplied CI still has checks running. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -493,0 +494,4 @@
// (longshot, #1285, as Lichii #1203) keep the NumWorkgroups load live through NIR's dead-code elimination into
// ac_nir_lower_ngg_ms so RADV < 26.2.5 reserves the mesh grid-size registers (NumWorkgroups.x > 0 for every
// launched mesh workgroup)
const Id grid_x{ctx.OpCompositeExtract(ctx.U32[1], ctx.OpLoad(ctx.U32[3], ctx.num_workgroups), 0U)};
Member

L1 (should fix): The claimed hang fix has not been exercised on the affected driver.

When: On RDNA 3 or 4 with RADV Mesa before 26.2.5 and native mesh enabled, the fixture confirms the SPIR-V shape but cannot show whether Mesa retains the load through the relevant lowering or whether the GPU hang is gone.

Do: Reproduce the hang on the base and repeat the same workload on this head with an affected RADV version and native mesh enabled.

**L1** (should fix): The claimed hang fix has not been exercised on the affected driver. *When:* On RDNA 3 or 4 with RADV Mesa before 26.2.5 and native mesh enabled, the fixture confirms the SPIR-V shape but cannot show whether Mesa retains the load through the relevant lowering or whether the GPU hang is gone. **Do:** Reproduce the hang on the base and repeat the same workload on this head with an affected RADV version and native mesh enabled.
@ -2232,6 +2232,12 @@ void EmitContext::DefineInputs(const IR::Program& program) {
if (info.uses_workgroup_id) {
workgroup_id = DefineInput(*this, U32[3], false, spv::BuiltIn::WorkgroupId);
}
if (stage == Stage::Mesh && !runtime_info.mesh_fallback) {
Member

L2 (should fix): The workaround is emitted for native mesh shaders on all drivers, including drivers that do not need it, without comparative performance or cross-driver results.

When: Windows or Linux NVIDIA and Windows AMD native mesh users receive the additional input and selection; their shader compilation, output and frame times can differ from the tested newer RADV driver.

Do: Run native-mesh rendering smoke tests on the affected Tier 1 Windows and Linux drivers and compare interleaved base/head frame times and 1% lows in representative scenes.

**L2** (should fix): The workaround is emitted for native mesh shaders on all drivers, including drivers that do not need it, without comparative performance or cross-driver results. *When:* Windows or Linux NVIDIA and Windows AMD native mesh users receive the additional input and selection; their shader compilation, output and frame times can differ from the tested newer RADV driver. **Do:** Run native-mesh rendering smoke tests on the affected Tier 1 Windows and Linux drivers and compare interleaved base/head frame times and 1% lows in representative scenes.
@ -910,0 +970,4 @@
extract_id = inst.words[1];
if (inst.op == spv::Op::OpINotEqual && inst.words.size() >= 4 &&
extract_id && (inst.words[2] == extract_id || inst.words[3] == extract_id))
cmp_id = inst.words[1];
Member

L3 (should fix): The fixture follows the dependency chain but does not verify the comparison value or the selected values.

When: If the comparison is changed to NumWorkgroups.x != 1, or the select operands are reversed, the test still passes even though a one-workgroup dispatch emits zero primitives.

Do: Check that the comparison is against zero and that the true and false operands preserve the original count and zero respectively, or evaluate the emitted expression for representative workgroup counts.

**L3** (should fix): The fixture follows the dependency chain but does not verify the comparison value or the selected values. *When:* If the comparison is changed to NumWorkgroups.x != 1, or the select operands are reversed, the test still passes even though a one-workgroup dispatch emits zero primitives. **Do:** Check that the comparison is against zero and that the true and false operands preserve the original count and zero respectively, or evaluate the emitted expression for representative workgroup counts.
Owner
@fix
BeanBot force-pushed fix/radv-mesh-num-workgroups from c4fd9cc36c
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to 9b02a207ab
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Failing after 39s
CI / Conventional Commit title (pull_request) Successful in 21s
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Workflow lint (actionlint) (pull_request) Successful in 41s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 38s
Third-party parts / As their notes say (pull_request) Successful in 58s
CI / Website build and checks (pull_request) Failing after 20m1s
2026-11-23 16:03:15 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The workaround is limited to affected RADV versions, but its claimed hang fix has not been exercised on an affected driver. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is 9b02a207ab. I rebased it onto main (6acae6aa87). I edited its description to match the change.

Changed

  • Verify mesh comparison and select operands: The fixture checks comparison against zero and selection of the original primitive count or zero at tests/global_load_16_ir.cpp:973. It was not run.

Changed in part (the rest is for the author)

  • Restrict the mesh workaround to affected RADV versions: Restricted emission to RADV before Mesa 26.2.5 and included the choice in the shader cache stamp at gpu/vk/vk_shader.cpp:720. The author must measure performance and verify native mesh rendering across drivers; nothing was run here.

Nothing was built or run: the checks run again on the new head.

The change keeps NumWorkgroups live in native mesh shaders on older RADV drivers to avoid a GPU hang. The version gate avoids adding the workaround on unaffected drivers, at the cost of another shader profile and cache distinction.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L1 gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_mesh.cpp:497: The claimed hang fix has not been exercised on the affected driver. When: On RDNA 3 or 4 with RADV Mesa before 26.2.5 and native mesh enabled, the fixture confirms the SPIR-V shape but cannot show whether Mesa retains the load through the relevant lowering or whether the GPU hang is gone. Do: Reproduce the hang on the base and repeat the same workload on this head with an affected RADV version and native mesh enabled.

Checks: they run again on this head; a failure shows on the pull request.

Also noticed (3; not asked for, not blocking)
  • The pull request description still says the workaround is emitted for all native mesh shaders; it is now restricted to older RADV versions.
  • The reported Mesa 26.3.1 game run preceded the version gate and does not exercise the workaround at this head.
  • The supplied base diff includes many changes outside the described mesh workaround.
More: does it help, other systems, switches, what was read

Does it help: Unproven: the reported RX 9070 XT run used Mesa 26.3.1, which is newer than the affected range and now bypasses the workaround. No affected-driver result is reported.

Other systems: The profile gate leaves other drivers and newer RADV versions on the original shader path; compute mesh fallback also bypasses the workaround. The shader cache stamp includes the gate so cached translations are distinguished.

Switches: None added, changed or removed. RX_VK_MESH_FALLBACK remains an existing override; RADV retains its compute-fallback default.

Reviewed: 9b02a207ab against 6acae6aa87: Read AGENTS.md, CONTRIBUTING.md and the pull request template in full. Read the fix diff, the relevant shader emission, driver detection, profile and cache-stamp code, and the fixture changes; the broader base diff and changed files were not read in full.; nothing run (a code review).

Checked and fine:

  • The native mesh epilogue uses the declared input only when the workaround is enabled.
  • The fixture checks the comparison and select operands and covers the unaffected native and fallback cases.
  • The fix retains the workaround for RADV versions before Mesa 26.2.5.

Testing: No commands that build or run the project were executed. The affected-driver run remains outstanding; CI has not run on this head.

Overlaps and merge order: Not established; the supplied base diff contains earlier changes beyond this pull request's stated topic.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The workaround is limited to affected RADV versions, but its claimed hang fix has not been exercised on an affected driver. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is 9b02a207ab5f. I rebased it onto `main` (6acae6aa8752). I edited its description to match the change. **Changed** - **Verify mesh comparison and select operands**: The fixture checks comparison against zero and selection of the original primitive count or zero at tests/global_load_16_ir.cpp:973. It was not run. **Changed in part (the rest is for the author)** - **Restrict the mesh workaround to affected RADV versions**: Restricted emission to RADV before Mesa 26.2.5 and included the choice in the shader cache stamp at gpu/vk/vk_shader.cpp:720. The author must measure performance and verify native mesh rendering across drivers; nothing was run here. Nothing was built or run: the checks run again on the new head. The change keeps NumWorkgroups live in native mesh shaders on older RADV drivers to avoid a GPU hang. The version gate avoids adding the workaround on unaffected drivers, at the cost of another shader profile and cache distinction. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L1** `gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_mesh.cpp:497`: The claimed hang fix has not been exercised on the affected driver. *When:* On RDNA 3 or 4 with RADV Mesa before 26.2.5 and native mesh enabled, the fixture confirms the SPIR-V shape but cannot show whether Mesa retains the load through the relevant lowering or whether the GPU hang is gone. **Do:** Reproduce the hang on the base and repeat the same workload on this head with an affected RADV version and native mesh enabled. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>Also noticed (3; not asked for, not blocking)</summary> - The pull request description still says the workaround is emitted for all native mesh shaders; it is now restricted to older RADV versions. - The reported Mesa 26.3.1 game run preceded the version gate and does not exercise the workaround at this head. - The supplied base diff includes many changes outside the described mesh workaround. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the reported RX 9070 XT run used Mesa 26.3.1, which is newer than the affected range and now bypasses the workaround. No affected-driver result is reported. **Other systems:** The profile gate leaves other drivers and newer RADV versions on the original shader path; compute mesh fallback also bypasses the workaround. The shader cache stamp includes the gate so cached translations are distinguished. **Switches:** None added, changed or removed. RX_VK_MESH_FALLBACK remains an existing override; RADV retains its compute-fallback default. **Reviewed:** 9b02a207ab5f against 6acae6aa8752: Read AGENTS.md, CONTRIBUTING.md and the pull request template in full. Read the fix diff, the relevant shader emission, driver detection, profile and cache-stamp code, and the fixture changes; the broader base diff and changed files were not read in full.; nothing run (a code review). **Checked and fine:** - The native mesh epilogue uses the declared input only when the workaround is enabled. - The fixture checks the comparison and select operands and covers the unaffected native and fallback cases. - The fix retains the workaround for RADV versions before Mesa 26.2.5. **Testing:** No commands that build or run the project were executed. The affected-driver run remains outstanding; CI has not run on this head. **Overlaps and merge order:** Not established; the supplied base diff contains earlier changes beyond this pull request's stated topic. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch fix/radv-mesh-num-workgroups 2026-11-23 16:07:27 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2338
No description provided.