fix(agc): a 0xffffffff register offset names no register #16054

Merged
stuart-russell merged 1 commit from upstream-pr/16054 into main 2026-11-25 10:03:43 +00:00
stuart-russell commented 2026-11-05 13:35:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by stuart-russell on 2026-11-05T13:35:17Z.


What

A SET_*_REG/SET_*_REG_INDIRECT packet whose register offset is 0xffffffff names no register; the hardware accepts the packet and the remaining entries still take effect. The driver threw (indirect register sentinel semantics are not implemented), which aborted the whole submission.

registerOffset now returns an empty optional for 0xffffffff, and the four call sites (validation range check, the direct SET_*_REG write loop, the indirect pair loop and the indirect trace) skip that entry instead of writing it. APS5_PM4_RING dumps of such packets still list the other offsets.

IndirectRegistersValid still classifies a list holding the sentinel as invalid, so the re-read-at-execution path and the released reports that depend on it are unchanged; the sentinel entry is skipped when either copy is written, so both copies behave the same.

The packets that carry a byte offset are SET_CONTEXT_REG (0x69), SET_SH_REG (0x76), SET_UCONFIG_REG (0x79) and their indirect forms. SET_UCONFIG_REG_INDEX (0x7a) selects a bank and index rather than a byte offset and still rejects 0xffffffff.

Part of the split of #10420; independent of #10779 and #16053.

References

The context register space ends below 0x4000, so 0xffffffff cannot name a register; the packet is accepted, not rejected. docs/dev/debt/libSceAgcDriver.md records the SET_*_REG_INDIRECT read timing for the entries that are genuinely invalid (bits 16-27 set). Measurement: the title trace that motivated the series contains SET_CONTEXT_REG packets carrying this offset, and before the change the submission threw.

Tested

