fix(shader): accept buffer resource tuples ending in VCC #5648

Merged
Amoenus merged 6 commits from upstream-pr/5648 into main 2026-10-15 11:55:14 +00:00
Amoenus commented 2026-10-14 03:40:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-14T03:40:02Z.


What

Accept the MUBUF/MTBUF four-dword resource tuple at s104: s104, s105, VCC_LO and VCC_HI. Three decoder lines admit this exact tuple. Existing translation already reads scalar codes106/107 as raw VCC words; normal SGPR bounds and higher-base refusals are unchanged.

LLVM defines SGPR104_128 as VCCTuple, included in the SReg_128_XNULL buffer resource operand. Raw gfx10/gfx1013 behavior remains unmeasured and is recorded in shader debt. Merged #4996 changes MIMG separately.

Fixes #5630. Sonic Unleashed Recompiled/PPSA99902,01.003.000, needs this in its conditional bring-up #4443. The control stops at:

MTBUF resource descriptor register range overflow

Tested

Focused source 943d362d2, based on main 43349d4337543eca207772b065f10ab19acc24c9. Windows11 Enterprise26200, WinLibs GCC15.2r7, Release, SPIR-V validation enabled. All five original patches remain range-equivalent; an additional style-only commit removes two trailing blank lines. The earlier tested head is preserved on fork branch codex/buffer-vcc-tested-before-main433.

  • Full application build/libs, conventions and registration pass. Three relevant groups ×5 under each GPU selection pass without skips; maximum1.40763s NVIDIA /1.21538s AMD. CPU decode and shader-memory controls are not independent GPU coverage; native selection logs confirm the requested devices. Main advanced to4f6188985 during validation: clean merge preview, unbuilt; contribution/intake guidance is unchanged.
  • Original decoder with identical fixtures: CPU/native controls fail at the exact MTBUF refusal on both vendors. Executed on main a5; decoder blob 77ea8f03223bfc5c04afd214b41d48273892a888 is unchanged on a14, whose intervening change affects libkernel fcntl only. This historical negative control is not newly repeated on main433. The current rebased candidate is clean and passes the full build/repeated checks above.
  • CPU:160 opcode/base combinations, exact invalid-base diagnostics, unchanged PC/vector/format operands.
  • Native:22 configurations ×64 lanes, wave32/wave64 single-dword raw/formatted loads/stores, VCC_LO record bounds, VCC_HI format interpretation and output guards. Atomics, wide/d16 accesses, every format and PS5 hardware are not claimed.

Matched title comparison uses main1978 plus preserved bring-up prerequisites, not unchanged main or the isolated PR branch:

Source Fatal stop Seconds to exit
Control86df4c5ad MTBUF descriptor range 649.304
Candidate2bd6889f5 Guest writes to a resident multisample target or its metadata 797.332

