Skip to content

fix(shader): retain adjacent anchor byte loads on RADV - #7829

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/shader-bda-anchor-read-sync114
Oct 20, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/shader-bda-anchor-read-sync114

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

On RX 6650 XT / RADV, agc_driver_bda_device on current main fails the anchored 16-bit read comparison. The optimized anchor path can return a different halfword from the checked lookup path. Keep the two adjacent physical byte loads volatile for 16-bit anchored reads, retaining the original masks for single-byte reads and the existing bounds/fallback logic.

Adds small uniform-lane and mixed direct/fallback halfword cases before the original boundary, permission, overlap and overflow comparisons. Records the workaround and unresolved driver transformation in shader debt. This is the previously validated follow-up from fork PR #67, isolated from the anchor optimization that has since merged. No title performance or bring-up gain is claimed.

Tested

Linux 7.2.9-arch1-1, GCC, RX 6650 XT / RADV Mesa 26.2.4-arch1.1, same machine and current-main base 8816fd772005585886f19b3f6c13a99931e41241.

  • Negative control on main: agc_driver_bda_device fails at anchor 0x7fff12340101, offset 0, immediate -1, 16 bits. A temporary diagnostic reports first differing output word 4: lookup 41376 (0xa1a0), anchor 160 (0x00a0). That diagnostic is excluded from this patch.
  • With this patch: ctest --test-dir build-full --output-on-failure -R '^(agc_driver_bda_device|agc_driver_graphics|agc_shader_memory)$': 3/3 passed, 5.19 seconds, no CTest skips. The physical Radeon executes the hardware readback section.
  • python3 tools/check_conventions.py --base origin/main and git diff origin/main --check pass.
  • Open-PR overlap check reports no confirmed conflicting hunks. Some already-conflicting PRs share the debt file; fix(shader): mask writes after barrier-safe BDA faults #7392 also shares SpirvBdaRead.cpp but changes fault/write-mask handling rather than this anchor-load block and is not a dependency.

Our own Windows execution, other physical GPUs beyond the independent Windows reports below, title runtime on this isolated patch and full hosted CI have not been tested. The cause inside the driver remains unisolated; this is a measured workaround, not a claim about PS5 halfword semantics.

  • Independent Windows validation reported by @LeandroLP23 (full report): AMD Radeon 860M (RDNA 3.5), AMD Windows driver 32.0.13058.8001, Windows 11 (reported by @LeandroLP23); WinLibs GCC 15.2.0, Release, ANYPS5_NO_SHADER_CACHE=1. With the PR head merged into main 118266aec, agc_driver_bda_device, agc_driver_graphics and agc_shader_memory pass 3/3. The same three also pass with main's SpirvBdaRead.cpp and this PR's tests: the RADV anchor mismatch does not reproduce on that Windows driver. These are the tester's results; they show no regression on this tested driver.

  • Independent discrete RDNA 2 Windows validation by @thuanquang (full report): RX 6700 XT (gfx1031), AMD Windows driver 32.0.21045.5002, Windows 11 26200, WinLibs GCC 15.2.0 r7, Release, full builds on main 54e4adde5. Main with only this PR's BdaExecution.cpp and main's SpirvBdaRead.cpp passes the three core BDA/graphics/shader-memory tests; the anchored halfword mismatch does not reproduce. The tester also reports the patched variant passing, including the anchor/span/native-depth cases. This supports a driver/compiler distinction within RDNA 2 rather than a hardware-family-wide failure; it does not isolate the responsible transformation. Test counts for the expanded selection are not inferred from the comment.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1, Linux 7.2.9-arch1-1; AMD Radeon 860M (RDNA 3.5), AMD Windows driver 32.0.13058.8001, Windows 11 (reported by @LeandroLP23); AMD Radeon RX 6700 XT (gfx1031), AMD Windows driver 32.0.21045.5002, Windows 11 26200 (reported by @thuanquang)
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/dev/debt/shader.md
PR 5371 docs/dev/debt/shader.md
PR 5426 docs/dev/debt/shader.md
PR 5500 docs/dev/debt/shader.md
PR 5941 docs/dev/debt/shader.md
PR 6009 docs/dev/debt/shader.md
PR 6235 docs/dev/debt/shader.md
PR 6280 docs/dev/debt/shader.md
PR 6412 docs/dev/debt/shader.md
PR 6488 docs/dev/debt/shader.md
PR 6977 docs/dev/debt/shader.md
PR 7085 docs/dev/debt/shader.md
PR 7392 core/shader/recompiler/SpirvBackend/src/SpirvBdaRead.cpp
docs/dev/debt/shader.md
PR 7395 docs/dev/debt/shader.md
PR 7484 docs/dev/debt/shader.md
PR 7684 docs/dev/debt/shader.md
PR 7922 docs/dev/debt/shader.md
PR 8004 docs/dev/debt/shader.md
PR 8281 docs/dev/debt/shader.md

@github-actions github-actions Bot added shader core/shader docs agc libSceAgc* labels Oct 19, 2026
@LeandroLP23

Copy link
Copy Markdown
Contributor

AMD's own Windows driver, as a non-RADV check. AMD Radeon 860M (RDNA 3.5, 1002:1114), driver 32.0.13058.8001, Windows 11, WinLibs GCC 15.2.0, Release, ANYPS5_NO_SHADER_CACHE=1. Head merged into main 118266a (clean merge). "Main's sources" means this PR's test files over main's other files.

  • agc_driver_bda_device, agc_driver_graphics and agc_shader_memory pass 3 of 3.
  • With main's SpirvBdaRead.cpp, all three also pass. agc_driver_bda_device doesn't show the anchor mismatch you see on RADV.

So the case is RADV-specific, as the title says, and the change doesn't break this driver.

AI-assisted: yes (Claude Code)

@thuanquang

Copy link
Copy Markdown
Contributor

A discrete RDNA 2 card on AMD's own Windows driver, to help separate an RDNA 2 cause from a RADV one: RX 6700 XT (gfx1031, same family as the RX 6650 XT), driver 32.0.21045.5002, Windows 11 26200, WinLibs GCC 15.2.0 r7, Release, main 54e4adde5, full builds.

  • main with only this PR's BdaExecution.cpp (main's SpirvBdaRead.cpp): agc_driver_bda_device, agc_driver_graphics and agc_shader_memory pass 3 of 3. The anchored 16-bit mismatch does not reproduce here.
  • main + this PR: those three plus agc_driver_bda_anchor_reads, agc_driver_bda_span_reads and agc_driver_native_depth_bda_clear pass 3 of 3.

So with the same RDNA 2 hardware family, the wrong halfword shows up under RADV and not under AMD's Windows compiler, which points at RADV's transformation rather than the hardware, consistent with the 860M result. No regression from the change on this driver.

@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@adriadam10
adriadam10 merged commit 6e9279c into boykopovar:main Oct 20, 2026
15 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Re-checked against current main (including #6373 and #7628): the merge is clean, the 16-bit anchored read keeps the volatile access mask while 1-byte and 32-bit paths are untouched, and the new halfword cases and debt entry still apply; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants