feat(agc): select occlusion counter blocks with PIXEL_PIPE_STAT_CONTROL #22465

Merged
B-Howell merged 4 commits from upstream-pr/22465 into main 2026-11-19 16:44:16 +00:00
B-Howell commented 2026-11-17 17:17:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by B-Howell on 2026-11-17T17:17:43Z.


What

EVENT_WRITE event type 56 (PIXEL_PIPE_STAT_CONTROL, event index 1) used to throw EVENT_WRITE event type 56 is not implemented. It now changes what later occlusion dumps do, which #1581 asked for before the event is accepted.

  • Packet layout. The second dword follows PAL's PM4_ME_EVENT_WRITE: counter_id in bits 3-8, stride in bits 9-10 and a 16-bit instance_enable in bits 11-26. Mesa writes the same fields at GFX11 init (ac_cmdbuf.c, sid.h).
  • What it changes. The queue keeps the instance_enable mask, starting at all 16 blocks. PIXEL_PIPE_STAT_DUMP then writes only the enabled blocks, on the CPU path, on the queued pipeline path and in the GPU shaders SampleCounter.comp and SampleDumps.comp. AnyPS5 counts samples for the whole target, so the lowest enabled block gets the count. Z-pass predication sums, and reads, only the enabled blocks.
  • What it changed for the title. The PS5 console's sceAgcDcbResetQueue writes 07fffc00, which enables all 16 blocks (#1581), so behaviour is unchanged for it. CUSA00900 writes 0007fc00 before each dump, which enables 8 blocks, the PS4's render backends. Before this PR its dumps wrote 16 blocks, 128 bytes past its 8-pair result.
  • What still throws. Counters other than occlusion count 0 (counts 1-3 and the screen extents), strides other than 128 bits, reserved bits and a non-zero fourth dword. Z-pass predication after a mask of 0 also throws, because the console result is not known. These are in the debt fragment.
  • Other references. shadPS4 143b58aa48 handles only SoVgtStreamoutFlush and PixelPipeStatDump (8 or 16 pairs, from Neo mode) and ignores every other event. Mesa radeonsi and RADV do not emit event 56 for queries.

