feat(shader): accept vcc as the scalar base address of global instructions #750

Merged
Celegans12 merged 1 commit from upstream-pr/750 into main 2026-10-05 23:12:39 +00:00
Celegans12 commented 2026-10-05 20:39:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-05T20:39:31Z.


What

Recompiling a global load, store or atomic whose scalar base (SADDR) is VCC throws FLAT scalar address register range overflow, because the FLAT decoder took SADDR only as a numbered SGPR pair.

  • SADDR 106 now decodes as the VCC pair for global loads, stores, atomics and global_load/store_dword_addtid. Address translation already reads VCC_LO:VCC_HI through offsetOperand; SMEM already accepts VCC as its base pair. In the scratch segment the field is a 32-bit offset, and vcc_lo is read as that offset.
  • Source: LLVM's GFX10 global saddr operand accepts s, vcc, ttmp, null and off.
  • Still thrown: vcc_hi, m0 and exec as a base, and trap temporary pairs (the decoder has no TTMP operand).
  • PPSA26344 v1.008: 29 shader programs stop here: 28 pixel shaders in the character packs (core_c0_char_male_ped, core_c9_char, core_c3_char_animal, hero.xpps) and 1 compute shader in all_shaders.xpps. For example, 02514c789e452069 runs s_load_dwordx2 vcc, s[0:1], 0x40 at 0x3aa8, then global_load_dwordx4 v[0:3], v106, vcc offset:1976 (0xdc3887b8 0x006a006a) at 0x3ac0.
  • #670 and #385 edit other functions in RdnaMemoryOpDecoder.cpp. Both merge cleanly with this branch.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main 681f83e5: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 317/317 tests pass (ctest --output-on-failure)
  • New agc_driver_global_vcc_base runs, with a VCC base, global_load_dword, the title's global_load_dwordx4 words, global_atomic_add with glc, and dword and dwordx4 stores as wave32 and wave64, and on devices with 32-lane subgroups also global_load/store_dword_addtid. It compares the whole 64 KiB guest block and requires vcc_hi, m0 and exec bases to throw. On main it fails at the first recompile with the message above.
  • PPSA26344 v1.008, offline recompile of the 29 programs: on main all stop at decode; with this change all decode and translate (165,274 instructions) and stop at runtime-indexed image descriptors (GetImageResource dword 0 is not a valid runtime value), which main does not handle yet.
  • Not tested: PPSA21564 and Dreaming Sarah (not run; expect a PPSA21564 gate), Linux (CI), console behaviour.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4750510328 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/750). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-05T20:39:31Z. --- ### What Recompiling a global load, store or atomic whose scalar base (SADDR) is VCC throws `FLAT scalar address register range overflow`, because the FLAT decoder took SADDR only as a numbered SGPR pair. - SADDR 106 now decodes as the VCC pair for global loads, stores, atomics and `global_load/store_dword_addtid`. Address translation already reads VCC_LO:VCC_HI through `offsetOperand`; SMEM already accepts VCC as its base pair. In the scratch segment the field is a 32-bit offset, and `vcc_lo` is read as that offset. - Source: LLVM's GFX10 [global `saddr` operand](https://releases.llvm.org/11.0.0/docs/AMDGPU/gfx10_saddr_flat_global.html) accepts `s`, `vcc`, `ttmp`, `null` and `off`. - Still thrown: `vcc_hi`, `m0` and `exec` as a base, and trap temporary pairs (the decoder has no TTMP operand). - PPSA26344 v1.008: 29 shader programs stop here: 28 pixel shaders in the character packs (`core_c0_char_male_ped`, `core_c9_char`, `core_c3_char_animal`, `hero.xpps`) and 1 compute shader in `all_shaders.xpps`. For example, 02514c789e452069 runs `s_load_dwordx2 vcc, s[0:1], 0x40` at 0x3aa8, then `global_load_dwordx4 v[0:3], v106, vcc offset:1976` (`0xdc3887b8 0x006a006a`) at 0x3ac0. - #670 and #385 edit other functions in `RdnaMemoryOpDecoder.cpp`. Both merge cleanly with this branch. ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, based on `main` 681f83e5: configure `-DBUILD_TESTING=ON`, full build, `--target libs`, `ctest`: - 317/317 tests pass (`ctest --output-on-failure`) - New `agc_driver_global_vcc_base` runs, with a VCC base, `global_load_dword`, the title's `global_load_dwordx4` words, `global_atomic_add` with glc, and dword and dwordx4 stores as wave32 and wave64, and on devices with 32-lane subgroups also `global_load/store_dword_addtid`. It compares the whole 64 KiB guest block and requires `vcc_hi`, `m0` and `exec` bases to throw. On `main` it fails at the first recompile with the message above. - PPSA26344 v1.008, offline recompile of the 29 programs: on `main` all stop at decode; with this change all decode and translate (165,274 instructions) and stop at runtime-indexed image descriptors (`GetImageResource dword 0 is not a valid runtime value`), which `main` does not handle yet. - Not tested: PPSA21564 and Dreaming Sarah (not run; expect a PPSA21564 gate), Linux (CI), console behaviour. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
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!750
No description provided.