tests: treat SH 0x2/0x3 as live PS user-data address slots #991

Closed
github-bot wants to merge 1 commit from gh-pr/991/head into gh-pr/991/base
Owner

@⁠theantipopau on GitHub · 2026-10-02 23:39 UTC · original
theantipopau:pm4-user-data-slots → main · +12 −5 · 1 files · 1 commits · closed without merging

Problem

shader_recompiler_compute_tests aborts on current main at:

ShaderRecompilerComputeTests: Pm4NativeTargetGeometry failed at legacy register holes:
a removed GCN register has a handler or a native packet is not handled

Exit code 127 after only 33 checks — the rest of the suite never runs.

Cause: #964 ("Improve Hades II compatibility") registered handlers at SH offsets 0x2/0x3 (SPI_SHADER_USER_DATA_ADDR_LO_PS/HI_PS) because Hades II's indirect SET_SH_REG_INDIRECT traffic writes the PS user-data address there. CheckPm4NativeTargetGeometryRegisters, added much earlier in 1df06e23, still lists 0x002/0x003 among the "removed GCN register holes" that must have no handler, so the two changes now contradict each other.

CI never notices: .github/workflows/build.yml only ctests audio_out2_port|ime_dialog|virtual_memory_allocation, and the #964 PR body itself notes automated tests were not run for that branch.

Fix

  • Drop 0x002/0x003 from legacy_shader_slots (19 → 17 entries) and document why they stopped being holes.
  • Add a positive check in the same test that both g_hw_sh_func and g_hw_sh_indirect_func keep handlers at those offsets, so the slots are still guarded — just for the opposite reason (they must be handled, not ignored).

The remaining 17 slots, the depth/color legacy holes, and the 0x0cb..0x0eb range are unchanged, so the dispatch-table regression check keeps its original strength for genuinely removed GCN registers.

Testing (Windows, local build of shader_recompiler_compute_tests)

Tree Result
upstream main (e317465d) exit 127, aborts at Pm4NativeTargetGeometry after 33 checks
this branch (bae42bcf) Pm4NativeTargetGeometry ok, 62 checks pass before this machine's known D24_UNORM_S8_UINT driver rejection (that one is fixed by #930)
this branch + local #930 patch 180 checks pass; first stop is the pre-existing 1-ULP VectorFractF16CapturedAndEdges readback case (hardware-captured rounding, unrelated to PM4 dispatch)

Runtime diagnostics during the investigation confirmed sh[0x002] handler=1 indirect=1 and sh[0x003] handler=1 indirect=1 — both tables intentionally occupied after #964.

🤖 Generated with Codebuff

**@⁠theantipopau** on GitHub · 2026-10-02 23:39 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/991) `theantipopau:pm4-user-data-slots` → `main` · +12 −5 · 1 files · 1 commits · closed without merging ## Problem `shader_recompiler_compute_tests` aborts on current `main` at: ``` ShaderRecompilerComputeTests: Pm4NativeTargetGeometry failed at legacy register holes: a removed GCN register has a handler or a native packet is not handled ``` Exit code 127 after only 33 checks — the rest of the suite never runs. Cause: #964 ("Improve Hades II compatibility") registered handlers at SH offsets `0x2`/`0x3` (`SPI_SHADER_USER_DATA_ADDR_LO_PS`/`HI_PS`) because Hades II's indirect `SET_SH_REG_INDIRECT` traffic writes the PS user-data address there. `CheckPm4NativeTargetGeometryRegisters`, added much earlier in `1df06e23`, still lists `0x002`/`0x003` among the "removed GCN register holes" that must have no handler, so the two changes now contradict each other. CI never notices: `.github/workflows/build.yml` only ctests `audio_out2_port|ime_dialog|virtual_memory_allocation`, and the #964 PR body itself notes automated tests were not run for that branch. ## Fix - Drop `0x002`/`0x003` from `legacy_shader_slots` (19 → 17 entries) and document why they stopped being holes. - Add a positive check in the same test that both `g_hw_sh_func` and `g_hw_sh_indirect_func` keep handlers at those offsets, so the slots are still guarded — just for the opposite reason (they must be *handled*, not *ignored*). The remaining 17 slots, the depth/color legacy holes, and the `0x0cb..0x0eb` range are unchanged, so the dispatch-table regression check keeps its original strength for genuinely removed GCN registers. ## Testing (Windows, local build of `shader_recompiler_compute_tests`) | Tree | Result | |---|---| | upstream `main` (`e317465d`) | **exit 127**, aborts at `Pm4NativeTargetGeometry` after 33 checks | | this branch (`bae42bcf`) | `Pm4NativeTargetGeometry ok`, 62 checks pass before this machine's known `D24_UNORM_S8_UINT` driver rejection (that one is fixed by #930) | | this branch + local #930 patch | 180 checks pass; first stop is the pre-existing 1-ULP `VectorFractF16CapturedAndEdges` readback case (hardware-captured rounding, unrelated to PM4 dispatch) | Runtime diagnostics during the investigation confirmed `sh[0x002] handler=1 indirect=1` and `sh[0x003] handler=1 indirect=1` — both tables intentionally occupied after #964. 🤖 Generated with Codebuff
PR #964 registered handlers at SH offsets 0x2/0x3 so Hades II's
indirect SET_SH_REG writes reach the PS user-data address lo/hi
words, but CheckPm4NativeTargetGeometryRegisters still lists those
offsets among the removed GCN register holes. The check now fails
and aborts the whole shader suite, which CI never runs, so the
break went unnoticed.

Drop 0x2/0x3 from legacy_shader_slots and assert instead that both
dispatch tables keep handlers there.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:39:41 +00:00
github-bot closed this pull request 2026-11-26 09:39:41 +00:00
Author
Owner

@⁠theantipopau on GitHub · 2026-10-04 17:57 UTC · original

Superseded by upstream: current main already has all of this, so rebasing leaves no meaningful delta.

  • legacy_shader_slots on main is already the 17-element array without 0x002u/0x003u.
  • The assertion already exists as native_ps_address_slots_are_handled, which checks g_hw_sh_func[Pm4::SPI_SHADER_USER_DATA_ADDR_LO_PS] / ..._HI_PS (both direct and indirect) — and SPI_SHADER_USER_DATA_ADDR_LO_PS = 0x2, SPI_SHADER_USER_DATA_ADDR_HI_PS = 0x3 in pm4.h, i.e. exactly the literal 0x002u/0x003u check this PR added, now included in the legacy register holes Require.

Only the extra comment lines referencing #964 would remain, which are not worth a standalone change. Closing.

**@⁠theantipopau** on GitHub · 2026-10-04 17:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/991#issuecomment-5982810085) Superseded by upstream: current `main` already has all of this, so rebasing leaves no meaningful delta. - `legacy_shader_slots` on `main` is already the 17-element array without `0x002u`/`0x003u`. - The assertion already exists as `native_ps_address_slots_are_handled`, which checks `g_hw_sh_func[Pm4::SPI_SHADER_USER_DATA_ADDR_LO_PS]` / `..._HI_PS` (both direct and indirect) — and `SPI_SHADER_USER_DATA_ADDR_LO_PS = 0x2`, `SPI_SHADER_USER_DATA_ADDR_HI_PS = 0x3` in `pm4.h`, i.e. exactly the literal `0x002u`/`0x003u` check this PR added, now included in the `legacy register holes` Require. Only the extra comment lines referencing #964 would remain, which are not worth a standalone change. Closing.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.