perf(vk): defaults of its own for Mesa's Intel driver, 8.3 to 18.2 fps on an Iris Xe #1586

Open
Tomiss wants to merge 10 commits from Tomiss/Longshot:perf/intel-xe-mesh-fallback into main
Contributor

Type: perf · Risk: medium · Tested on: Linux (Bazzite), Intel Iris Xe, Mesa 26.2.7 · Needs: Linux, another Mesa Intel GPU (Arc or Xe); Windows, Intel

TL;DR

On Intel GPUs under Linux (Mesa's Intel driver) the game ran at a slideshow and drew a green wall over the rocks on
Death Mountain Trail, because the renderer gave that driver defaults made for other GPUs and drivers. This PR gives
Mesa's Intel driver defaults of its own: a mesh fallback built for its hardware, and the game's own depth test. On an
Iris Xe on Death Mountain Trail the game went from 8.3 to 18.2 fps against main, and the rocks are drawn; game-free
checks cover each change.

Breakdown

  • Who it helps: players on Intel GPUs under Linux (Mesa's Intel driver), mainly laptops' integrated graphics.
  • What was wrong: Mesa's Intel driver got defaults tuned for other drivers: a mesh fallback that spilled registers
    and starved for workgroup memory on its hardware, and a depth margin meant for Intel's Windows driver.
  • What changes: on Mesa's Intel driver the mesh fallback reads memory through the page table, keeps its attributes
    in device memory and runs its warp at 8 lanes, and the game's EQUAL depth test is kept as the game asks.
  • What does not change: every other driver and GPU (NVIDIA, AMD, Intel on Windows) builds the same shaders and draws
    as before; every new default has a switch.
  • How it was checked: game-free checks; on an Iris Xe on Death Mountain Trail, 8.3 -> 18.2 fps against main over
    three interleaved rounds, and the green wall gone.
  • What is still open: another Mesa Intel GPU (Arc, other Xe); Intel on Windows, to confirm nothing changes there.
  • Risk: medium: the shared warp replaces subgroup instructions with workgroup memory, so a wrong answer would show as
    broken geometry on Mesa's Intel driver only; each default has a switch.

Why

On an Iris Xe under Linux the game is barely playable: about 8 fps on Death Mountain Trail, and a flat sage-green wall
with vertical streaks stands over the canyon's rocks there. Both come from defaults that don't suit Mesa's Intel driver.

The Iris Xe has no mesh shaders, so the game's mesh programs run as compute stages (the mesh fallback), which were 70%
of the frame at Hyrule Castle. On this hardware they spilled: every guest global load searched the program's storage
buffers inline; each mesh workgroup kept 8-17 KB of attributes in workgroup memory, which Intel hands out in 16 or 32 KB
steps, so few workgroups ran at once; and any stage with a ballot, vote or shuffle was held to 32 lanes, where a lane
gets the fewest registers.

The renderer also gave every Intel GPU the equal-depth margin made for Intel's Windows driver (#17, an Arc B390). It
turns the game's EQUAL depth test into LESS_OR_EQUAL with a bias, which lets terrain draw over the canyon's rock where
the depth pass drew none. Mesa's compiler keeps EQUAL exact, so it needs no margin.

See #17.

How to reproduce

Seen on: Linux (Bazzite, kernel 7.3.4), Intel Iris Xe (RPL-P), Mesa 26.2.7
Settings and switches: defaults
Steps: load a save on Death Mountain Trail, the Kakariko side, and look up the canyon
Expected: the canyon's rocks, at a playable frame rate
Actual: about 8 fps, and a green streaked wall over the rocks

What changed

Mesa's Intel driver gets defaults of its own in the renderer's device policy and the shader translator: the mesh
fallback's stages built for its hardware, and no equal-depth margin. Each is in the translator stamp where it changes
the SPIR-V, and has a switch.

  • translator, page table: define_load in spirv_emit_context.cpp reads a task/mesh fallback stage's global loads
    through the guest page table, branch-free (RX_VK_MESH_PAGES); stores and atomics keep the search.
  • translator + host, attribute pool: mesh workgroups take a slot of a pool after the records (LoadAttribute /
    StoreAttribute accessors in emit_spirv_mesh.cpp; the pool and its header clear in vk_draw.cpp, before the
    draw's stages with a barrier between) (RX_VK_MESH_GLOBAL_ATTRS).
  • translator, shared warp: emit_spirv_warp.cpp (PlanSharedWarp and the shared ballot/vote/shuffle sites) keeps a
    fallback stage's warp in workgroup memory; gpu/vk/fallback_lanes.h recognises such a stage from its SPIR-V and the
    renderer runs it at RX_VK_MESH_LANES (8) (RX_VK_MESH_SHARED_WARP, RX_VK_MESH_SHARED_WARP_CHECK for developers).
  • the Soa records' writer reads the attribute region through LoadAttribute (main's #906 made Soa the default); the
    stamp bits of the four switches sit clear of the software multiplies' form.
  • device policy: equal_depth_bias in gpu/vk/device_policy.h defaults to 64 for
    VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS only, 0 elsewhere (RX_VK_EQ_BIAS still sets it on any GPU).
  • tests: test_mesh_fallback_pages.py, test_mesh_fallback_global_attrs.py, test_mesh_fallback_shared_warp.py,
    test_fallback_lanes.py/.cpp, and the device policy check's ANV PC expecting no margin.

Measurements

Verdict: it helps: 8.3 -> 18.2 fps (+119%) on an Iris Xe on Death Mountain Trail against main, in three interleaved rounds, at a lower GPU clock; the picture the same.

Hardware: Bazzite (Fedora 45, kernel 7.3.4), Intel Iris Xe Graphics (RPL-P, integrated), Mesa 26.2.7 ANV (no mesh shaders), Intel Core i9-13900H, 32 GB
Scene: Death Mountain Trail above Kakariko, from a save, standing still; headless (offscreen 1920x1080), my options file (Custom, handheld profile, upscaler off, no frame rate cap)
Method: one base at main 7daafa7a (scripts/dev_build.py base), this PR's renderer as a pack over it, and the base alone; shaders compiled in play (RX_VK_PRECOMPILE=0); three interleaved rounds (main, then this PR), each a job_queue.py --mode timing job, the first round a warm-up; 90 s standing after the load, the median of the last eight presents, N fps reports of each run; GPU clock and power-limit flag logged each second from sysfs
How to reproduce: the two runtimes from scripts/dev_build.py rt and rt --empty, a save on Death Mountain Trail, HOS_HEADLESS=1 RX_VK_PRECOMPILE=0, stand still 90 s

Measured before the rebase onto main 430eef4f (no conflict): c3c9b0ee is this PR's 994e6647. The numbers hold on 430eef4f: #1567 changes only which compute pipelines the shader preparation warms (prepare_run, precompile_warm, computes_plan in vk_draw.cpp), and these runs had no preparation (RX_VK_PRECOMPILE=0); on Mesa's Intel driver its default was already the listed computes.

Before: main @ 7daafa7a After: this PR @ c3c9b0ee
fps, round 1 (warm-up) 8.3 18.2
fps, round 2 8.2 18.1
fps, round 3 8.3 18.3
median 8.3 18.2
GPU clock 1495-1500 MHz, power limit 0-7% of the run 1210-1214 MHz, power limit 100% of the run
draws a frame 973-974 932-965
kak-main-1     median fps   8.3  last8 8.5 8.2 8.2 8.2 8.3 8.3 8.3 8.3  draws 974  1495 MHz  PL1   7%
kak-branch-1   median fps  18.2  last8 18.2 18.2 18.2 18.2 18.1 18.2 18.2 18.0  draws 961  1214 MHz  PL1 100%
kak-main-2     median fps   8.2  last8 8.3 8.2 8.1 8.3 8.2 8.3 8.0 8.3  draws 973  1498 MHz  PL1   0%
kak-branch-2   median fps  18.1  last8 18.1 18.1 18.0 18.2 18.2 18.2 18.1 18.1  draws 932  1210 MHz  PL1 100%
kak-main-3     median fps   8.3  last8 8.2 8.3 8.3 8.3 8.3 8.3 8.3 8.4  draws 974  1500 MHz  PL1   0%
kak-branch-3   median fps  18.3  last8 18.2 18.3 18.1 18.3 18.3 18.4 18.3 18.4  draws 965  1212 MHz  PL1 100%

The run file: docs/tested/2026-11-18-intel-xe-mesh-fallback-thomas-montano-run01.md. Earlier, per part, at Hyrule Castle on the same PC (commit messages, docs/tested/2026-11-14-*): the page table 8.4 -> 11.5 fps; the attribute pool ~9.9 -> ~11.7 fps; the shared warp at 8 lanes +26% against it off.

Screenshots (the same spot, the same present count):

Before: main @ 7daafa7a, Death Mountain Trail: the green wall over the canyon
After: this PR @ c3c9b0ee, Death Mountain Trail: the rocks drawn
Before: main @ 7daafa7a, above Kakariko, present 6840
After: this PR @ c3c9b0ee, above Kakariko, present 6840

Flags and settings

Five new switches, all on by default on Mesa's Intel driver only, and one default changed.

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
RX_VK_MESH_PAGES fallback loads through the guest page table — 1 on Mesa Intel, 0 elsewhere 739acd67 12.3 -> 5.7 ms a frame helps on Iris Xe; untested elsewhere on for Mesa Intel
RX_VK_MESH_GLOBAL_ATTRS attribute regions in a device-memory pool — 1 on Mesa Intel, 0 elsewhere fallback dispatches 32.5 -> 24.4 ms a frame helps on Iris Xe; untested elsewhere on for Mesa Intel
RX_VK_MESH_SHARED_WARP warp operations through workgroup memory — 1 on Mesa Intel, 0 elsewhere lets the stages run below 32 lanes helps on Iris Xe (with LANES=8) on for Mesa Intel
RX_VK_MESH_LANES lane count for shared-warp stages — 8 on Mesa Intel +26% fps against off, 16 lanes in between helps on Iris Xe 8 on Mesa Intel
RX_VK_MESH_SHARED_WARP_CHECK compares each shared answer with the subgroup's — 0 developer check: 763M answers, 0 different — off: only for testing
RX_VK_EQ_BIAS equal-depth margin 64 on every Intel GPU 64 on Intel's Windows driver, 0 elsewhere no green wall on Death Mountain Trail on Mesa Intel helps on Mesa Intel; Windows unchanged as shipped

Testing

Tested: on this PC (Bazzite, kernel 7.3.4, Iris Xe, Mesa 26.2.7), this PR's renderer at c3c9b0ee on a base at main 7daafa7a:

  • Death Mountain Trail, the Kakariko side, from a save (How to reproduce): on main the sage-green streaked wall stands over the canyon's rocks (equal_depth_bias=64 in the policy line); with this PR it is gone and the rocks are drawn (equal_depth_bias=0).
  • Death Mountain Trail above Kakariko: three interleaved rounds against main (Measurements); screenshots at the same present count alike, no broken or missing geometry, no shared-warp wait given up in the log.
  • After the rebase onto 430eef4f, run_all.py --changed: 219 passed, 18 failed, all 18 among the failures below that fail on main too.
  • python -I -B tests/run_all.py: 680 passed, 54 failed, 50 skipped. 53 of the 54 fail on main 7daafa7a too, rerun there one by one (among them test_switch_table, for main's HOS_NFP_*, HOS_SWITCH2*, HOS_VSYNC_YIELD, LONGSHOT_NFC_DIR, RX_VK_INVALIDATE_*; none of this PR's switches). The 54th, test_link_skip, failed under the full run's load (two real-link cases) and passes alone here and on main; this PR changes no build script.

Not tested: other Mesa Intel GPUs (Arc, other Xe generations) and Intel's Windows driver: I have only this Iris Xe
under Linux. Other drivers take none of the new paths (their SPIR-V and stamps are as on main, checked by the tests).

Must be tested:

  • Linux, an Intel Arc or another Xe GPU on Mesa (Test Farm: linux, intel): Hyrule Castle and Kakariko standing still,
    expecting no broken or missing geometry and fps at or above main's (@Beanstalk Linux Intel Arc on Mesa: Hyrule Castle and Kakariko, screenshots and fps against main).
  • Windows, Intel (Test Farm: windows, intel): the ground near the Death Mountain gate and in Kakariko, expecting no holes
    (the margin is unchanged there).

Risks

What could break: on Mesa's Intel driver only: a shared-warp answer that differs from the subgroup's would show as
broken or missing geometry; a pool slot wait that gives up is counted and logged. The depth margin's change could bring
back holes in the ground on a Mesa Intel GPU where EQUAL doesn't hold.

Turning it off: RX_VK_MESH_PAGES=0, RX_VK_MESH_GLOBAL_ATTRS=0, RX_VK_MESH_SHARED_WARP=0, RX_VK_EQ_BIAS=64.

Compatibility: MKWVK_API_VERSION unchanged; nothing else changes for a player.

Issues

See #17

Related open PRs that touch the mesh fallback: #1556 (where stages are pinned to 32 lanes), #1531 and #1561 (the fallback's record layout).

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named). — 53 fail on main too (Testing); test_link_skip flaked under load and passes alone.
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported.
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value.
  • A file in docs/tested/ for each new measured run (format in docs/tested-configurations.md).
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.

🤖 Generated with Claude Code

**Type:** perf · **Risk:** medium · **Tested on:** Linux (Bazzite), Intel Iris Xe, Mesa 26.2.7 · **Needs:** Linux, another Mesa Intel GPU (Arc or Xe); Windows, Intel ## TL;DR On Intel GPUs under Linux (Mesa's Intel driver) the game ran at a slideshow and drew a green wall over the rocks on Death Mountain Trail, because the renderer gave that driver defaults made for other GPUs and drivers. This PR gives Mesa's Intel driver defaults of its own: a mesh fallback built for its hardware, and the game's own depth test. On an Iris Xe on Death Mountain Trail the game went from 8.3 to 18.2 fps against main, and the rocks are drawn; game-free checks cover each change. ## Breakdown - **Who it helps:** players on Intel GPUs under Linux (Mesa's Intel driver), mainly laptops' integrated graphics. - **What was wrong:** Mesa's Intel driver got defaults tuned for other drivers: a mesh fallback that spilled registers and starved for workgroup memory on its hardware, and a depth margin meant for Intel's Windows driver. - **What changes:** on Mesa's Intel driver the mesh fallback reads memory through the page table, keeps its attributes in device memory and runs its warp at 8 lanes, and the game's EQUAL depth test is kept as the game asks. - **What does not change:** every other driver and GPU (NVIDIA, AMD, Intel on Windows) builds the same shaders and draws as before; every new default has a switch. - **How it was checked:** game-free checks; on an Iris Xe on Death Mountain Trail, 8.3 -> 18.2 fps against main over three interleaved rounds, and the green wall gone. - **What is still open:** another Mesa Intel GPU (Arc, other Xe); Intel on Windows, to confirm nothing changes there. - **Risk:** medium: the shared warp replaces subgroup instructions with workgroup memory, so a wrong answer would show as broken geometry on Mesa's Intel driver only; each default has a switch. ## Why On an Iris Xe under Linux the game is barely playable: about 8 fps on Death Mountain Trail, and a flat sage-green wall with vertical streaks stands over the canyon's rocks there. Both come from defaults that don't suit Mesa's Intel driver. The Iris Xe has no mesh shaders, so the game's mesh programs run as compute stages (the mesh fallback), which were 70% of the frame at Hyrule Castle. On this hardware they spilled: every guest global load searched the program's storage buffers inline; each mesh workgroup kept 8-17 KB of attributes in workgroup memory, which Intel hands out in 16 or 32 KB steps, so few workgroups ran at once; and any stage with a ballot, vote or shuffle was held to 32 lanes, where a lane gets the fewest registers. The renderer also gave every Intel GPU the equal-depth margin made for Intel's Windows driver (#17, an Arc B390). It turns the game's EQUAL depth test into LESS_OR_EQUAL with a bias, which lets terrain draw over the canyon's rock where the depth pass drew none. Mesa's compiler keeps EQUAL exact, so it needs no margin. See #17. ## How to reproduce **Seen on:** Linux (Bazzite, kernel 7.3.4), Intel Iris Xe (RPL-P), Mesa 26.2.7 **Settings and switches:** defaults **Steps:** load a save on Death Mountain Trail, the Kakariko side, and look up the canyon **Expected:** the canyon's rocks, at a playable frame rate **Actual:** about 8 fps, and a green streaked wall over the rocks ## What changed Mesa's Intel driver gets defaults of its own in the renderer's device policy and the shader translator: the mesh fallback's stages built for its hardware, and no equal-depth margin. Each is in the translator stamp where it changes the SPIR-V, and has a switch. - translator, page table: `define_load` in `spirv_emit_context.cpp` reads a task/mesh fallback stage's global loads through the guest page table, branch-free (`RX_VK_MESH_PAGES`); stores and atomics keep the search. - translator + host, attribute pool: mesh workgroups take a slot of a pool after the records (`LoadAttribute` / `StoreAttribute` accessors in `emit_spirv_mesh.cpp`; the pool and its header clear in `vk_draw.cpp`, before the draw's stages with a barrier between) (`RX_VK_MESH_GLOBAL_ATTRS`). - translator, shared warp: `emit_spirv_warp.cpp` (`PlanSharedWarp` and the shared ballot/vote/shuffle sites) keeps a fallback stage's warp in workgroup memory; `gpu/vk/fallback_lanes.h` recognises such a stage from its SPIR-V and the renderer runs it at `RX_VK_MESH_LANES` (8) (`RX_VK_MESH_SHARED_WARP`, `RX_VK_MESH_SHARED_WARP_CHECK` for developers). - the Soa records' writer reads the attribute region through `LoadAttribute` (main's #906 made Soa the default); the stamp bits of the four switches sit clear of the software multiplies' form. - device policy: `equal_depth_bias` in `gpu/vk/device_policy.h` defaults to 64 for `VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS` only, 0 elsewhere (`RX_VK_EQ_BIAS` still sets it on any GPU). - tests: `test_mesh_fallback_pages.py`, `test_mesh_fallback_global_attrs.py`, `test_mesh_fallback_shared_warp.py`, `test_fallback_lanes.py`/`.cpp`, and the device policy check's ANV PC expecting no margin. ## Measurements **Verdict:** it helps: 8.3 -> 18.2 fps (+119%) on an Iris Xe on Death Mountain Trail against main, in three interleaved rounds, at a lower GPU clock; the picture the same. Hardware: Bazzite (Fedora 45, kernel 7.3.4), Intel Iris Xe Graphics (RPL-P, integrated), Mesa 26.2.7 ANV (no mesh shaders), Intel Core i9-13900H, 32 GB Scene: Death Mountain Trail above Kakariko, from a save, standing still; headless (offscreen 1920x1080), my options file (Custom, handheld profile, upscaler off, no frame rate cap) Method: one base at main 7daafa7a (`scripts/dev_build.py base`), this PR's renderer as a pack over it, and the base alone; shaders compiled in play (`RX_VK_PRECOMPILE=0`); three interleaved rounds (main, then this PR), each a `job_queue.py --mode timing` job, the first round a warm-up; 90 s standing after the load, the median of the last eight `presents, N fps` reports of each run; GPU clock and power-limit flag logged each second from sysfs How to reproduce: the two runtimes from `scripts/dev_build.py rt` and `rt --empty`, a save on Death Mountain Trail, `HOS_HEADLESS=1 RX_VK_PRECOMPILE=0`, stand still 90 s Measured before the rebase onto main 430eef4f (no conflict): c3c9b0ee is this PR's 994e6647. The numbers hold on 430eef4f: #1567 changes only which compute pipelines the shader preparation warms (`prepare_run`, `precompile_warm`, `computes_plan` in `vk_draw.cpp`), and these runs had no preparation (`RX_VK_PRECOMPILE=0`); on Mesa's Intel driver its default was already the listed computes. | | Before: main @ 7daafa7a | After: this PR @ c3c9b0ee | |---|---|---| | fps, round 1 (warm-up) | 8.3 | 18.2 | | fps, round 2 | 8.2 | 18.1 | | fps, round 3 | 8.3 | 18.3 | | **median** | **8.3** | **18.2** | | GPU clock | 1495-1500 MHz, power limit 0-7% of the run | 1210-1214 MHz, power limit 100% of the run | | draws a frame | 973-974 | 932-965 | ``` kak-main-1 median fps 8.3 last8 8.5 8.2 8.2 8.2 8.3 8.3 8.3 8.3 draws 974 1495 MHz PL1 7% kak-branch-1 median fps 18.2 last8 18.2 18.2 18.2 18.2 18.1 18.2 18.2 18.0 draws 961 1214 MHz PL1 100% kak-main-2 median fps 8.2 last8 8.3 8.2 8.1 8.3 8.2 8.3 8.0 8.3 draws 973 1498 MHz PL1 0% kak-branch-2 median fps 18.1 last8 18.1 18.1 18.0 18.2 18.2 18.2 18.1 18.1 draws 932 1210 MHz PL1 100% kak-main-3 median fps 8.3 last8 8.2 8.3 8.3 8.3 8.3 8.3 8.3 8.4 draws 974 1500 MHz PL1 0% kak-branch-3 median fps 18.3 last8 18.2 18.3 18.1 18.3 18.3 18.4 18.3 18.4 draws 965 1212 MHz PL1 100% ``` The run file: `docs/tested/2026-11-18-intel-xe-mesh-fallback-thomas-montano-run01.md`. Earlier, per part, at Hyrule Castle on the same PC (commit messages, `docs/tested/2026-11-14-*`): the page table 8.4 -> 11.5 fps; the attribute pool ~9.9 -> ~11.7 fps; the shared warp at 8 lanes +26% against it off. Screenshots (the same spot, the same present count): ![Before: main @ 7daafa7a, Death Mountain Trail: the green wall over the canyon](https://git.magicbean.dev/attachments/76aa325d-74d8-4661-8ec9-c92e7c6ad545) ![After: this PR @ c3c9b0ee, Death Mountain Trail: the rocks drawn](https://git.magicbean.dev/attachments/f987225b-3dd1-4567-8a0c-525fdf604f8d) ![Before: main @ 7daafa7a, above Kakariko, present 6840](https://git.magicbean.dev/attachments/22a5e385-e96c-4430-a511-d06861a4061f) ![After: this PR @ c3c9b0ee, above Kakariko, present 6840](https://git.magicbean.dev/attachments/29e1dbcb-505d-42c2-bcd4-f448c013e61f) ### Flags and settings Five new switches, all on by default on Mesa's Intel driver only, and one default changed. | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | `RX_VK_MESH_PAGES` | fallback loads through the guest page table | — | 1 on Mesa Intel, 0 elsewhere | 739acd67 12.3 -> 5.7 ms a frame | helps on Iris Xe; untested elsewhere | on for Mesa Intel | | `RX_VK_MESH_GLOBAL_ATTRS` | attribute regions in a device-memory pool | — | 1 on Mesa Intel, 0 elsewhere | fallback dispatches 32.5 -> 24.4 ms a frame | helps on Iris Xe; untested elsewhere | on for Mesa Intel | | `RX_VK_MESH_SHARED_WARP` | warp operations through workgroup memory | — | 1 on Mesa Intel, 0 elsewhere | lets the stages run below 32 lanes | helps on Iris Xe (with LANES=8) | on for Mesa Intel | | `RX_VK_MESH_LANES` | lane count for shared-warp stages | — | 8 on Mesa Intel | +26% fps against off, 16 lanes in between | helps on Iris Xe | 8 on Mesa Intel | | `RX_VK_MESH_SHARED_WARP_CHECK` | compares each shared answer with the subgroup's | — | 0 | developer check: 763M answers, 0 different | — | off: only for testing | | `RX_VK_EQ_BIAS` | equal-depth margin | 64 on every Intel GPU | 64 on Intel's Windows driver, 0 elsewhere | no green wall on Death Mountain Trail on Mesa Intel | helps on Mesa Intel; Windows unchanged | as shipped | ## Testing **Tested:** on this PC (Bazzite, kernel 7.3.4, Iris Xe, Mesa 26.2.7), this PR's renderer at c3c9b0ee on a base at main 7daafa7a: - Death Mountain Trail, the Kakariko side, from a save (How to reproduce): on main the sage-green streaked wall stands over the canyon's rocks (`equal_depth_bias=64` in the policy line); with this PR it is gone and the rocks are drawn (`equal_depth_bias=0`). - Death Mountain Trail above Kakariko: three interleaved rounds against main (Measurements); screenshots at the same present count alike, no broken or missing geometry, no shared-warp wait given up in the log. - After the rebase onto 430eef4f, `run_all.py --changed`: 219 passed, 18 failed, all 18 among the failures below that fail on main too. - `python -I -B tests/run_all.py`: 680 passed, 54 failed, 50 skipped. 53 of the 54 fail on main 7daafa7a too, rerun there one by one (among them `test_switch_table`, for main's `HOS_NFP_*`, `HOS_SWITCH2*`, `HOS_VSYNC_YIELD`, `LONGSHOT_NFC_DIR`, `RX_VK_INVALIDATE_*`; none of this PR's switches). The 54th, `test_link_skip`, failed under the full run's load (two real-link cases) and passes alone here and on main; this PR changes no build script. **Not tested:** other Mesa Intel GPUs (Arc, other Xe generations) and Intel's Windows driver: I have only this Iris Xe under Linux. Other drivers take none of the new paths (their SPIR-V and stamps are as on main, checked by the tests). **Must be tested:** - Linux, an Intel Arc or another Xe GPU on Mesa (Test Farm: linux, intel): Hyrule Castle and Kakariko standing still, expecting no broken or missing geometry and fps at or above main's (@Beanstalk Linux Intel Arc on Mesa: Hyrule Castle and Kakariko, screenshots and fps against main). - Windows, Intel (Test Farm: windows, intel): the ground near the Death Mountain gate and in Kakariko, expecting no holes (the margin is unchanged there). ## Risks **What could break:** on Mesa's Intel driver only: a shared-warp answer that differs from the subgroup's would show as broken or missing geometry; a pool slot wait that gives up is counted and logged. The depth margin's change could bring back holes in the ground on a Mesa Intel GPU where EQUAL doesn't hold. **Turning it off:** `RX_VK_MESH_PAGES=0`, `RX_VK_MESH_GLOBAL_ATTRS=0`, `RX_VK_MESH_SHARED_WARP=0`, `RX_VK_EQ_BIAS=64`. **Compatibility:** `MKWVK_API_VERSION` unchanged; nothing else changes for a player. ## Issues See #17 Related open PRs that touch the mesh fallback: #1556 (where stages are pinned to 32 lanes), #1531 and #1561 (the fallback's record layout). ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). — 53 fail on main too (Testing); `test_link_skip` flaked under load and passes alone. - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported. - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [x] A file in `docs/tested/` for each new measured run (format in `docs/tested-configurations.md`). - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On an Iris Xe, 70% of a frame at Hyrule Castle was the mesh fallback's compute dispatches, and twelve colour mesh
programs were 79 of its 116 ms. Their cost was the translator's lookup of each guest global load: inlined at every
load, it searched the program's four storage buffers and three table entries, and the stages, held to 32 lanes and at
the register file's limit, filled with spill code. 739acd67 alone: 97k instructions and 10k fills (Mesa's statistics);
with each lookup reduced to a bare load, 25k.

The fallback's task and mesh stages now read a load through the guest page table, branch-free, as the console's GPU
reads memory: one word of the table and the load, 0 where no page is mapped. Stores and atomics keep the search. Every
storage buffer bound below 1 TB is in a pool the table maps; a virtual pool's (from 1 TB) is not, and reads 0.

Measured on 739acd67 at Hyrule Castle, its stage swapped in alone: 12.3 ms a frame before, 5.7 ms after; its 243
million loads compared against the search, none different (a counting variant of the stage, not committed). The whole
frame is not measured yet.

On by default on Mesa's Intel driver (RX_VK_MESH_PAGES=0 or 1 over it), in the translator stamp.
tests/test_mesh_fallback_pages.py checks the switch, the stamp, and the lookup against the table vk_memory.cpp writes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two runs of perf/intel-xe-mesh-fallback 0cd7d782, interleaved with four of the installed build in a copy of the same
game folder: 12.0-12.1 and 10.7-11.2 fps (GPU 74-84 ms a frame) against 7.0-8.5 fps (GPU 109-121 ms).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On an Iris Xe the fallback's colour mesh stages were held back by their workgroup memory, not their code. A mesh workgroup
kept its stage buffer's attribute region there (8 to 17 KB at Hyrule Castle, 9.4 to 18.5 KB with the map), and Intel gives
workgroup memory in powers of two: 16 or 32 KB each, so few workgroups ran on a subslice at once and nothing hid the
stages' spill traffic. 739acd67 took 3.6-4.4 ms a frame; given 8 KB more workgroup memory, the same code took 7.4 ms; with
its region in device memory, 1.9 ms.

Each mesh workgroup now takes a slot of a pool after the records, in the records buffer: thread 0 takes a ticket from the
pool's counter and waits, bounded, until the slot's holder a pool's length of tickets before has handed it on (in a
function of its own: the prologue's block must not branch); the region is read and written there, the barriers make its
writes seen across the workgroup, and the epilogue hands the slot on. The host clears the pool's header with the records'
header before each draw. 1024 slots of up to 32 KB (~32 MB a recording thread); a larger region stays in workgroup memory.

Measured at Hyrule Castle, three interleaved pairs: 9.0-10.7, 7.9-9.4, 8.9-9.9 fps with the regions in workgroup memory,
10.6-11.8, 11.6-11.8, 11.7-11.8 fps in the pool (GPU 78-105 against 76-81 ms a frame); the fallback's dispatches 32.5 ->
24.4 ms a frame profiled. The PC ran hot throughout. Screenshots the same; every translated mesh stage passes spirv-val.

On by default on Mesa's Intel driver (RX_VK_MESH_GLOBAL_ATTRS=0 or 1 over it), in the translator stamp; with it off the
SPIR-V is as before. tests/test_mesh_fallback_global_attrs.py checks the switch, the stamp, the pool's layout, that every
access to the region goes through the accessors, the claim and the hand-back, and the host's pool;
test_fallback_buffer_cleanup gains a case for the pool. Sirit's OpAtomicStore is emitted a word too long, so the hand-back
is an exchange.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pool's header (ticket counter and slot words) was cleared after the task and mesh dispatches with no barrier between
them, so the clear could land while the mesh stage was still taking and handing back slots. It is now cleared with the
records' header, between the barrier after the draw before and the one before this draw's stages.
test_mesh_fallback_global_attrs checks the clear comes before the first stage with a barrier between.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
NVN's mesh programs are written for 32-lane warps, so every mesh fallback stage with a ballot, vote or shuffle was held
to 32 lanes. On an Iris Xe that leaves a lane the fewest registers, and Hyrule Castle's colour mesh stages spent most of
their time spilling (d8e59341: 843k cycles a workgroup at 32 lanes by Mesa's count, 4 x 70k at 8).

RX_VK_MESH_SHARED_WARP (on by default on Mesa's Intel driver): a fallback stage's warp is its 32-thread workgroup, and
its ballots, votes, shuffles, lane id and lane masks go through words of workgroup memory (emit_spirv_warp.cpp). An if
with a warp operation inside is a region: its lanes are known before any goes in, and a site waits (bounded) only for
the lanes of its region it reads. PlanSharedWarp takes only stages it can do this for: one-row 32-thread workgroups, no
warp operation in a loop, no return inside an if, no quad or matrix operation, subgroup barrier or read of the stage's
outputs. Such a stage declares no subgroup capability or input, and fallback_lanes.h tells it from its SPIR-V; the
renderer runs it at RX_VK_MESH_LANES (8 by default on Mesa's Intel driver). Waits that give up are counted past the
records and logged. RX_VK_MESH_SHARED_WARP_CHECK=1 computes each answer both ways and counts the differences.

Hyrule Castle, Iris Xe, Mesa 26.2.4, four interleaved rounds (the first of each arm compiling, rounds 2-4 below),
another process holding a steady ~55% of the GPU through all of them: the shared warp off 6.40 / 6.40 / 6.40 fps,
16 lanes 7.50 / 7.35 / 7.55, 8 lanes 8.05 / 8.05 / 8.10 (+26%). Screenshots at the floor of two runs of the same
setting. The check: 763M answers compared, 0 different, 0 waits gave up; all 53 task and mesh stages the scene
translated pass spirv-val.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two things main brought in since the branch began, which the rebase onto it met:

- #906 made the Soa records layout the default, and its writer (WriteFallbackLines) read the attribute region from workgroup
  memory directly. With RX_VK_MESH_GLOBAL_ATTRS the region is in the workgroup's pool slot, so every fallback draw on Mesa's
  Intel driver would have copied whatever workgroup memory held. It now reads through LoadAttribute, as the Aos loop does;
  test_mesh_fallback_global_attrs caught it.
- The software multiplies' form takes bits 256 and 512 of the translator stamp's flags (mma_software_form << 8) and 1024 its
  quad form: the mesh fallback's four switches move to 2048-16384, and their stamp checks now also refuse a bit a shifted
  field takes, which the `? Nu : 0u` count alone did not see.

test_mesh_fallback_pages reads the page windows from page_table_census.h kPageWindows, where vk_memory.cpp now takes them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RX_VK_MESH_PAGES, RX_VK_MESH_GLOBAL_ATTRS, RX_VK_MESH_SHARED_WARP, RX_VK_MESH_SHARED_WARP_CHECK and RX_VK_MESH_LANES
were read with no row in gpu/vk/switches.def (tests/test_switch_table.py).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The ANV PC in the device policy check now expects equal_depth_bias 0. On main it is 64, the margin every Intel GPU
gets by the vendor, and the check fails: "Iris Xe, ANV: equal_depth_bias is 64, expected 0".

On an Iris Xe with Mesa 26.2.7 the game's EQUAL holds, and the margin's LESS_OR_EQUAL lets the colour pass's terrain
(701ae221d88b2908) draw where its depth pass did not: in front of the canyon's rocks on Death Mountain Trail, a flat
streaked wall over them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Assisted-by: Claude Code (Claude Opus 5.5)
On Death Mountain Trail (the Kakariko side), a flat sage-green wall with vertical streaks stood over the canyon's
rocks on an Iris Xe with Mesa 26.2.7.

The colour pass's terrain (701ae221d88b2908) tests EQUAL against the depth pass. On every Intel GPU that test became
LESS_OR_EQUAL with 64 units towards the camera (629e2af3, issue 17 on an Arc B390 under Windows: positions not equal to
the last bit, holes in the ground). LESS_OR_EQUAL also passes everything in front of what the depth pass wrote. Part
of the terrain heightfield is in front of the canyon rock there, where the depth pass has no terrain, so the colour
pass drew it over the rock: in the frame dump, depth 0.99716 against the rock's 0.99802 at the wall's pixels, and
nothing from the terrain's depth programs.

On Mesa's compiler the game's EQUAL holds: with RX_VK_EQ_BIAS=0 the wall is gone and the rocks are back, and the ground
of the trail, Kakariko and the Death Mountain gate has no hole (the gate's shots with and without the margin differ in
0.075% of the pixels, on Navi, Link and the swaying plants). The margin's default now follows the driver
(VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS) and not the vendor, as the rule's own comment asked a run on Mesa to decide.
Intel's Windows driver keeps it; RX_VK_EQ_BIAS still sets it on any GPU.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Assisted-by: Claude Code (Claude Opus 5.5)
docs(tested): the mesh fallback's branch against main on an Iris Xe on Death Mountain Trail, 8.3 fps to 18.2
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
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
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
Website / Website on Cloudflare (pull_request) Has been cancelled
d5926ccb1e
Three interleaved rounds of c3c9b0ee's renderer and main 7daafa7a's, one base, the first round a warm-up: main 8.3,
8.2, 8.3 fps at 1500 MHz, the branch 18.2, 18.1, 18.3 fps at 1210 MHz (held at the power limit).

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

Tested in game: Iris Xe, Mesa 26.2.7, Bazzite (kernel 7.3.4): Death Mountain Trail, the green wall over the canyon gone (it is on main) and the rocks drawn; above Kakariko 8.3 -> 18.2 fps against main 7daafa7a over three interleaved rounds, the picture the same

Tested in game: Iris Xe, Mesa 26.2.7, Bazzite (kernel 7.3.4): Death Mountain Trail, the green wall over the canyon gone (it is on main) and the rocks drawn; above Kakariko 8.3 -> 18.2 fps against main 7daafa7a over three interleaved rounds, the picture the same
Collaborator

Possibly related, for context:

  • PR #1308 WIP: perf(vk): enable storage table loop and mesh optimizer on AMD RDNA 4 — Open Vulkan performance PR; overlapping renderer/device-policy changes, though targets AMD RDNA 4 rather than Intel Mesa.
Possibly related, for context: - PR #1308 WIP: perf(vk): enable storage table loop and mesh optimizer on AMD RDNA 4 — Open Vulkan performance PR; overlapping renderer/device-policy changes, though targets AMD RDNA 4 rather than Intel Mesa.
Tomiss changed title from WIP: perf(vk): the mesh fallback twice as fast on Mesa's Intel driver, and no equal-depth margin there to WIP: perf(vk): defaults of its own for Mesa's Intel driver, 8.3 to 18.2 fps on an Iris Xe 2026-11-18 14:35:56 +00:00
Tomiss force-pushed perf/intel-xe-mesh-fallback from d5926ccb1e
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
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
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
Website / Website on Cloudflare (pull_request) Has been cancelled
to 807b29ebc2
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
2026-11-18 14:40:58 +00:00
Compare
Tomiss changed title from WIP: perf(vk): defaults of its own for Mesa's Intel driver, 8.3 to 18.2 fps on an Iris Xe to perf(vk): defaults of its own for Mesa's Intel driver, 8.3 to 18.2 fps on an Iris Xe 2026-11-18 14:41:11 +00:00
Author
Contributor

Rebased onto main 430eef4f (#1567, no conflict) and force-pushed; run_all.py --changed 219 passed, 18 failed, the 18 failing on main too. The numbers measured on 7daafa7a hold: #1567 changes only the shader preparation's compute warming, which these runs didn't use. Retitled as one change: Mesa's Intel driver gets defaults of its own.

Rebased onto main 430eef4f (#1567, no conflict) and force-pushed; `run_all.py --changed` 219 passed, 18 failed, the 18 failing on main too. The numbers measured on 7daafa7a hold: #1567 changes only the shader preparation's compute warming, which these runs didn't use. Retitled as one change: Mesa's Intel driver gets defaults of its own.
Author
Contributor

@Beanstalk Linux, an Intel Arc or Xe GPU on Mesa: Hyrule Castle and Death Mountain Trail standing still, screenshots and fps against main. Windows, an Intel GPU: the ground at the Death Mountain gate and in Kakariko, expecting no holes.

@Beanstalk Linux, an Intel Arc or Xe GPU on Mesa: Hyrule Castle and Death Mountain Trail standing still, screenshots and fps against main. Windows, an Intel GPU: the ground at the Death Mountain gate and in Kakariko, expecting no holes.
Member

@Tomiss only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@Tomiss only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'perf/intel-xe-mesh-fallback:Tomiss-perf/intel-xe-mesh-fallback'
git switch 'Tomiss-perf/intel-xe-mesh-fallback'
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!1586
No description provided.