Cutscene faces on AMD: reads after a group barrier see other waves' writes #2664

Closed
github-bot wants to merge 1 commit from github-bot/gh-2664 into main AGit
Owner

@⁠hatch8889 on GitHub · 2026-11-29 15:44 UTC · original
hatch8889:fix/amd-cutscene-faces → main · +81 −3 · 3 files · 1 commits · closed without merging

For #1320. Wrong cutscene face expressions on an RX 6900 XT under Proton are
fixed here by this change together with descriptor heaps turned off:

VKD3D_DISABLE_EXTENSIONS=VK_EXT_descriptor_heap    # environment
--set VICTORY_GROUP_COHERENT=1                     # victory play

Cause

In the face network's formula program (0aa7934094794dbf) a wave reads what
another wrote before a group barrier, and gets the old value from its compute
unit's cache.

  1. dxil-spirv declares a typed buffer handle that is only loaded through as
    NonWritable, though the same buffer is written through another handle. RADV
    takes the load for reorderable and does not make it coherent.
  2. With descriptor heaps, Mesa 26.3.1's nir_lower_memory_model does not handle
    image_heap_load, so these loads are not made coherent either. (Read from the
    source; the measurements below agree.)

Change

  • VICTORY_GROUP_COHERENT=1 (off by default): in compute programs with
    s_barrier and more than 32 threads a group, each typed UAV buffer load also
    gets a store through the same handle, in a branch taken only at index
    0xFFFF_FFFF. It changes nothing at run time and stops the handle being
    declared NonWritable.
  • The switch is part of the shader cache key.
  • docs/linux-proton.md: both settings.

With the switch unset, translations are as before.

Measured

RX 6900 XT, Mesa 26.3.1, GE-Proton11-15, CachyOS. One recorded frame, the card's
results against a processor calculation of the console's instructions. The
formula program stores 2446 16-bit values in that frame:

Descriptor heaps Switch Wrong values
on off 488
on on 488
off off 488
off on 2 (+0 for -0)

With both, the other 23 face network programs also match (821 dispatches). The
compiled formula program then has glc on 32 of its 34 buffer loads, against
none before.

In a game run the faces are right. That run and the measurements were made on this
change on top of local AMD-on-Linux changes; the two source files changed here
were otherwise as on main.

On this branch: cargo test -p victory-shader --lib passes on Linux; clippy
reports the same as on main.

The Windows test programs of this branch under GE-Proton on the same card:

Tests Switch Result
victory-gpu, shader_cache unset 11 passed
victory-shader, all unset 459 passed, 3 failed, 9 ignored
victory-shader, all 1 459 passed, 3 failed, 9 ignored

The same three fail both times, with the same messages:
split_lds_wave32_read_after_read_barrier_coalescing_and_parity and
flat_global_stores_and_atomics_fence_uavs_at_group_barriers_across_waves want a
WARP adapter, and stub_pipeline_is_created expects an unsigned shader to be
refused, which this setup accepts.