Only libSceAgcDriver differs in the installed profiles; all other module bytes, converted executable/guest libc and input schedule match. Seven timestamp/checksum-only rebuild outputs retain their control bytes. Both runs exit0xC0000409 without harness timeout; originals/runtime/user data restore exactly, no cleanup errors. Input consumption is not logged. This advances the decoder frontier; no menus, gameplay or performance improvement is claimed. No game assets or captured shaders are included.

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; no silent stubs
  • No notes, investigation files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA99902 #4443 (conditional bring-up; earlier prerequisites remain)
  • GPUs tested: NVIDIA RTX5080,610.62 (32.0.16.1062); AMD integrated Radeon(TM) Graphics,32.0.21036.18; Windows11 Enterprise26200, both
  • AI-assisted: yes, Codex; author responsible
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4852605791 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5648). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-14T03:40:02Z. --- ### What Accept the MUBUF/MTBUF four-dword resource tuple at s104: s104, s105, VCC_LO and VCC_HI. Three decoder lines admit this exact tuple. Existing translation already reads scalar codes106/107 as raw VCC words; normal SGPR bounds and higher-base refusals are unchanged. LLVM defines [SGPR104_128 as VCCTuple](https://github.com/llvm/llvm-project/blob/d8219b47422f7322db252ad29ca8ea87993fb433/llvm/lib/Target/AMDGPU/SIRegisterInfo.td#L422), included in the SReg_128_XNULL [buffer resource operand](https://github.com/llvm/llvm-project/blob/d8219b47422f7322db252ad29ca8ea87993fb433/llvm/lib/Target/AMDGPU/BUFInstructions.td). Raw gfx10/gfx1013 behavior remains unmeasured and is recorded in shader debt. Merged #4996 changes MIMG separately. Fixes #5630. Sonic Unleashed Recompiled/PPSA99902,01.003.000, needs this in its conditional [bring-up #4443](https://github.com/boykopovar/AnyPS5/discussions/4443). The control stops at: ```text MTBUF resource descriptor register range overflow ``` ### Tested Focused source [943d362d2](https://github.com/Amoenus/AnyPS5/commit/943d362d2d426cde90e937f54c9af1ecbef79e66), based on main `43349d4337543eca207772b065f10ab19acc24c9`. Windows11 Enterprise26200, WinLibs GCC15.2r7, Release, SPIR-V validation enabled. All five original patches remain range-equivalent; an additional style-only commit removes two trailing blank lines. The earlier tested head is preserved on fork branch `codex/buffer-vcc-tested-before-main433`. - Full application build/libs, conventions and registration pass. Three relevant groups ×5 under each GPU selection pass without skips; maximum1.40763s NVIDIA /1.21538s AMD. CPU decode and shader-memory controls are not independent GPU coverage; native selection logs confirm the requested devices. Main advanced to4f6188985 during validation: clean merge preview, unbuilt; contribution/intake guidance is unchanged. - Original decoder with identical fixtures: CPU/native controls fail at the exact MTBUF refusal on both vendors. Executed on main a5; decoder blob `77ea8f03223bfc5c04afd214b41d48273892a888` is unchanged on a14, whose intervening change affects libkernel fcntl only. This historical negative control is not newly repeated on main433. The current rebased candidate is clean and passes the full build/repeated checks above. - CPU:160 opcode/base combinations, exact invalid-base diagnostics, unchanged PC/vector/format operands. - Native:22 configurations ×64 lanes, wave32/wave64 single-dword raw/formatted loads/stores, VCC_LO record bounds, VCC_HI format interpretation and output guards. Atomics, wide/d16 accesses, every format and PS5 hardware are not claimed. Matched title comparison uses main1978 plus preserved bring-up prerequisites, not unchanged main or the isolated PR branch: | Source | Fatal stop | Seconds to exit | |---|---|---:| | [Control86df4c5ad](https://github.com/Amoenus/AnyPS5/commit/86df4c5ad1b42c9b02ea3416b9bab832fda9f812) | MTBUF descriptor range |649.304| | [Candidate2bd6889f5](https://github.com/Amoenus/AnyPS5/commit/2bd6889f5614ab1f9b919bc45dd13144a4ef04c5) | Guest writes to a resident multisample target or its metadata |797.332| Only libSceAgcDriver differs in the installed profiles; all other module bytes, converted executable/guest libc and input schedule match. Seven timestamp/checksum-only rebuild outputs retain their control bytes. Both runs exit0xC0000409 without harness timeout; originals/runtime/user data restore exactly, no cleanup errors. Input consumption is not logged. This advances the decoder frontier; no menus, gameplay or performance improvement is claimed. No game assets or captured shaders are included. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs - [x] No notes, investigation files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA99902 #4443 (conditional bring-up; earlier prerequisites remain) - [x] GPUs tested: NVIDIA RTX5080,610.62 (32.0.16.1062); AMD integrated Radeon(TM) Graphics,32.0.21036.18; Windows11 Enterprise26200, both - [x] AI-assisted: yes, Codex; author responsible
LeandroLP23 commented 2026-10-14 07:15:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-14T07:15:40Z.


A second title that stops on this: PS5 FSR4 Showcase (PPSA99011, catalog 01.000.010). Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release, relinked with --windows --trap-sdk-syscall-stubs.

The title needs two other open PRs to get this far, so both builds are main d8888df9b + #5163 (sceAgcInit version) + #5477 (COPY_DATA register source), with and without this PR's head b4f916bd3:

Build Runs Result
without this PR 2, empty caches FSR4_SHOWCASE_CHAPTER index=0, then what(): MUBUF resource descriptor register range overflow 2 of 2
with this PR 3 with empty caches, 2 with warm caches no decoder throw in 5 of 5; the title reaches chapter 0 and its FSR4 pass

agc_buffer_resource_vcc passes 3 of 3 (--repeat until-fail:3), and so do agc_driver_pm4 and agc_driver_pm4_failure on the same tree.