agc_driver_pm4 (18 tests) and agc_driver_graphics pass, and tools/check_conventions.py --base origin/main passes, on d23df92b38. The register tests now execute such a packet and check that the neighbouring entries land while the sentinel entry writes nothing, instead of expecting a failure.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R 'agc_driver_(pm4|graphics)' -V passes with no VUID- lines and without the "was not found but was requested by env var VK_INSTANCE_LAYERS" message. This machine has no Vulkan device, so that run covers the decode path only.

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: the branch's Linux test machine has no Vulkan device
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5172444285 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16054). Originally posted by [stuart-russell](https://github.com/stuart-russell) on 2026-11-05T13:35:17Z. --- ### What A `SET_*_REG`/`SET_*_REG_INDIRECT` packet whose register offset is `0xffffffff` names no register; the hardware accepts the packet and the remaining entries still take effect. The driver threw (`indirect register sentinel semantics are not implemented`), which aborted the whole submission. `registerOffset` now returns an empty optional for `0xffffffff`, and the four call sites (validation range check, the direct `SET_*_REG` write loop, the indirect pair loop and the indirect trace) skip that entry instead of writing it. `APS5_PM4_RING` dumps of such packets still list the other offsets. `IndirectRegistersValid` still classifies a list holding the sentinel as invalid, so the re-read-at-execution path and the released reports that depend on it are unchanged; the sentinel entry is skipped when either copy is written, so both copies behave the same. The packets that carry a byte offset are `SET_CONTEXT_REG` (0x69), `SET_SH_REG` (0x76), `SET_UCONFIG_REG` (0x79) and their indirect forms. `SET_UCONFIG_REG_INDEX` (0x7a) selects a bank and index rather than a byte offset and still rejects `0xffffffff`. Part of the split of #10420; independent of #10779 and #16053. ### References The context register space ends below `0x4000`, so `0xffffffff` cannot name a register; the packet is accepted, not rejected. `docs/dev/debt/libSceAgcDriver.md` records the `SET_*_REG_INDIRECT` read timing for the entries that are genuinely invalid (bits 16-27 set). Measurement: the title trace that motivated the series contains `SET_CONTEXT_REG` packets carrying this offset, and before the change the submission threw. ### Tested `agc_driver_pm4` (18 tests) and `agc_driver_graphics` pass, and `tools/check_conventions.py --base origin/main` passes, on `d23df92b38`. The register tests now execute such a packet and check that the neighbouring entries land while the sentinel entry writes nothing, instead of expecting a failure. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R 'agc_driver_(pm4|graphics)' -V` passes with no `VUID-` lines and without the "was not found but was requested by env var VK_INSTANCE_LAYERS" message. This machine has no Vulkan device, so that run covers the decode path only. ### 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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: the branch's Linux test machine has no Vulkan device - [x] AI-assisted: yes
MarcZX10 commented 2026-11-17 07:02:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T07:02:30Z.

Review: COMMENTED


Reviewed — no blocking findings

Head 1688b109186059ffdc464d2404e61009f5291af6 shows no verified defect in the sentinel handling, but the author's test run cites another commit, so no formal approval is given. Nothing blocks this; the points below are optional.

What I ran

  • Head reviewed: 1688b109186059ffdc464d2404e61009f5291af6, base main.
  • Read the description, commit list, manifest and diff from the review folder.
  • Read the head of the callers in core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp (lines 578–608) and the other IndirectRegistersValid call sites by search.
  • No build and no tests were run.

Results

Check Result Note
Diff read (3 files) passed Full diff read
Full text of changed files not run Only the changed hunks and search hits were read
Unit tests (agc_driver_pm4, agc_driver_graphics) not run Author reports a run on d23df92b38, not on this head
check_conventions.py not run Author reports a pass on d23df92b38

Findings

Blocking

None.

Non-blocking

  • docs/dev/debt/changes/fix-agc-register-offset-sentinel.md:1: the checklist says no .md notes were added and that the change is generic, not specific to one title. The new file names a title ID and a game (PPSA23566, UFC 6). If this file is the expected technical-debt record format, the checklist should say so; otherwise the title reference could be dropped.
  • core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:71 (the direct 0x69/0x76/0x79 path): a direct packet whose offset is 0xffffffff now writes nothing, including its value dwords. The description's "the remaining entries still take effect" reads as referring to indirect list entries. The code and the new test agree on the whole-packet skip; the description could say so to avoid doubt.

Not verified

  • The author's tests and convention check ran on d23df92b38, not on head 1688b109186059ffdc464d2404e61009f5291af6. They were not re-run here.
  • The hardware claims in the debt note (how the console's graphics PFP reads a register list written after submission, and the PPSA23566 behaviour) were not checked. They depend on hardware and traces that were not available here.
  • Submission.cpp was checked only at its call to IndirectRegistersValid (line 434), not in full.
  • The full text of Pm4.cpp and tests/Pm4.cpp was not read; the review covers the changed hunks and the call sites found by search.
  • registerOffset for 0x7a (SET_UCONFIG_REG_INDEX) is still rejected by the bank check before registerOffset is reached; this was read from the diff context, not from an executed test.

To get this to a good state

Nothing is required.

Optional, before merge:

  • Confirm the title reference and the "no notes added" checklist item in the debt note.
  • Re-run agc_driver_pm4 and agc_driver_graphics on the current head 1688b109186059ffdc464d2404e61009f5291af6 and record the output in the PR, since the cited run is on another commit.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5934289531 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16054#pullrequestreview-5934289531). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T07:02:30Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Head `1688b109186059ffdc464d2404e61009f5291af6` shows no verified defect in the sentinel handling, but the author's test run cites another commit, so no formal approval is given. Nothing blocks this; the points below are optional. **What I ran** - Head reviewed: `1688b109186059ffdc464d2404e61009f5291af6`, base `main`. - Read the description, commit list, manifest and diff from the review folder. - Read the head of the callers in `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cpp` (lines 578–608) and the other `IndirectRegistersValid` call sites by search. - No build and no tests were run. **Results** | Check | Result | Note | |---|---|---| | Diff read (3 files) | passed | Full diff read | | Full text of changed files | not run | Only the changed hunks and search hits were read | | Unit tests (`agc_driver_pm4`, `agc_driver_graphics`) | not run | Author reports a run on `d23df92b38`, not on this head | | `check_conventions.py` | not run | Author reports a pass on `d23df92b38` | **Findings** **Blocking** None. **Non-blocking** - `docs/dev/debt/changes/fix-agc-register-offset-sentinel.md:1`: the checklist says no `.md` notes were added and that the change is generic, not specific to one title. The new file names a title ID and a game (`PPSA23566`, UFC 6). If this file is the expected technical-debt record format, the checklist should say so; otherwise the title reference could be dropped. - `core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:71` (the direct `0x69/0x76/0x79` path): a direct packet whose offset is `0xffffffff` now writes nothing, including its value dwords. The description's "the remaining entries still take effect" reads as referring to indirect list entries. The code and the new test agree on the whole-packet skip; the description could say so to avoid doubt. **Not verified** - The author's tests and convention check ran on `d23df92b38`, not on head `1688b109186059ffdc464d2404e61009f5291af6`. They were not re-run here. - The hardware claims in the debt note (how the console's graphics PFP reads a register list written after submission, and the `PPSA23566` behaviour) were not checked. They depend on hardware and traces that were not available here. - `Submission.cpp` was checked only at its call to `IndirectRegistersValid` (line 434), not in full. - The full text of `Pm4.cpp` and `tests/Pm4.cpp` was not read; the review covers the changed hunks and the call sites found by search. - `registerOffset` for `0x7a` (`SET_UCONFIG_REG_INDEX`) is still rejected by the bank check before `registerOffset` is reached; this was read from the diff context, not from an executed test. **To get this to a good state** Nothing is required. Optional, before merge: - Confirm the title reference and the "no notes added" checklist item in the debt note. - Re-run `agc_driver_pm4` and `agc_driver_graphics` on the current head `1688b109186059ffdc464d2404e61009f5291af6` and record the output in the PR, since the cited run is on another commit.
MarcZX10 commented 2026-11-20 11:08:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T11:08:53Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the inspected implementation and regression coverage support merging.

What I ran

  • Reviewed head 14aba68c24b9a2f40af7cc06eaab0341eb6a8782 against base main using the prepared diff and repo_read.py.
  • No tests or builds were run.

Results

Check Result Note
Changed code review passed All changed files and added lines reviewed
Tests and build not run No commands run

Findings

Blocking

None.

Non-blocking

None.

Not verified

  • Runtime behavior, tests, build, and hardware behavior were not verified.
  • Read: core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp, core/libs/prx/libSceAgcDriver/tests/Pm4.cpp, and docs/dev/debt/changes/fix-agc-register-offset-sentinel.md; all are listed as reviewed in the manifest. No changed files were excluded.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5991716321 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16054#pullrequestreview-5991716321). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T11:08:53Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the inspected implementation and regression coverage support merging. ## What I ran - Reviewed head `14aba68c24b9a2f40af7cc06eaab0341eb6a8782` against base `main` using the prepared diff and `repo_read.py`. - No tests or builds were run. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | All changed files and added lines reviewed | | Tests and build | not run | No commands run | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified - Runtime behavior, tests, build, and hardware behavior were not verified. - Read: `core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp`, `core/libs/prx/libSceAgcDriver/tests/Pm4.cpp`, and `docs/dev/debt/changes/fix-agc-register-offset-sentinel.md`; all are listed as reviewed in the manifest. No changed files were excluded. ## To get this to a good state Nothing is required.
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!16054
No description provided.