Not done

  • Other cards (including the RX 7800 XT of #1320), other Mesa versions, Windows.
  • Frame rate.
  • No unit test of the switch; the face network test used for the measurements
    needs the title's programs and a recorded frame.
  • Typed textures read and written by one group have the same pattern and are not
    covered.

🤖 Generated with Claude Code

**@⁠hatch8889** on GitHub · 2026-11-29 15:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2664) `hatch8889:fix/amd-cutscene-faces` → `main` · +81 −3 · 3 files · 1 commits · closed without merging For #1320. Wrong cutscene face expressions on an RX 6900 XT under Proton are fixed here by this change **together with** descriptor heaps turned off: ```sh VKD3D_DISABLE_EXTENSIONS=VK_EXT_descriptor_heap # environment --set VICTORY_GROUP_COHERENT=1 # victory play ``` ## Cause In the face network's formula program (`0aa7934094794dbf`) a wave reads what another wrote before a group barrier, and gets the old value from its compute unit's cache. 1. dxil-spirv declares a typed buffer handle that is only loaded through as `NonWritable`, though the same buffer is written through another handle. RADV takes the load for reorderable and does not make it coherent. 2. With descriptor heaps, Mesa 26.3.1's `nir_lower_memory_model` does not handle `image_heap_load`, so these loads are not made coherent either. (Read from the source; the measurements below agree.) ## Change - `VICTORY_GROUP_COHERENT=1` (off by default): in compute programs with `s_barrier` and more than 32 threads a group, each typed UAV buffer load also gets a store through the same handle, in a branch taken only at index `0xFFFF_FFFF`. It changes nothing at run time and stops the handle being declared `NonWritable`. - The switch is part of the shader cache key. - `docs/linux-proton.md`: both settings. With the switch unset, translations are as before. ## Measured RX 6900 XT, Mesa 26.3.1, GE-Proton11-15, CachyOS. One recorded frame, the card's results against a processor calculation of the console's instructions. The formula program stores 2446 16-bit values in that frame: | Descriptor heaps | Switch | Wrong values | |---|---|---| | on | off | 488 | | on | on | 488 | | off | off | 488 | | off | on | 2 (+0 for -0) | With both, the other 23 face network programs also match (821 dispatches). The compiled formula program then has `glc` on 32 of its 34 buffer loads, against none before. In a game run the faces are right. That run and the measurements were made on this change on top of local AMD-on-Linux changes; the two source files changed here were otherwise as on `main`. On this branch: `cargo test -p victory-shader --lib` passes on Linux; clippy reports the same as on `main`. The Windows test programs of this branch under GE-Proton on the same card: | Tests | Switch | Result | |---|---|---| | `victory-gpu`, `shader_cache` | unset | 11 passed | | `victory-shader`, all | unset | 459 passed, 3 failed, 9 ignored | | `victory-shader`, all | `1` | 459 passed, 3 failed, 9 ignored | The same three fail both times, with the same messages: `split_lds_wave32_read_after_read_barrier_coalescing_and_parity` and `flat_global_stores_and_atomics_fence_uavs_at_group_barriers_across_waves` want a WARP adapter, and `stub_pipeline_is_created` expects an unsigned shader to be refused, which this setup accepts. ## Not done - Other cards (including the RX 7800 XT of #1320), other Mesa versions, Windows. - Frame rate. - No unit test of the switch; the face network test used for the measurements needs the title's programs and a recorded frame. - Typed *textures* read and written by one group have the same pattern and are not covered. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
In the face network's formula program (0aa7934094794dbf) one wave reads what
another wrote before a group barrier, and on RADV got the old value from its
compute unit's cache.

dxil-spirv declares a typed buffer handle that is only loaded through as
NonWritable, though the same buffer is written through another handle. RADV
(Mesa 26.3.1) then takes the load for reorderable and does not make it
coherent. VICTORY_GROUP_COHERENT=1 stores through each such handle too, in a
branch taken only past the end of any view, in compute programs with group
barriers and more than 32 threads a group.

It takes a second setting: with descriptor heaps, Mesa's
nir_lower_memory_model passes over the loads (image_heap_load), so vkd3d-proton
needs VKD3D_DISABLE_EXTENSIONS=VK_EXT_descriptor_heap. docs/linux-proton.md has
both.

On a recorded frame from an RX 6900 XT, 488 of the program's 2446 stored halves
differed from a processor calculation of the console's instructions; either
setting alone left them, both leave 2 (+0 for -0), and the faces are right in a
game run.

Off by default. Not tried on other cards, on Windows or for frame rate.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 15:47:09 +00:00
github-bot force-pushed github-bot/gh-2664 from 6117c04fd7 to b01879a924 2026-11-29 20:57:31 +00:00 Compare
github-bot force-pushed github-bot/gh-2664 from b01879a924 to f73acfb7ef 2026-11-30 16:21:56 +00:00 Compare
github-bot closed this pull request 2026-11-30 16:46:15 +00:00
Author
Owner

@⁠hatch8889 on GitHub · 2026-11-30 16:41 UTC · original

Closing this as maintainer of this repo is not interested in supporting Linux and wider hardware.

**@⁠hatch8889** on GitHub · 2026-11-30 16:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2664#issuecomment-7285082174) Closing this as maintainer of this repo is not interested in supporting Linux and wider hardware.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!2664
No description provided.