The title's next stop, separate from this PR: in 4 of 5 runs its own fence wait for the FSR4 stage fails after about 4.5 s (FSR4_SHOWCASE_ERROR fence=-4 stage=fsr4 after_ms=4525, then FSR4_SHOWCASE_END result=FAIL). It happens with warm shader caches too, so it isn't the compile time. In the other run vkQueueSubmit returned -4 (device lost) at 14 s.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6163025126 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5648#issuecomment-6163025126). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-14T07:15:40Z. --- A second title that stops on this: PS5 FSR4 Showcase (PPSA99011, catalog 01.000.010). Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release, relinked with `--windows --trap-sdk-syscall-stubs`. The title needs two other open PRs to get this far, so both builds are `main` d8888df9b + #5163 (`sceAgcInit` version) + #5477 (COPY_DATA register source), with and without this PR's head b4f916bd3: | Build | Runs | Result | |---|---|---| | without this PR | 2, empty caches | `FSR4_SHOWCASE_CHAPTER index=0`, then `what(): MUBUF resource descriptor register range overflow` 2 of 2 | | with this PR | 3 with empty caches, 2 with warm caches | no decoder throw in 5 of 5; the title reaches chapter 0 and its FSR4 pass | `agc_buffer_resource_vcc` passes 3 of 3 (`--repeat until-fail:3`), and so do `agc_driver_pm4` and `agc_driver_pm4_failure` on the same tree. The title's next stop, separate from this PR: in 4 of 5 runs its own fence wait for the FSR4 stage fails after about 4.5 s (`FSR4_SHOWCASE_ERROR fence=-4 stage=fsr4 after_ms=4525`, then `FSR4_SHOWCASE_END result=FAIL`). It happens with warm shader caches too, so it isn't the compile time. In the other run `vkQueueSubmit` returned -4 (device lost) at 14 s. AI-assisted: yes (Claude Code)
YossiYad commented 2026-10-14 21:58:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-14T21:58:43Z.