Tested

Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 r7, Release, RTX 4080 SUPER, driver 621.14.

  • New tests. tests/Pm4.cpp covers validation (each refused field), the per-queue mask and predication over 8 enabled blocks and over the gap mask 0x8001. PipelinedSampleDump.cpp submits masks 0xff, 0xf0 and 0 and checks that only the enabled blocks are written and that the count lands in the first enabled block. The new agc_driver_pipelined_sample_dump_cpu entry runs that file on the CPU dump path.
  • On main (1adc0e2f4b9, with these tests): tests/Pm4.cpp does not compile, and agc_driver_pipelined_sample_dump and _drained fail with EVENT_WRITE at DWORD 7: EVENT_WRITE event type 56 is not implemented.
  • Validation. Same machine, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, Khronos layer 1.4.363.1, ctest --test-dir build-win -R "^(agc_driver_pm4|agc_driver_pipelined_sample_dump|agc_driver_pipelined_sample_dump_drained|agc_driver_pipelined_sample_dump_cpu|agc_sample_dumps|agc_uncounted_passes)$" -V:
    • this PR: 6/6 passed, 8 Insert instance layer "VK_LAYER_KHRONOS_validation", 0 VUID-, no "was not found";
    • main: 5/5 passed (no _cpu entry), 6 inserts, 0 VUID-, no "was not found".
  • AMD and software GPUs (tablefrogpillow, report, Linux, head 97826291658, Khronos validation 1.4.363, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1): agc_driver_pipelined_sample_dump, _drained and _cpu pass 3/3 on a Ryzen 7000 iGPU (RADV gfx1036, RDNA2), RX 7900 GRE (RADV gfx1100, RDNA3) and lavapipe, with no VUID- on the 7900 GRE.
  • NVIDIA on Linux (domx4q, report, Arch Linux, GCC 16.2.1 Release, head 97826291658 merged onto main 1adc0e2f4b, Khronos validation 1.4.363.1, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1): the six-test pattern passes 6/6 on an RTX 4090 (620.70.06) against 5/5 on main, with no VUID- on either and no missing-layer line.
  • Mask 0 review fix (4a2591d5840, MarcZX10's review): same machine and validation settings, six-test pattern --repeat until-fail:3. Fix 6/6, 96 layer inserts, 0 VUID-, no missing-layer line. PR head 97826291658 with the new check: agc_driver_pm4 fails (expected PM4 rejection), the other 5 pass, 0 VUID-. Main 89b0eef7ab4: 5/5 (no _cpu entry), 0 VUID-.
  • Queue reset review fix (dbdd911e25e, MarcZX10's second review): tests/Pm4.cpp now checks that CLEAR_STATE and a CONTEXT_STATE clear keep the block mask and the dispatch reset restores all 16 blocks; test only, no driver change. Same machine and validation settings, six-test pattern --repeat until-fail:3: fix 6/6, 24 layer inserts, 0 VUID-, no missing-layer line. Main 2e22ad2062c: 5/5 (no _cpu entry), 18 inserts, 0 VUID-.
  • Predication read review fix (7679aea782f, MarcZX10's third review): Z-pass predication now reads each enabled counter pair on its own instead of every pair up to the highest enabled block, and tests/Pm4.cpp checks the gap mask 0x8001 (gap blocks unwritten, samples in a disabled block ignored, samples and an unwritten pair in block 15). Same machine and validation settings, six-test pattern --repeat until-fail:3: fix 6/6, 24 layer inserts, 0 VUID-, no missing-layer line. Main bef2f1f77d4: 5/5 (no _cpu entry), 18 inserts, 0 VUID-.
  • AMD on Linux, read-range guard (JJenkx, report, RX 6650 XT, RADV 26.2.7, Khronos validation 1.4.363, 7679aea782f inside the #22535 stack on current main): a test-only guard that allows reads of enabled counter pairs only fails the old bulk reader at the disabled prefix (16 pass, 1 expected failure) and passes this reader (17 pass), with no skips and no VUID-. The guard test lives in #22535.
  • Title. CUSA00900 (Bloodborne 1.09), on a local tree with the open PS4 PRs it needs (#17105, #22328, #22439 and others), windowed, two runs.
    • Without this PR, Continue stopped at about 69 s on the item-tip loading screen with EVENT_WRITE event type 56 is not implemented.
    • With it, both runs got through the whole loading screen. They then crashed in the title's own heap code at the hand-over to gameplay (about 143 s and 115 s). The crash is the same guest read in both runs: a heap block header overwritten with non-pointer data. That is a separate stop, unrelated to occlusion dumps (the value has no bit 63).
  • check_conventions passes. pr_overlap reports same-line overlaps with #12568 (dumpSampleCounters), #17943 and #18029 (foldSamples signature); none of them implements this.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: CUSA00900 Bloodborne #3094
  • GPUs tested: RTX 4080 SUPER / 621.14 / Windows 11 Pro 10.0.26300; RX 7900 GRE, Ryzen 7000 iGPU and lavapipe / RADV, Linux (tablefrogpillow); RTX 4090 / 620.70.06 / Arch Linux (domx4q)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5361585515 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22465). Originally posted by [B-Howell](https://github.com/B-Howell) on 2026-11-17T17:17:43Z. --- ### What `EVENT_WRITE` event type 56 (`PIXEL_PIPE_STAT_CONTROL`, event index 1) used to throw `EVENT_WRITE event type 56 is not implemented`. It now changes what later occlusion dumps do, which #1581 asked for before the event is accepted. - **Packet layout.** The second dword follows [PAL's `PM4_ME_EVENT_WRITE`](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/hw/gfxip/gfx9/chip/gfx9_plus_merged_f32_me_pm4_packets.h#L1680-L1745): `counter_id` in bits 3-8, `stride` in bits 9-10 and a 16-bit `instance_enable` in bits 11-26. Mesa writes the same fields at GFX11 init ([ac_cmdbuf.c](https://gitlab.freedesktop.org/mesa/mesa/-/blob/0b97dcdd9424fce130054e1972a610b765644003/src/amd/common/ac_cmdbuf.c#L619-L624), [sid.h](https://gitlab.freedesktop.org/mesa/mesa/-/blob/0b97dcdd9424fce130054e1972a610b765644003/src/amd/common/sid.h#L168-L176)). - **What it changes.** The queue keeps the `instance_enable` mask, starting at all 16 blocks. `PIXEL_PIPE_STAT_DUMP` then writes only the enabled blocks, on the CPU path, on the queued pipeline path and in the GPU shaders `SampleCounter.comp` and `SampleDumps.comp`. AnyPS5 counts samples for the whole target, so the lowest enabled block gets the count. Z-pass predication sums, and reads, only the enabled blocks. - **What it changed for the title.** The PS5 console's `sceAgcDcbResetQueue` writes `07fffc00`, which enables all 16 blocks (#1581), so behaviour is unchanged for it. CUSA00900 writes `0007fc00` before each dump, which enables 8 blocks, the PS4's render backends. Before this PR its dumps wrote 16 blocks, 128 bytes past its 8-pair result. - **What still throws.** Counters other than occlusion count 0 (counts 1-3 and the screen extents), strides other than 128 bits, reserved bits and a non-zero fourth dword. Z-pass predication after a mask of 0 also throws, because the console result is not known. These are in the debt fragment. - **Other references.** shadPS4 [`143b58aa48`](https://github.com/shadps4-emu/shadPS4/blob/143b58aa48/src/video_core/amdgpu/liverpool.cpp#L700-L721) handles only `SoVgtStreamoutFlush` and `PixelPipeStatDump` (8 or 16 pairs, from Neo mode) and ignores every other event. Mesa radeonsi and RADV do not emit event 56 for queries. ### Tested Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 r7, Release, RTX 4080 SUPER, driver 621.14. - **New tests.** `tests/Pm4.cpp` covers validation (each refused field), the per-queue mask and predication over 8 enabled blocks and over the gap mask `0x8001`. `PipelinedSampleDump.cpp` submits masks `0xff`, `0xf0` and `0` and checks that only the enabled blocks are written and that the count lands in the first enabled block. The new `agc_driver_pipelined_sample_dump_cpu` entry runs that file on the CPU dump path. - **On main** (`1adc0e2f4b9`, with these tests): `tests/Pm4.cpp` does not compile, and `agc_driver_pipelined_sample_dump` and `_drained` fail with `EVENT_WRITE at DWORD 7: EVENT_WRITE event type 56 is not implemented`. - **Validation.** Same machine, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer`, Khronos layer 1.4.363.1, `ctest --test-dir build-win -R "^(agc_driver_pm4|agc_driver_pipelined_sample_dump|agc_driver_pipelined_sample_dump_drained|agc_driver_pipelined_sample_dump_cpu|agc_sample_dumps|agc_uncounted_passes)$" -V`: - this PR: 6/6 passed, 8 `Insert instance layer "VK_LAYER_KHRONOS_validation"`, 0 `VUID-`, no "was not found"; - main: 5/5 passed (no `_cpu` entry), 6 inserts, 0 `VUID-`, no "was not found". - **AMD and software GPUs** (tablefrogpillow, [report](https://github.com/boykopovar/AnyPS5/pull/22465#issuecomment-6956043921), Linux, head `97826291658`, Khronos validation 1.4.363, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`): `agc_driver_pipelined_sample_dump`, `_drained` and `_cpu` pass 3/3 on a Ryzen 7000 iGPU (RADV gfx1036, RDNA2), RX 7900 GRE (RADV gfx1100, RDNA3) and lavapipe, with no `VUID-` on the 7900 GRE. - **NVIDIA on Linux** (domx4q, [report](https://github.com/boykopovar/AnyPS5/pull/22465#issuecomment-6957299047), Arch Linux, GCC 16.2.1 Release, head `97826291658` merged onto main `1adc0e2f4b`, Khronos validation 1.4.363.1, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`): the six-test pattern passes 6/6 on an RTX 4090 (620.70.06) against 5/5 on main, with no `VUID-` on either and no missing-layer line. - **Mask 0 review fix** (`4a2591d5840`, MarcZX10's review): same machine and validation settings, six-test pattern `--repeat until-fail:3`. Fix 6/6, 96 layer inserts, 0 `VUID-`, no missing-layer line. PR head `97826291658` with the new check: `agc_driver_pm4` fails (`expected PM4 rejection`), the other 5 pass, 0 `VUID-`. Main `89b0eef7ab4`: 5/5 (no `_cpu` entry), 0 `VUID-`. - **Queue reset review fix** (`dbdd911e25e`, MarcZX10's second review): `tests/Pm4.cpp` now checks that `CLEAR_STATE` and a `CONTEXT_STATE` clear keep the block mask and the dispatch reset restores all 16 blocks; test only, no driver change. Same machine and validation settings, six-test pattern `--repeat until-fail:3`: fix 6/6, 24 layer inserts, 0 `VUID-`, no missing-layer line. Main `2e22ad2062c`: 5/5 (no `_cpu` entry), 18 inserts, 0 `VUID-`. - **Predication read review fix** (`7679aea782f`, MarcZX10's third review): Z-pass predication now reads each enabled counter pair on its own instead of every pair up to the highest enabled block, and `tests/Pm4.cpp` checks the gap mask `0x8001` (gap blocks unwritten, samples in a disabled block ignored, samples and an unwritten pair in block 15). Same machine and validation settings, six-test pattern `--repeat until-fail:3`: fix 6/6, 24 layer inserts, 0 `VUID-`, no missing-layer line. Main `bef2f1f77d4`: 5/5 (no `_cpu` entry), 18 inserts, 0 `VUID-`. - **AMD on Linux, read-range guard** (JJenkx, [report](https://github.com/boykopovar/AnyPS5/pull/22465#issuecomment-6963780907), RX 6650 XT, RADV 26.2.7, Khronos validation 1.4.363, `7679aea782f` inside the #22535 stack on current main): a test-only guard that allows reads of enabled counter pairs only fails the old bulk reader at the disabled prefix (16 pass, 1 expected failure) and passes this reader (17 pass), with no skips and no `VUID-`. The guard test lives in #22535. - **Title.** CUSA00900 (Bloodborne 1.09), on a local tree with the open PS4 PRs it needs (#17105, #22328, #22439 and others), windowed, two runs. - Without this PR, Continue stopped at about 69 s on the item-tip loading screen with `EVENT_WRITE event type 56 is not implemented`. - With it, both runs got through the whole loading screen. They then crashed in the title's own heap code at the hand-over to gameplay (about 143 s and 115 s). The crash is the same guest read in both runs: a heap block header overwritten with non-pointer data. That is a separate stop, unrelated to occlusion dumps (the value has no bit 63). - `check_conventions` passes. `pr_overlap` reports same-line overlaps with #12568 (`dumpSampleCounters`), #17943 and #18029 (`foldSamples` signature); none of them implements this. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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) and the licence notice of code adapted from upstream (see AGENTS.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: CUSA00900 Bloodborne #3094 - [x] GPUs tested: RTX 4080 SUPER / 621.14 / Windows 11 Pro 10.0.26300; RX 7900 GRE, Ryzen 7000 iGPU and lavapipe / RADV, Linux (tablefrogpillow); RTX 4090 / 620.70.06 / Arch Linux (domx4q) - [x] AI-assisted: yes
MarcZX10 commented 2026-11-17 18:08:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T18:08:01Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head reviewed: 97826291658959a1dcac3c01dc414f468d60ac31, base main. No merged-preview check.
  • Read the review folder (description, commits, manifest, diff) and the head through the repository reader (repo_read.py, search and line-range reads).
  • No build and no tests were run in this review; the review is by reading only.
  • Author-reported runs (Windows, RADV, lavapipe, CUSA00900) are not counted as checks I ran.

Results

Check Result Note
Build and unit tests not run No build in this review
Changed hunks read passed 16 of 16 listed files, by diff hunk
Targeted context read passed Pm4.cpp 700-735 and 1170-1200, VulkanDevice.cpp 3208-3228, Pm4.hpp 1-20
Shader compile not run SampleCounter.comp, SampleDumps.comp read from the diff only
Author-reported GPU runs not run Author report, not re-run

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:715: when a queue's mask is 0, PredicationPasses reads no counter pair and skips every block, so the Z-pass predicate sums to zero and evaluates as "no samples" without the "never written" check. The debt note does not say what the console does here, and no test covers mask 0. Either state the intended result in the debt note, or add a test that pins it.

Sources

Commit-pinned lines at the head:

Not verified

  • PAL packet layout and the stride encoding (2 = 128 bits): the linked PAL header was not fetched.
  • Console behaviour: whether predication reads disabled blocks, what sceAgcDcbResetQueue writes, and the CUSA00900 title run. These are the author's reports and are not confirmed here.
  • Test results: the GPU, CPU and validation-layer runs are author-reported and were not re-run.
  • Shaders: SampleCounter.comp and SampleDumps.comp were read from the diff; they were not compiled.
  • core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp is too large for the review folder. Only the changed lines at 3210 and 3225 were read, through the reader. The full file was not read.
  • Other changed files were read by hunk. Code outside the hunks and their direct callers was not read.

To get this to a good state

Nothing is required.

The optional point is listed under Non-blocking above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5943976617 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22465#pullrequestreview-5943976617). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T18:08:01Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head reviewed: `97826291658959a1dcac3c01dc414f468d60ac31`, base `main`. No merged-preview check. - Read the review folder (description, commits, manifest, diff) and the head through the repository reader (`repo_read.py`, search and line-range reads). - No build and no tests were run in this review; the review is by reading only. - Author-reported runs (Windows, RADV, lavapipe, CUSA00900) are not counted as checks I ran. ## Results | Check | Result | Note | | --- | --- | --- | | Build and unit tests | not run | No build in this review | | Changed hunks read | passed | 16 of 16 listed files, by diff hunk | | Targeted context read | passed | Pm4.cpp 700-735 and 1170-1200, VulkanDevice.cpp 3208-3228, Pm4.hpp 1-20 | | Shader compile | not run | `SampleCounter.comp`, `SampleDumps.comp` read from the diff only | | Author-reported GPU runs | not run | Author report, not re-run | ## Findings ### Blocking None. ### Non-blocking - `core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:715`: when a queue's mask is 0, `PredicationPasses` reads no counter pair and skips every block, so the Z-pass predicate sums to zero and evaluates as "no samples" without the "never written" check. The debt note does not say what the console does here, and no test covers mask 0. Either state the intended result in the debt note, or add a test that pins it. ## Sources Commit-pinned lines at the head: - Validation of `PIXEL_PIPE_STAT_CONTROL`: https://github.com/boykopovar/AnyPS5/blob/97826291658959a1dcac3c01dc414f468d60ac31/core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp#L494-L501 - Mask set on the control packet: https://github.com/boykopovar/AnyPS5/blob/97826291658959a1dcac3c01dc414f468d60ac31/core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp#L1211-L1214 - Queue reset makes a new `QueueState`, so the mask returns to 16 blocks: https://github.com/boykopovar/AnyPS5/blob/97826291658959a1dcac3c01dc414f468d60ac31/core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp#L1170 - Z-pass predication over enabled blocks: https://github.com/boykopovar/AnyPS5/blob/97826291658959a1dcac3c01dc414f468d60ac31/core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp#L708-L734 ## Not verified - PAL packet layout and the stride encoding (2 = 128 bits): the linked PAL header was not fetched. - Console behaviour: whether predication reads disabled blocks, what `sceAgcDcbResetQueue` writes, and the CUSA00900 title run. These are the author's reports and are not confirmed here. - Test results: the GPU, CPU and validation-layer runs are author-reported and were not re-run. - Shaders: `SampleCounter.comp` and `SampleDumps.comp` were read from the diff; they were not compiled. - `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` is too large for the review folder. Only the changed lines at 3210 and 3225 were read, through the reader. The full file was not read. - Other changed files were read by hunk. Code outside the hunks and their direct callers was not read. ## To get this to a good state Nothing is required. The optional point is listed under Non-blocking above.
MarcZX10 commented 2026-11-17 19:09:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T19:09:36Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head 4a2591d5840b0d908713304a3aef0580a24b4f83, base main. No merged-preview check.
  • No build and no test run. Builds are not part of this review.
  • Reader searches and reads at head:
python3 repo_read.py search sampleDumpBlocks core/libs/prx/libSceAgcDriver
python3 repo_read.py search ResetQueue core/libs/prx/libSceAgcDriver
python3 repo_read.py search ClearContext core/libs/prx/libSceAgcDriver
python3 repo_read.py search DumpSamples core/libs/prx
python3 repo_read.py search foldSamples core/libs/prx
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp 3207 3228

Results

Check Result Note
Build and unit tests not run out of scope for this review
Author-reported GPU and console runs not applicable taken from the description, not reproduced
Changed lines in the 16 reviewed files passed read in the diff
Head context for changed functions passed limits under Not verified

Findings

Blocking

None.

Non-blocking

  1. docs/dev/debt/changes/claude-agc-pixel-pipe-stat-control.md:5 says the block mask "returns to that on a queue reset". The mask is set only by the QueueState default (core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp:306). ClearContext, which CLEAR_STATE and the context-state packet call (core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:1180 and :1200), does not touch the mask. A search for a queue-reset path at head found none. Either the reset lives outside this diff or the sentence is wrong. Reword it, or point to the code that resets the mask.
  2. core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp:376 gives DumpSamples a default of 0xffffu, and :907 does the same for foldSamples. Every current caller passes the queue's mask, or passes target 0 where the mask is unused (Recorder.cpp:4704). A future caller that leaves the argument out would dump all 16 blocks and ignore PIXEL_PIPE_STAT_CONTROL. Consider removing the default so a missing argument fails to compile. The calls in tests/Recorder.cpp would then need the mask passed.

Not verified

  • No build and no test run. The GPU and console results in the description are the author's; I did not reproduce them.
  • The console values (07fffc00, 0007fc00), the Bloodborne CUSA00900 run and the heap crash are not checked here.
  • The PAL, Mesa and shadPS4 links were not opened. No point in this review depends on them.
  • Read: the diff for all 16 reviewed files. Head context: VulkanDevice.cpp lines 3207–3228 (the full file is too large for the review folder, so only the changed function was read), and Pm4.cpp lines 700–733 and 1172–1203 from the review folder, plus the includes of Pm4.hpp. The other changed functions (PacketExecution.cpp, PacketMemory.cpp, Recorder.cpp, both shaders, PipelinedSampleDump.cpp, tests/Pm4.cpp) were judged from their hunks, not their full surrounding text.
  • Excluded by rule: none. files.json lists no excluded files.

To get this to a good state

Nothing is required.

Optional: the two points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5944859799 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22465#pullrequestreview-5944859799). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T19:09:36Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head `4a2591d5840b0d908713304a3aef0580a24b4f83`, base `main`. No merged-preview check. - No build and no test run. Builds are not part of this review. - Reader searches and reads at head: ``` python3 repo_read.py search sampleDumpBlocks core/libs/prx/libSceAgcDriver python3 repo_read.py search ResetQueue core/libs/prx/libSceAgcDriver python3 repo_read.py search ClearContext core/libs/prx/libSceAgcDriver python3 repo_read.py search DumpSamples core/libs/prx python3 repo_read.py search foldSamples core/libs/prx python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp 3207 3228 ``` ## Results | Check | Result | Note | |---|---|---| | Build and unit tests | not run | out of scope for this review | | Author-reported GPU and console runs | not applicable | taken from the description, not reproduced | | Changed lines in the 16 reviewed files | passed | read in the diff | | Head context for changed functions | passed | limits under Not verified | ## Findings **Blocking** None. **Non-blocking** 1. `docs/dev/debt/changes/claude-agc-pixel-pipe-stat-control.md:5` says the block mask "returns to that on a queue reset". The mask is set only by the `QueueState` default (`core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp:306`). `ClearContext`, which `CLEAR_STATE` and the context-state packet call (`core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:1180` and `:1200`), does not touch the mask. A search for a queue-reset path at head found none. Either the reset lives outside this diff or the sentence is wrong. Reword it, or point to the code that resets the mask. 2. `core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp:376` gives `DumpSamples` a default of `0xffffu`, and `:907` does the same for `foldSamples`. Every current caller passes the queue's mask, or passes target 0 where the mask is unused (`Recorder.cpp:4704`). A future caller that leaves the argument out would dump all 16 blocks and ignore `PIXEL_PIPE_STAT_CONTROL`. Consider removing the default so a missing argument fails to compile. The calls in `tests/Recorder.cpp` would then need the mask passed. ## Not verified - No build and no test run. The GPU and console results in the description are the author's; I did not reproduce them. - The console values (`07fffc00`, `0007fc00`), the Bloodborne CUSA00900 run and the heap crash are not checked here. - The PAL, Mesa and shadPS4 links were not opened. No point in this review depends on them. - Read: the diff for all 16 reviewed files. Head context: `VulkanDevice.cpp` lines 3207–3228 (the full file is too large for the review folder, so only the changed function was read), and `Pm4.cpp` lines 700–733 and 1172–1203 from the review folder, plus the includes of `Pm4.hpp`. The other changed functions (`PacketExecution.cpp`, `PacketMemory.cpp`, `Recorder.cpp`, both shaders, `PipelinedSampleDump.cpp`, `tests/Pm4.cpp`) were judged from their hunks, not their full surrounding text. - Excluded by rule: none. `files.json` lists no excluded files. ## To get this to a good state Nothing is required. Optional: the two points above.
MarcZX10 commented 2026-11-17 20:56:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T20:56:27Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head dbdd911e25e8edecfbb4e9a7b65cab3534ac933c, base main. No merged-preview check.
  • Read all 17 changed files through diff.patch. No changed file was read in full: VulkanDevice.cpp is too large for files/, and only its two changed hunks were read. Excluded by rule: none.
  • Read the description and commits, and the review sections of the house rules.
  • Checked surrounding code with repo_read.py (7 calls, listed below).
  • Nothing was built or tested in this run.

Results

Check Result Note
Diff read, 17 files passed Changed lines only
Full files read not run No file read in full
Build and ctest not run Not built here
Surrounding code passed Reader searches and one range read
Commands
repo_read.py search sampleDumpBlocks
repo_read.py search SampleCounterPushBytes
repo_read.py search ClearContext core/libs/prx/libSceAgcDriver/Execution
repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp 1174 1202

Findings

Blocking

None.

Non-blocking

  1. core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:716: the Z-pass predication read covers every counter pair from block 0 up to the highest enabled block, not only the enabled blocks. The sum skips the disabled ones (Pm4.cpp:720), so the result holds. The PR text and the debt note say the read touches only enabled blocks, which is not what the code does. Either correct the wording or read each enabled block on its own. The wider read can also reach past an 8-pair result when a high block is enabled. I did not check the buffer size a game allocates.
  2. core/libs/prx/libSceAgcDriver/tests/Pm4.cpp:1206: the predication tests use only the 8-block mask and mask 0. No predication test uses a gap mask such as 0x8001, so a regression in the point above would pass the suite.

Not verified

  • Build, ctest, and the GPU, driver and console runs in the PR body: not run here. They are author-reported only.
  • core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp: only the two changed hunks were read, not the whole file.
  • The dispatch reset that restores all 16 blocks (core/libs/prx/libSceAgcDriver/tests/Pm4.cpp:1082): the reader did not find the production path. The test asserts it, but I did not run the test.
  • The read size of the predication: PredicationBytes was replaced by a pair count. I did not read PredicationBytes, so I cannot compare the old and new read sizes.
  • The GLSL changes in SampleCounter.comp and SampleDumps.comp: not compiled. The push-constant size is checked only by the C++ static_assert.
  • Stride value 2 (128 bits), the PAL and Mesa layouts, and the shadPS4 links: not checked against their sources.
  • The CUSA00900 run, the title crash analysis, check_conventions and pr_overlap: not checked.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5946483222 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22465#pullrequestreview-5946483222). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T20:56:27Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head `dbdd911e25e8edecfbb4e9a7b65cab3534ac933c`, base `main`. No merged-preview check. - Read all 17 changed files through `diff.patch`. No changed file was read in full: `VulkanDevice.cpp` is too large for `files/`, and only its two changed hunks were read. Excluded by rule: none. - Read the description and commits, and the review sections of the house rules. - Checked surrounding code with `repo_read.py` (7 calls, listed below). - Nothing was built or tested in this run. ## Results | Check | Result | Note | |---|---|---| | Diff read, 17 files | passed | Changed lines only | | Full files read | not run | No file read in full | | Build and ctest | not run | Not built here | | Surrounding code | passed | Reader searches and one range read | <details> <summary>Commands</summary> ``` repo_read.py search sampleDumpBlocks repo_read.py search SampleCounterPushBytes repo_read.py search ClearContext core/libs/prx/libSceAgcDriver/Execution repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp 1174 1202 ``` </details> ## Findings ### Blocking None. ### Non-blocking 1. `core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:716`: the Z-pass predication read covers every counter pair from block 0 up to the highest enabled block, not only the enabled blocks. The sum skips the disabled ones (`Pm4.cpp:720`), so the result holds. The PR text and the debt note say the read touches only enabled blocks, which is not what the code does. Either correct the wording or read each enabled block on its own. The wider read can also reach past an 8-pair result when a high block is enabled. I did not check the buffer size a game allocates. 2. `core/libs/prx/libSceAgcDriver/tests/Pm4.cpp:1206`: the predication tests use only the 8-block mask and mask 0. No predication test uses a gap mask such as 0x8001, so a regression in the point above would pass the suite. ## Not verified - Build, ctest, and the GPU, driver and console runs in the PR body: not run here. They are author-reported only. - `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`: only the two changed hunks were read, not the whole file. - The dispatch reset that restores all 16 blocks (`core/libs/prx/libSceAgcDriver/tests/Pm4.cpp:1082`): the reader did not find the production path. The test asserts it, but I did not run the test. - The read size of the predication: `PredicationBytes` was replaced by a pair count. I did not read `PredicationBytes`, so I cannot compare the old and new read sizes. - The GLSL changes in `SampleCounter.comp` and `SampleDumps.comp`: not compiled. The push-constant size is checked only by the C++ `static_assert`. - Stride value 2 (128 bits), the PAL and Mesa layouts, and the shadPS4 links: not checked against their sources. - The CUSA00900 run, the title crash analysis, `check_conventions` and `pr_overlap`: not checked. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-17 21:54:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T21:54:09Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head reviewed: 7679aea782f801b37350caac9d90957b6e4f2d30, base main.
  • Read description.md, commits.md, manifest.json, files.json and diff.patch from the review folder.
  • Read repository text at the head with repo_read.py:
python3 repo_read.py search "case 0x46" core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
python3 repo_read.py search "PredicationBytes" core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
python3 repo_read.py search "include" core/libs/prx/libSceAgcDriver/Execution/include/Pm4.hpp
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp 280 292
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp 1196 1216
  • I ran no build and no test. The test results in the description are the author's reports, not mine.

Results

Check Result Note
Changed hunks read passed 16 of 16 reviewed files, from diff.patch
Full file text read not run only the Pm4.cpp ranges above
Build and ctest not run author-reported only
Vulkan validation not run author-reported only

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:718: Z-pass predication now makes one GuestMemory::Read per enabled block, up to 16 small reads per predicated packet, where the old code made one bulk read. The logic reads correctly. The cost is not measured. One read of the enabled pairs would keep the old call count.
  • core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp:376: the default 0xffffu repeats AllSampleDumpBlocks from QueueState.hpp as a literal. The same literal is the default at line 907 for foldSamples. Using the constant would keep the value in one place, if this header can reach it.

Not verified

  • Build, the six-test ctest pattern and the Khronos validation run were not run by me. The GPU results (RTX 4080 SUPER, RTX 4090, RX 7900 GRE, Ryzen 7000 iGPU, lavapipe) are the author's and the reviewers' reports.
  • The claim that tests/Pm4.cpp does not compile on main was not checked.
  • The CUSA00900 title result, and the heap crash after the loading screen, were not checked.
  • Console behaviour of PIXEL_PIPE_STAT_CONTROL (CLEAR_STATE keeping the mask, predication on disabled blocks) cannot be checked here. The debt file says it is not measured on a console.
  • Full text of the changed files beyond the hunks was not read, including VulkanDevice.cpp, which is too large for the review folder.
  • The event is COMMENT, not APPROVE, because no check was run and the full files were not read.

To get this to a good state

Nothing is required. The non-blocking points above are optional.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5947242261 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22465#pullrequestreview-5947242261). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T21:54:09Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head reviewed: `7679aea782f801b37350caac9d90957b6e4f2d30`, base `main`. - Read `description.md`, `commits.md`, `manifest.json`, `files.json` and `diff.patch` from the review folder. - Read repository text at the head with `repo_read.py`: ``` python3 repo_read.py search "case 0x46" core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp python3 repo_read.py search "PredicationBytes" core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp python3 repo_read.py search "include" core/libs/prx/libSceAgcDriver/Execution/include/Pm4.hpp python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp 280 292 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp 1196 1216 ``` - I ran no build and no test. The test results in the description are the author's reports, not mine. ## Results | Check | Result | Note | |---|---|---| | Changed hunks read | passed | 16 of 16 reviewed files, from `diff.patch` | | Full file text read | not run | only the `Pm4.cpp` ranges above | | Build and ctest | not run | author-reported only | | Vulkan validation | not run | author-reported only | ## Findings ### Blocking None. ### Non-blocking - `core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:718`: Z-pass predication now makes one `GuestMemory::Read` per enabled block, up to 16 small reads per predicated packet, where the old code made one bulk read. The logic reads correctly. The cost is not measured. One read of the enabled pairs would keep the old call count. - `core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp:376`: the default `0xffffu` repeats `AllSampleDumpBlocks` from `QueueState.hpp` as a literal. The same literal is the default at line 907 for `foldSamples`. Using the constant would keep the value in one place, if this header can reach it. ## Not verified - Build, the six-test ctest pattern and the Khronos validation run were not run by me. The GPU results (RTX 4080 SUPER, RTX 4090, RX 7900 GRE, Ryzen 7000 iGPU, lavapipe) are the author's and the reviewers' reports. - The claim that `tests/Pm4.cpp` does not compile on `main` was not checked. - The CUSA00900 title result, and the heap crash after the loading screen, were not checked. - Console behaviour of `PIXEL_PIPE_STAT_CONTROL` (CLEAR_STATE keeping the mask, predication on disabled blocks) cannot be checked here. The debt file says it is not measured on a console. - Full text of the changed files beyond the hunks was not read, including `VulkanDevice.cpp`, which is too large for the review folder. - The event is COMMENT, not APPROVE, because no check was run and the full files were not read. ## To get this to a good state Nothing is required. The non-blocking points above are optional.
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!22465
No description provided.