The FSR4 Showcase result on Linux, to go with the Windows run above. main 4808d9c20 (which now has #5163 and #5477) with this PR's head 943d362d2 merged and nothing else open, Bazzite 44 (GCC 16.2.1, Release), RX 7700 XT on RADV:

  • Without the PR: what(): MUBUF resource descriptor register range overflow.
  • With the PR: no decoder throw. The title builds its pipelines (FSR4_SHOWCASE_PIPELINES ms=352.5), reaches FSR4_SHOWCASE_READY and CHAPTER index=0, then stops on its own fence wait, FSR4_SHOWCASE_ERROR fence=-4 stage=fsr4 after_ms=4513.

So the next stop @LeandroLP23 saw on RDNA 3.5 under Windows is the same on RDNA 3 under RADV, and it isn't specific to the Windows driver.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6179406511 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5648#issuecomment-6179406511). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-14T21:58:43Z. --- The FSR4 Showcase result on Linux, to go with the Windows run above. `main` `4808d9c20` (which now has #5163 and #5477) with this PR's head `943d362d2` merged and nothing else open, Bazzite 44 (GCC 16.2.1, Release), RX 7700 XT on RADV: - Without the PR: `what(): MUBUF resource descriptor register range overflow`. - With the PR: no decoder throw. The title builds its pipelines (`FSR4_SHOWCASE_PIPELINES ms=352.5`), reaches `FSR4_SHOWCASE_READY` and `CHAPTER index=0`, then stops on its own fence wait, `FSR4_SHOWCASE_ERROR fence=-4 stage=fsr4 after_ms=4513`. So the next stop @LeandroLP23 saw on RDNA 3.5 under Windows is the same on RDNA 3 under RADV, and it isn't specific to the Windows driver.
screamm commented 2026-10-15 09:23:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-15T09:23:42Z.


Windows/NVIDIA check of head 943d362d2 on PS5 FSR4 Showcase (PPSA99011, 01.000.010), merged onto main 0afa6a607: clean merge.

Windows 11 Pro 26220, Ryzen 7 5700X, RTX 4070 (driver 596.21), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release. Title relinked with --windows --trap-sdk-syscall-stubs.

  • Build: relinker, libs and both new test targets pass, no warnings in the changed files.
  • agc_buffer_resource_vcc and agc_driver_buffer_resource_vcc (--repeat until-fail:3): 2/2, 3 of 3. The execution test ran on the RTX 4070, not as a skip.
  • Negative control: the same tree with only RdnaMemoryOpDecoder.cpp reset to main. Both tests fail (MTBUF resource descriptor register range overflow).
  • tools/check_conventions.py --base origin/main and git diff --check: pass.

Title runs, 60 s each, the first in a fresh folder and the next two in the same folder (warm caches):

Build Runs Result
main d92a8dad3 3 what(): MUBUF resource descriptor register range overflow, exit 0xC0000409, in 2 of 3. The third stopped earlier on FSR4_SHOWCASE_ERROR fence=-4 stage=fsr4 after_ms=4543.
main 0afa6a607 + this PR 3 no decoder throw in 3 of 3. Each run ends on FSR4_SHOWCASE_ERROR fence=-4 stage=fsr4 after_ms=4530..4534, FSR4_SHOWCASE_END result=FAIL, exit 0.
same tree, RdnaMemoryOpDecoder.cpp reset to main 2 what(): MUBUF resource descriptor register range overflow, exit 0xC0000409, 2 of 2

On main the throw always follows Compute shader 0x275540000 was not registered; preparing its artifact at dispatch. The title's own fence wait can fail before it gets that far, which is what happened in the one main run without the throw. So the clearer evidence is the shader itself. With this PR, all 3 runs prepare 0x275540000, go on to 0x275560000 and only then stop on the fence. Without it, every run that reached 0x275540000 threw there (4 of 4, including the same-tree control).

The next stop is the same fence=-4 stage=fsr4 that @LeandroLP23 (Radeon 860M, Windows) and @YossiYad (RX 7700 XT, RADV) saw. It is about 4.5 s after the chapter starts, with warm pipeline caches too, so it is on NVIDIA as well and separate from this PR.

Verdict: confirmed. This PR removes the FSR4 Showcase MUBUF stop on NVIDIA/Windows too.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6188823201 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5648#issuecomment-6188823201). Originally posted by [screamm](https://github.com/screamm) on 2026-10-15T09:23:42Z. --- Windows/NVIDIA check of head `943d362d2` on PS5 FSR4 Showcase (PPSA99011, 01.000.010), merged onto `main` `0afa6a607`: clean merge. Windows 11 Pro 26220, Ryzen 7 5700X, RTX 4070 (driver 596.21), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release. Title relinked with `--windows --trap-sdk-syscall-stubs`. - Build: `relinker`, `libs` and both new test targets pass, no warnings in the changed files. - `agc_buffer_resource_vcc` and `agc_driver_buffer_resource_vcc` (`--repeat until-fail:3`): 2/2, 3 of 3. The execution test ran on the RTX 4070, not as a skip. - Negative control: the same tree with only `RdnaMemoryOpDecoder.cpp` reset to `main`. Both tests fail (`MTBUF resource descriptor register range overflow`). - `tools/check_conventions.py --base origin/main` and `git diff --check`: pass. Title runs, 60 s each, the first in a fresh folder and the next two in the same folder (warm caches): | Build | Runs | Result | |---|---|---| | `main` `d92a8dad3` | 3 | `what(): MUBUF resource descriptor register range overflow`, exit 0xC0000409, in 2 of 3. The third stopped earlier on `FSR4_SHOWCASE_ERROR fence=-4 stage=fsr4 after_ms=4543`. | | `main` `0afa6a607` + this PR | 3 | no decoder throw in 3 of 3. Each run ends on `FSR4_SHOWCASE_ERROR fence=-4 stage=fsr4 after_ms=4530..4534`, `FSR4_SHOWCASE_END result=FAIL`, exit 0. | | same tree, `RdnaMemoryOpDecoder.cpp` reset to `main` | 2 | `what(): MUBUF resource descriptor register range overflow`, exit 0xC0000409, 2 of 2 | On `main` the throw always follows `Compute shader 0x275540000 was not registered; preparing its artifact at dispatch`. The title's own fence wait can fail before it gets that far, which is what happened in the one `main` run without the throw. So the clearer evidence is the shader itself. With this PR, all 3 runs prepare `0x275540000`, go on to `0x275560000` and only then stop on the fence. Without it, every run that reached `0x275540000` threw there (4 of 4, including the same-tree control). The next stop is the same `fence=-4 stage=fsr4` that @LeandroLP23 (Radeon 860M, Windows) and @YossiYad (RX 7700 XT, RADV) saw. It is about 4.5 s after the chapter starts, with warm pipeline caches too, so it is on NVIDIA as well and separate from this PR. Verdict: confirmed. This PR removes the FSR4 Showcase MUBUF stop on NVIDIA/Windows too. AI-assisted (Claude Code).
adriadam10 commented 2026-10-15 11:50:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T11:50:22Z.


Checked the decoder change, both new tests and the TechnicalDebt line. The merged tree builds; agc_buffer_resource_vcc and agc_driver_buffer_resource_vcc pass, and both fail with the decoder change reverted. I also measured the tuple on gfx1035: s[104:107] (s104, s105, vcc_lo, vcc_hi) returns bit for bit the same as an ordinary s[8:11] descriptor over 32 lanes, for buffer_load_dword and buffer_load_format_x, three formats and in-bounds/out-of-bounds records. Matches the third-party title runs above; merging once the full Build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191359553 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5648#issuecomment-6191359553). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T11:50:22Z. --- Checked the decoder change, both new tests and the TechnicalDebt line. The merged tree builds; `agc_buffer_resource_vcc` and `agc_driver_buffer_resource_vcc` pass, and both fail with the decoder change reverted. I also measured the tuple on gfx1035: `s[104:107]` (s104, s105, vcc_lo, vcc_hi) returns bit for bit the same as an ordinary `s[8:11]` descriptor over 32 lanes, for `buffer_load_dword` and `buffer_load_format_x`, three formats and in-bounds/out-of-bounds records. Matches the third-party title runs above; merging once the full Build is green.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
boykopovar/AnyPS5!5648
No description provided.