feat(agc): write RELEASE_MEM DATA_SEL 4 for PS4 guests as an 800 MHz count #9893

Merged
savvaniss merged 7 commits from upstream-pr/9893 into main 2026-11-14 03:35:09 +00:00
savvaniss commented 2026-10-22 20:49:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-22T20:49:33Z.


What

Get-fix/AnyPS5#19, moved upstream as Get-fix asked. #9431 is on main now, so this PR's diff is only the change below.

PS4 titles write the GPU's 64-bit counter with EVENT_WRITE_EOP and DATA_SEL = 4, and #6977's libSceGnmDriver lowers that packet to a RELEASE_MEM with the same selector. main (#7911) throws for DATA_SEL = 4 because the PS5 counter is not known. Gang Beasts and the Hasbro Family Fun Pack (CUSA03312) both write it, and the Hasbro bring-up has been running on a local 100 MHz stand-in.

ntamas94 measured the counter on a PS4 Pro in base mode (FW 10.71), with the packets Gang Beasts writes, timed against the TSC over 124 s:

  • DATA_SEL = 4 advances at 798.017 MHz of console time. That is 0.25% under the 800 MHz that sceGnmGetGpuCoreClockFrequency() reports and that Gang Beasts divides by.
  • It read zero about 2 s before the measuring app started, not at power-on.

This PR applies that rule:

  • For a GCN guest (ShaderRecompiler::GcnGuestShaders()), RELEASE_MEM with DATA_SEL = 4 writes an 800 MHz count of the host's steady clock. The count starts at zero when libSceAgcDriver loads. It is written wherever the driver resolves the packet: on execution, as a deferred label (DecodeLabelWrite), and as a run-time store in DecodeStores.
  • A PS5 guest's DATA_SEL = 4 still throws "RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented", as #7911 does on main. DATA_SEL = 5 still throws as GDS data, and 6 and 7 still throw as reserved.
  • The DATA_SEL = 3 value moved into the same helper (ReleaseMemValue) unchanged.

What it does not do, recorded in docs/dev/debt/libSceAgcDriver.md:

  • Neo mode keeps the 800 MHz rate. The measurement was in base mode, and the Neo rate is not known. main's libSceGnmDriverForNeoMode reports 911 MHz from sceGnmGetGpuCoreClockFrequency, so in Neo mode the two values differ.
  • The same measurement found PS4 DATA_SEL = 3 to be the TSC divided by 16, a 40-bit count. The driver still writes 100 MHz of the host's steady clock for it.
  • Both selectors are sampled when the queue worker decodes the packet, not when the end-of-pipe event completes. A deferred label is stored after the GPU work with the value from decode time, so the difference of two writes measures queue processing, not GPU time.

#6977's libSceGnmDriver does not export sceGnmGetGpuCoreClockFrequency, so on that path there is no second value to keep in step with.

shadPS4 names the selector PerfCounter and writes the TSC scaled to the GPU core clock.

Nothing in it depends on the title.

Tested

Windows 11 Pro 26300, WinLibs GCC 15.2.0, Release, AMD Radeon RX 9070 XT (driver 32.0.31041.1004), ANYPS5_GPU=AMD.

Base. This branch is now 5c52198a02, which is main 5b913d40c6 merged in, plus a debt-entry commit. Every file #9431 touched takes main's version. git diff 5b913d40c6 5c52198a02 holds three files: Execution/src/Pm4.cpp, tests/Pm4.cpp and the RELEASE_MEM debt entry. git merge-tree with main fae9e483bb, 19 commits later, has no conflicts; that merge was not built.

  • agc_driver_pm4 has testGcnReleaseMemSystemCounter. With GCN shaders on, two RELEASE_MEM packets are executed 20 ms apart, and the test checks three things:

    • the first value is under 60 s of ticks;
    • the delta lies between steady-clock reads taken around the two packets, converted to 800 MHz;
    • the packet resolves as an 8-byte label and decodes as an 8-byte run-time store.
  • Revert checks on 5c52198a02, one rebuild each; agc_driver_pm4 fails every time and passes again with the file restored:

    Removed Failure
    All of Execution/src/Pm4.cpp, as on 5b913d40c6 RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented
    DecodeLabelWrite accepting 4 a GCN DATA_SEL 4 RELEASE_MEM did not resolve as an 8-byte label
    DecodeStores treating 4 as run-time a GCN DATA_SEL 4 RELEASE_MEM did not decode as an 8-byte run-time store
    The 800 MHz rate (set to 100 MHz) the GCN DATA_SEL 4 counter does not advance at 800 MHz
    The start at library load (steady clock's epoch instead) the GCN DATA_SEL 4 counter did not start near zero
  • Validation layer: run with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest -V, on main 5b913d40c6 and on this branch. The 58 tests:

    • agc_driver_pm4, agc_driver_pm4_replay, agc_driver, agc_driver_graphics, agc_driver_register_key, agc_driver_gcn_detile and agc_driver_pattern_buffer_fill
    • agc_driver_flip and the 17 video_out_flip_* modes
    • agc_gcn_decode, texture_format_lookup, agc_driver_resource_cache_replaced_texture and agc_depth_copy_kept_bytes
    • the 29 agc_driver_depth_* tests

    Results:

    • main: 58 of 58 pass.
    • This branch: 58 of 58 pass.
    • Neither log has a VUID- line or was not found but was requested by env var VK_INSTANCE_LAYERS. All 49 Selected GPU lines in each log name the RX 9070 XT. The PM4 tests themselves create no Vulkan device, so the layer says nothing about them.
  • Linux: WSL Ubuntu, g++ 15.2.0, cmake 4.2.3, Unix Makefiles, -j4, from a git archive of this code on the Linux filesystem.

    • A plain configure stops at CMakeLists.txt:513 and :521, because the machine has no X11 or audio development packages. In that local copy only, those two FATAL_ERRORs became warnings. FFmpeg came from the project's ffmpeg-linux-x64.zip through FFMPEG_PREBUILT_DIR.
    • Built: shader_recompiler_agc_driver, agc_driver_pm4_tests and agc_driver_graphics_tests, and so all of libSceAgcDriver. That includes Graphics/src/PipelineJournal.cpp and core/shader/recompiler/ShaderDiskCache.cpp, with their __linux__ && __x86_64__ && __GLIBCXX__ size guards active.
    • Ran: agc_driver_pm4 and agc_driver_graphics, 2 of 2 pass. No Selected GPU line: no GPU ran there.
    • Not run on Linux: every other test, anything on a GPU, and any build with SDL's X11 or audio backends.
  • CUSA03312: the Hasbro titles ran on ps4/limbo-gpu at 93eeee0141 (#6977's head then) on a local 100 MHz stand-in for this until Get-fix/AnyPS5#19. Not rerun on this base: the titles also need #9432.

  • tools/check_conventions.py --base origin/main passes.

  • tools/pr_overlap.py --branch feat/gcn-release-mem-perf-counter, against main fae9e483bb:

    • #12568 conflicts with this PR's own lines: it changes the GuestMemory::Write beside ReleaseMemValue in Execute. The two compose, and whichever lands second resolves it.
    • 57 pull requests conflict with main themselves, so the tool could not compare them. All share the debt file or one of the two Pm4.cpp files: #6188, #6549 and #10249 change Execution/src/Pm4.cpp, and #6185, #6186 and #6549 change tests/Pm4.cpp.

Merge of main 4180951e90, 5 Nov. Head a87d435d96. A clean merge to rerun CI. On be678bc388, the windows job stopped compiling Graphics/src/DepthSurface.cpp:1623 ("cannot convert 'VkMemoryAllocateInfo' to 'const VkImageCreateInfo&'"). That file isn't in this PR: the error came from main of that hour, where #15301's call and #15855's new allocate signature met. main 4180951e90 compiles it.

  • Runs. Windows, WinLibs GCC, Release: agc_driver_pm4, agc_driver_pm4_replay, agc_driver_pm4_replay_tool and agc_driver_graphics pass, 4 of 4, in one run. They run on the mock device, so no Vulkan device is selected.
  • Not rerun: the depth tests and Linux. check_conventions.py passes.

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: CUSA03312 #7198
  • GPUs tested: AMD Radeon RX 9070 XT, driver 32.0.31041.1004, Windows 11 Pro 26300
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4973928269 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9893). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-22T20:49:33Z. --- ### What Get-fix/AnyPS5#19, moved upstream as Get-fix asked. #9431 is on `main` now, so this PR's diff is only the change below. PS4 titles write the GPU's 64-bit counter with `EVENT_WRITE_EOP` and `DATA_SEL = 4`, and #6977's libSceGnmDriver lowers that packet to a `RELEASE_MEM` with the same selector. `main` (#7911) throws for `DATA_SEL = 4` because the PS5 counter is not known. Gang Beasts and the Hasbro Family Fun Pack (CUSA03312) both write it, and the Hasbro bring-up has been running on a local 100 MHz stand-in. ntamas94 [measured the counter on a PS4 Pro](https://github.com/boykopovar/AnyPS5/pull/7911#issuecomment-6314756233) in base mode (FW 10.71), with the packets Gang Beasts writes, timed against the TSC over 124 s: - `DATA_SEL = 4` advances at 798.017 MHz of console time. That is 0.25% under the 800 MHz that `sceGnmGetGpuCoreClockFrequency()` reports and that Gang Beasts divides by. - It read zero about 2 s before the measuring app started, not at power-on. This PR applies that rule: - For a GCN guest (`ShaderRecompiler::GcnGuestShaders()`), `RELEASE_MEM` with `DATA_SEL = 4` writes an 800 MHz count of the host's steady clock. The count starts at zero when libSceAgcDriver loads. It is written wherever the driver resolves the packet: on execution, as a deferred label (`DecodeLabelWrite`), and as a run-time store in `DecodeStores`. - A PS5 guest's `DATA_SEL = 4` still throws "RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented", as #7911 does on `main`. `DATA_SEL = 5` still throws as GDS data, and 6 and 7 still throw as reserved. - The `DATA_SEL = 3` value moved into the same helper (`ReleaseMemValue`) unchanged. What it does not do, recorded in `docs/dev/debt/libSceAgcDriver.md`: - Neo mode keeps the 800 MHz rate. The measurement was in base mode, and the Neo rate is not known. `main`'s libSceGnmDriverForNeoMode reports 911 MHz from `sceGnmGetGpuCoreClockFrequency`, so in Neo mode the two values differ. - The same measurement found PS4 `DATA_SEL = 3` to be the TSC divided by 16, a 40-bit count. The driver still writes 100 MHz of the host's steady clock for it. - Both selectors are sampled when the queue worker decodes the packet, not when the end-of-pipe event completes. A deferred label is stored after the GPU work with the value from decode time, so the difference of two writes measures queue processing, not GPU time. #6977's libSceGnmDriver does not export `sceGnmGetGpuCoreClockFrequency`, so on that path there is no second value to keep in step with. [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/443f022450f6857256e780daa3d5a14029a748f7/src/video_core/amdgpu/pm4_cmds.h#L347-L355) names the selector `PerfCounter` and writes the TSC scaled to the GPU core clock. Nothing in it depends on the title. ### Tested Windows 11 Pro 26300, WinLibs GCC 15.2.0, Release, AMD Radeon RX 9070 XT (driver 32.0.31041.1004), `ANYPS5_GPU=AMD`. **Base.** This branch is now `5c52198a02`, which is `main` `5b913d40c6` merged in, plus a debt-entry commit. Every file #9431 touched takes `main`'s version. `git diff 5b913d40c6 5c52198a02` holds three files: `Execution/src/Pm4.cpp`, `tests/Pm4.cpp` and the RELEASE_MEM debt entry. `git merge-tree` with `main` `fae9e483bb`, 19 commits later, has no conflicts; that merge was not built. - `agc_driver_pm4` has `testGcnReleaseMemSystemCounter`. With GCN shaders on, two `RELEASE_MEM` packets are executed 20 ms apart, and the test checks three things: - the first value is under 60 s of ticks; - the delta lies between steady-clock reads taken around the two packets, converted to 800 MHz; - the packet resolves as an 8-byte label and decodes as an 8-byte run-time store. - Revert checks on `5c52198a02`, one rebuild each; `agc_driver_pm4` fails every time and passes again with the file restored: | Removed | Failure | |---|---| | All of `Execution/src/Pm4.cpp`, as on `5b913d40c6` | RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented | | `DecodeLabelWrite` accepting 4 | a GCN DATA_SEL 4 RELEASE_MEM did not resolve as an 8-byte label | | `DecodeStores` treating 4 as run-time | a GCN DATA_SEL 4 RELEASE_MEM did not decode as an 8-byte run-time store | | The 800 MHz rate (set to 100 MHz) | the GCN DATA_SEL 4 counter does not advance at 800 MHz | | The start at library load (steady clock's epoch instead) | the GCN DATA_SEL 4 counter did not start near zero | - Validation layer: run with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ctest -V`, on `main` `5b913d40c6` and on this branch. The 58 tests: - `agc_driver_pm4`, `agc_driver_pm4_replay`, `agc_driver`, `agc_driver_graphics`, `agc_driver_register_key`, `agc_driver_gcn_detile` and `agc_driver_pattern_buffer_fill` - `agc_driver_flip` and the 17 `video_out_flip_*` modes - `agc_gcn_decode`, `texture_format_lookup`, `agc_driver_resource_cache_replaced_texture` and `agc_depth_copy_kept_bytes` - the 29 `agc_driver_depth_*` tests Results: - `main`: 58 of 58 pass. - This branch: 58 of 58 pass. - Neither log has a `VUID-` line or `was not found but was requested by env var VK_INSTANCE_LAYERS`. All 49 `Selected GPU` lines in each log name the RX 9070 XT. The PM4 tests themselves create no Vulkan device, so the layer says nothing about them. - Linux: WSL Ubuntu, g++ 15.2.0, cmake 4.2.3, Unix Makefiles, `-j4`, from a `git archive` of this code on the Linux filesystem. - A plain configure stops at `CMakeLists.txt:513` and `:521`, because the machine has no X11 or audio development packages. In that local copy only, those two `FATAL_ERROR`s became warnings. FFmpeg came from the project's `ffmpeg-linux-x64.zip` through `FFMPEG_PREBUILT_DIR`. - Built: `shader_recompiler_agc_driver`, `agc_driver_pm4_tests` and `agc_driver_graphics_tests`, and so all of `libSceAgcDriver`. That includes `Graphics/src/PipelineJournal.cpp` and `core/shader/recompiler/ShaderDiskCache.cpp`, with their `__linux__ && __x86_64__ && __GLIBCXX__` size guards active. - Ran: `agc_driver_pm4` and `agc_driver_graphics`, 2 of 2 pass. No `Selected GPU` line: no GPU ran there. - Not run on Linux: every other test, anything on a GPU, and any build with SDL's X11 or audio backends. - CUSA03312: the Hasbro titles ran on `ps4/limbo-gpu` at `93eeee0141` (#6977's head then) on a local 100 MHz stand-in for this until Get-fix/AnyPS5#19. Not rerun on this base: the titles also need #9432. - `tools/check_conventions.py --base origin/main` passes. - `tools/pr_overlap.py --branch feat/gcn-release-mem-perf-counter`, against `main` `fae9e483bb`: - #12568 conflicts with this PR's own lines: it changes the `GuestMemory::Write` beside `ReleaseMemValue` in `Execute`. The two compose, and whichever lands second resolves it. - 57 pull requests conflict with `main` themselves, so the tool could not compare them. All share the debt file or one of the two `Pm4.cpp` files: #6188, #6549 and #10249 change `Execution/src/Pm4.cpp`, and #6185, #6186 and #6549 change `tests/Pm4.cpp`. **Merge of `main` `4180951e90`, 5 Nov.** Head `a87d435d96`. A clean merge to rerun CI. On `be678bc388`, the `windows` job stopped compiling `Graphics/src/DepthSurface.cpp:1623` ("cannot convert 'VkMemoryAllocateInfo' to 'const VkImageCreateInfo&'"). That file isn't in this PR: the error came from `main` of that hour, where #15301's call and #15855's new `allocate` signature met. `main` `4180951e90` compiles it. - **Runs.** Windows, WinLibs GCC, Release: `agc_driver_pm4`, `agc_driver_pm4_replay`, `agc_driver_pm4_replay_tool` and `agc_driver_graphics` pass, 4 of 4, in one run. They run on the mock device, so no Vulkan device is selected. - **Not rerun:** the depth tests and Linux. `check_conventions.py` passes. ### 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) - [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: CUSA03312 #7198 - [x] GPUs tested: AMD Radeon RX 9070 XT, driver 32.0.31041.1004, Windows 11 Pro 26300 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
XairRrR commented 2026-10-29 03:33:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T03:33:54Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The RELEASE_MEM DATA_SEL = 4 change itself works and its test catches the old behaviour, but the branch conflicts with current main and, without any merge, does not compile on Linux x86_64 with GCC/libstdc++; both problems come from the #9431 content the branch carries.

What I ran

  • Head: 781ffafe9f9fc04d5a6758d7de785dbd25518536
  • main: b433c40f2f46aa2e59e19806010a839ac8572d64
  • Machine: Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08). Release, Ninja, a clean worktree.
git fetch origin main pull/9893/head:refs/review/9893
git checkout --detach origin/main
git merge --no-ff --no-edit refs/review/9893        # conflicts, aborted
git merge --abort
git checkout --detach refs/review/9893
git diff --check origin/main...refs/review/9893
python3 tools/check_conventions.py --base origin/main
cmake --build build -j10 --target agc_driver_pm4_tests     # fails: PipelineJournal.cpp static_assert

# local-only, to exercise the PR's own change: set the two asserts to 848 / 116
cmake --build build -j10 --target agc_driver_pm4_tests agc_driver_pm4_replay_tests
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \
  ctest --test-dir build -R '^agc_driver_pm4' -j4 -V --output-on-failure
ctest --test-dir build -R '^agc_driver_pm4$' --repeat until-fail:20

# negative control
git checkout 4e8243ac48 -- core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
cmake --build build -j10 --target agc_driver_pm4_tests
ctest --test-dir build -R '^agc_driver_pm4$' --output-on-failure

# baseline on main, same worktree and env
git checkout --detach origin/main
cmake --build build -j10 --target agc_driver_pm4_tests agc_driver_pm4_replay_tests
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \
  ctest --test-dir build -R '^agc_driver_pm4' -j4 -V --output-on-failure

Results

Check Result
Merge onto main b433c40f2f Conflicts in Graphics/include/State.hpp and Graphics/src/State.cpp
git diff --check Clean
tools/check_conventions.py --base origin/main Passed
Build of the head as pushed (Linux, GCC 16.2.1) Fails: two static_asserts in PipelineJournal.cpp
agc_driver_pm4* (16 tests), head with the asserts relaxed locally 16/16 pass
agc_driver_pm4* (16 tests), main 16/16 pass
agc_driver_pm4 repeated 20 times (timing test) 20/20 pass
VUID- lines / was not found but was requested by env var VK_INSTANCE_LAYERS 0 / 0 on both; these tests do not create a Vulkan device, so the layer is not exercised
Merge conflicts
CONFLIT (contenu) : Conflit de fusion dans core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
CONFLIT (contenu) : Conflit de fusion dans core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp

State.hpp: main added hullWaveSize and tessellationGeometry to ShaderStages where the branch adds legacyVertex, and changed DrawKeyRegisters (still 50 entries, 0x002 now 2 words) where the branch grows it to 52. State.cpp: decodeDepthPlane's extent and mip checks, and DecodeShaderStages, where main added the tessellation-plus-geometry path.

Build failure at the head
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp:41:29: error: static assertion failed: State changed: update CanonicalPipelineState and the recipe codec
   41 | static_assert(sizeof(State) == 840, "State changed: update CanonicalPipelineState and the recipe codec");
  • the comparison reduces to '(848 == 840)'
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp:42:36: error: static assertion failed: ShaderStages changed: update the recipe codec
   42 | static_assert(sizeof(ShaderStages) == 112, "ShaderStages changed: update the recipe codec");
  • the comparison reduces to '(116 == 112)'
Negative control output
1/1 Test #664: agc_driver_pm4 ...................***Failed    0.01 sec
RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented

Negative control

I restored only core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp to the branch's base merge 4e8243ac48 (main plus #9431; main's own Pm4.cpp cannot be paired with this tree) and rebuilt with the asserts relaxed. agc_driver_pm4 then fails in testGcnReleaseMemSystemCounter with "RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented", as the description says. With the PR's file back it passes.

Findings

Blocking

  1. The head does not compile on Linux x86_64 with libstdc++. PipelineJournal.cpp:40-45 asserts sizeof(State) == 840 and sizeof(ShaderStages) == 112. The bool legacyVertex that #9431 adds at State.hpp:35 makes them 848 and 116. This confirms the earlier comment that reported the same error after merging a newer main, and adds two details. First, it fails on the pushed head itself, with no merge: the asserts are already in main 07da04f947, which the branch is built on. Second, they sit behind #if defined(__linux__) && defined(__x86_64__) && defined(__GLIBCXX__), which is why the Windows/MinGW runs in the description and the comments all built. The asserts guard the pipeline recipe codec. legacyVertex is not written by the encoder (PipelineJournal.cpp:175-179) or copied into the canonical state (PipelineJournal.cpp:1483-1487). Fix: in #9431, either encode and canonicalize legacyVertex or show it cannot affect a created pipeline, then update both sizes. Re-merge that into this branch.
  2. Conflict with current main in Graphics/include/State.hpp and Graphics/src/State.cpp (details above). Both files come from #9431, not from this PR's own commits. The PR already carries the "needs rebase" label. Fix: resolve in the #9431 merge (Get-fix/AnyPS5#22) against current main and merge it again here. The ShaderStages hunk overlaps finding 1, because main now adds hullWaveSize and tessellationGeometry too.

Non-blocking

  1. The counter is sampled when the packet is decoded, not when the end-of-pipe event completes. On the deferred-label path (PacketMemory.cpp:78-88), DecodeLabelWrite computes the bytes, including ReleaseMemValue's timestamp, when the queue worker reaches the packet. They are stored and written to guest memory only after the GPU work completes. A title that takes the difference of two EOP counter writes to time GPU work will see queue-processing time, not GPU time. DATA_SEL = 3 already behaves this way, so this is not new. Because the PR exists for titles that read this counter, consider adding it to the RELEASE_MEM debt entry, or sampling the clock when the deferred label is flushed.
  2. The rewritten debt entry (libSceAgcDriver.md:28) keeps the amdgpu nvd.h link on torvalds/linux blob/master. Since the line is being rewritten anyway, a tag or commit link would keep the citation stable.

The PR's own change in Pm4.cpp:47-56 and the Validate gate at line 489 hold up:

  • The PS5 path still throws.
  • DATA_SEL = 5, 6 and 7 still throw.
  • DecodeStores reports 3 and 4 as run-time stores.
  • Submission.cpp already excludes DATA_SEL >= 3 from known writes.
  • The duration_cast to 800 MHz ticks is exact integer ns * 4 / 5 in uint64_t.
  • The test's bounds allow for truncation in both reads and passed 20 repeats.

Not verified

  • Anything on Windows or AMD hardware; the description's and comments' runs cover those.
  • The full product build of the head. I relaxed the two asserts locally only to build libSceAgcDriver and the PM4 tests; that does not show the journal stays correct with legacyVertex.
  • The merged tree, which cannot be built until the conflict is resolved.
  • CUSA03312 or any title; not run.
  • The Vulkan validation layer: the PM4 tests create no Vulkan device, so this run says nothing about validation errors.

To get this to a good state

  1. In #9431 / Get-fix/AnyPS5#22: merge current main, resolve State.hpp and State.cpp, and update the PipelineJournal.cpp codec, canonical state and size asserts for the new ShaderStages field(s). Check on Linux x86_64 with GCC, where the asserts are active.
  2. Merge that result into this branch again and rerun agc_driver_pm4.
  3. Optionally, note the decode-time sampling in the RELEASE_MEM debt entry.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5692535173 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9893#pullrequestreview-5692535173). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T03:33:54Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The RELEASE_MEM `DATA_SEL = 4` change itself works and its test catches the old behaviour, but the branch conflicts with current `main` and, without any merge, does not compile on Linux x86_64 with GCC/libstdc++; both problems come from the #9431 content the branch carries. ## What I ran - Head: `781ffafe9f9fc04d5a6758d7de785dbd25518536` - `main`: `b433c40f2f46aa2e59e19806010a839ac8572d64` - Machine: Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08). Release, Ninja, a clean worktree. ```sh git fetch origin main pull/9893/head:refs/review/9893 git checkout --detach origin/main git merge --no-ff --no-edit refs/review/9893 # conflicts, aborted git merge --abort git checkout --detach refs/review/9893 git diff --check origin/main...refs/review/9893 python3 tools/check_conventions.py --base origin/main cmake --build build -j10 --target agc_driver_pm4_tests # fails: PipelineJournal.cpp static_assert # local-only, to exercise the PR's own change: set the two asserts to 848 / 116 cmake --build build -j10 --target agc_driver_pm4_tests agc_driver_pm4_replay_tests VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \ ctest --test-dir build -R '^agc_driver_pm4' -j4 -V --output-on-failure ctest --test-dir build -R '^agc_driver_pm4$' --repeat until-fail:20 # negative control git checkout 4e8243ac48 -- core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp cmake --build build -j10 --target agc_driver_pm4_tests ctest --test-dir build -R '^agc_driver_pm4$' --output-on-failure # baseline on main, same worktree and env git checkout --detach origin/main cmake --build build -j10 --target agc_driver_pm4_tests agc_driver_pm4_replay_tests VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \ ctest --test-dir build -R '^agc_driver_pm4' -j4 -V --output-on-failure ``` ## Results | Check | Result | |---|---| | Merge onto `main` `b433c40f2f` | **Conflicts** in `Graphics/include/State.hpp` and `Graphics/src/State.cpp` | | `git diff --check` | Clean | | `tools/check_conventions.py --base origin/main` | Passed | | Build of the head as pushed (Linux, GCC 16.2.1) | **Fails**: two `static_assert`s in `PipelineJournal.cpp` | | `agc_driver_pm4*` (16 tests), head with the asserts relaxed locally | 16/16 pass | | `agc_driver_pm4*` (16 tests), `main` | 16/16 pass | | `agc_driver_pm4` repeated 20 times (timing test) | 20/20 pass | | `VUID-` lines / `was not found but was requested by env var VK_INSTANCE_LAYERS` | 0 / 0 on both; these tests do not create a Vulkan device, so the layer is not exercised | <details><summary>Merge conflicts</summary> ```text CONFLIT (contenu) : Conflit de fusion dans core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp CONFLIT (contenu) : Conflit de fusion dans core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp ``` `State.hpp`: `main` added `hullWaveSize` and `tessellationGeometry` to `ShaderStages` where the branch adds `legacyVertex`, and changed `DrawKeyRegisters` (still 50 entries, `0x002` now 2 words) where the branch grows it to 52. `State.cpp`: `decodeDepthPlane`'s extent and mip checks, and `DecodeShaderStages`, where `main` added the tessellation-plus-geometry path. </details> <details><summary>Build failure at the head</summary> ```text core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp:41:29: error: static assertion failed: State changed: update CanonicalPipelineState and the recipe codec 41 | static_assert(sizeof(State) == 840, "State changed: update CanonicalPipelineState and the recipe codec"); • the comparison reduces to '(848 == 840)' core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp:42:36: error: static assertion failed: ShaderStages changed: update the recipe codec 42 | static_assert(sizeof(ShaderStages) == 112, "ShaderStages changed: update the recipe codec"); • the comparison reduces to '(116 == 112)' ``` </details> <details><summary>Negative control output</summary> ```text 1/1 Test #664: agc_driver_pm4 ...................***Failed 0.01 sec RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented ``` </details> ## Negative control I restored only `core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp` to the branch's base merge `4e8243ac48` (`main` plus #9431; `main`'s own `Pm4.cpp` cannot be paired with this tree) and rebuilt with the asserts relaxed. `agc_driver_pm4` then fails in `testGcnReleaseMemSystemCounter` with "RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented", as the description says. With the PR's file back it passes. ## Findings ### Blocking 1. **The head does not compile on Linux x86_64 with libstdc++.** [`PipelineJournal.cpp:40-45`](https://github.com/boykopovar/AnyPS5/blob/781ffafe9f9fc04d5a6758d7de785dbd25518536/core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp#L40-L45) asserts `sizeof(State) == 840` and `sizeof(ShaderStages) == 112`. The `bool legacyVertex` that #9431 adds at [`State.hpp:35`](https://github.com/boykopovar/AnyPS5/blob/781ffafe9f9fc04d5a6758d7de785dbd25518536/core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp#L30-L36) makes them 848 and 116. This confirms the earlier comment that reported the same error after merging a newer `main`, and adds two details. First, it fails on the pushed head itself, with no merge: the asserts are already in `main` `07da04f947`, which the branch is built on. Second, they sit behind `#if defined(__linux__) && defined(__x86_64__) && defined(__GLIBCXX__)`, which is why the Windows/MinGW runs in the description and the comments all built. The asserts guard the pipeline recipe codec. `legacyVertex` is not written by the encoder ([`PipelineJournal.cpp:175-179`](https://github.com/boykopovar/AnyPS5/blob/781ffafe9f9fc04d5a6758d7de785dbd25518536/core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp#L175-L179)) or copied into the canonical state ([`PipelineJournal.cpp:1483-1487`](https://github.com/boykopovar/AnyPS5/blob/781ffafe9f9fc04d5a6758d7de785dbd25518536/core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp#L1483-L1487)). Fix: in #9431, either encode and canonicalize `legacyVertex` or show it cannot affect a created pipeline, then update both sizes. Re-merge that into this branch. 2. **Conflict with current `main`** in `Graphics/include/State.hpp` and `Graphics/src/State.cpp` (details above). Both files come from #9431, not from this PR's own commits. The PR already carries the "needs rebase" label. Fix: resolve in the #9431 merge (Get-fix/AnyPS5#22) against current `main` and merge it again here. The `ShaderStages` hunk overlaps finding 1, because `main` now adds `hullWaveSize` and `tessellationGeometry` too. ### Non-blocking 1. **The counter is sampled when the packet is decoded, not when the end-of-pipe event completes.** On the deferred-label path ([`PacketMemory.cpp:78-88`](https://github.com/boykopovar/AnyPS5/blob/781ffafe9f9fc04d5a6758d7de785dbd25518536/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cpp#L78-L88)), `DecodeLabelWrite` computes the bytes, including `ReleaseMemValue`'s timestamp, when the queue worker reaches the packet. They are stored and written to guest memory only after the GPU work completes. A title that takes the difference of two EOP counter writes to time GPU work will see queue-processing time, not GPU time. `DATA_SEL = 3` already behaves this way, so this is not new. Because the PR exists for titles that read this counter, consider adding it to the RELEASE_MEM debt entry, or sampling the clock when the deferred label is flushed. 2. The rewritten debt entry ([`libSceAgcDriver.md:28`](https://github.com/boykopovar/AnyPS5/blob/781ffafe9f9fc04d5a6758d7de785dbd25518536/docs/dev/debt/libSceAgcDriver.md#L28)) keeps the amdgpu `nvd.h` link on `torvalds/linux` `blob/master`. Since the line is being rewritten anyway, a tag or commit link would keep the citation stable. The PR's own change in [`Pm4.cpp:47-56`](https://github.com/boykopovar/AnyPS5/blob/781ffafe9f9fc04d5a6758d7de785dbd25518536/core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp#L47-L56) and the `Validate` gate at line 489 hold up: - The PS5 path still throws. - `DATA_SEL = 5`, 6 and 7 still throw. - `DecodeStores` reports 3 and 4 as run-time stores. - `Submission.cpp` already excludes `DATA_SEL >= 3` from known writes. - The `duration_cast` to 800 MHz ticks is exact integer `ns * 4 / 5` in `uint64_t`. - The test's bounds allow for truncation in both reads and passed 20 repeats. ## Not verified - Anything on Windows or AMD hardware; the description's and comments' runs cover those. - The full product build of the head. I relaxed the two asserts locally only to build `libSceAgcDriver` and the PM4 tests; that does not show the journal stays correct with `legacyVertex`. - The merged tree, which cannot be built until the conflict is resolved. - CUSA03312 or any title; not run. - The Vulkan validation layer: the PM4 tests create no Vulkan device, so this run says nothing about validation errors. ## To get this to a good state 1. In #9431 / Get-fix/AnyPS5#22: merge current `main`, resolve `State.hpp` and `State.cpp`, and update the `PipelineJournal.cpp` codec, canonical state and size asserts for the new `ShaderStages` field(s). Check on Linux x86_64 with GCC, where the asserts are active. 2. Merge that result into this branch again and rerun `agc_driver_pm4`. 3. Optionally, note the decode-time sampling in the RELEASE_MEM debt entry.
BunnyFl commented 2026-11-02 23:49:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T23:49:39Z.

Review: APPROVED


Reviewed on Windows: approve

The diff against main is now only the DATA_SEL = 4 change: Pm4.cpp, tests/Pm4.cpp and one debt entry. @XairRrR's two blockers came from the #9431 content, and #9431 is on main now.

What I ran

Head 5c52198a02 merged onto current main (clean merge). Windows 11, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON.

Run ctest -R '^agc_driver_pm4'
Merge of this PR 16/16 pass, none skipped
Same tree with main's Execution/src/Pm4.cpp restored 15/16; agc_driver_pm4 fails with "RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented"

XairRrR's findings at 781ffafe9f

  • Blocking 1 (the PipelineJournal.cpp static_assert on Linux/libstdc++) and Blocking 2 (conflicts in State.hpp and State.cpp) were in the #9431 files. The PR's diff no longer touches them. The NVIDIA CI run on 5c52198 built the merge on Ubuntu and reports 0 new failures. I didn't build on Linux myself.
  • Non-blocking 1: the RELEASE_MEM entry in docs/dev/debt/libSceAgcDriver.md:34 now records decode-time sampling and its effect on two deferred labels (5c52198a02).
  • Non-blocking 2: the nvd.h link now points at tag v6.18, lines 379-380 ("3 - send 64bit GPU counter value", "4 - send 64bit sys counter value"). The entry is 997 characters.

Code

  • Validate still throws for a PS5 guest's DATA_SEL = 4 (tests/Pm4.cpp:1194), and for 5, 6 and 7.
  • testGcnReleaseMemSystemCounter checks the 800 MHz rate between two bracketed reads, the 8-byte label, and the run-time store from DecodeStores.
  • ReleaseMemValue keeps DATA_SEL = 3 as before.

Not run: CUSA03312 or any title, and macOS.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5745072342 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9893#pullrequestreview-5745072342). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-02T23:49:39Z. **Review:** APPROVED --- ## Reviewed on Windows: approve The diff against `main` is now only the `DATA_SEL = 4` change: `Pm4.cpp`, `tests/Pm4.cpp` and one debt entry. @XairRrR's two blockers came from the #9431 content, and #9431 is on `main` now. ### What I ran Head `5c52198a02` merged onto current `main` (clean merge). Windows 11, WinLibs GCC 15.2.0, Release, `BUILD_TESTING=ON`. | Run | `ctest -R '^agc_driver_pm4'` | |---|---| | Merge of this PR | 16/16 pass, none skipped | | Same tree with `main`'s `Execution/src/Pm4.cpp` restored | 15/16; `agc_driver_pm4` fails with "RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented" | ### XairRrR's findings at `781ffafe9f` - Blocking 1 (the `PipelineJournal.cpp` static_assert on Linux/libstdc++) and Blocking 2 (conflicts in `State.hpp` and `State.cpp`) were in the #9431 files. The PR's diff no longer touches them. The [NVIDIA CI run on `5c52198`](https://github.com/boykopovar/AnyPS5/pull/9893#issuecomment-6531687423) built the merge on Ubuntu and reports 0 new failures. I didn't build on Linux myself. - Non-blocking 1: the RELEASE_MEM entry in `docs/dev/debt/libSceAgcDriver.md:34` now records decode-time sampling and its effect on two deferred labels (`5c52198a02`). - Non-blocking 2: the `nvd.h` link now points at tag `v6.18`, lines 379-380 ("3 - send 64bit GPU counter value", "4 - send 64bit sys counter value"). The entry is 997 characters. ### Code - `Validate` still throws for a PS5 guest's `DATA_SEL = 4` (`tests/Pm4.cpp:1194`), and for 5, 6 and 7. - `testGcnReleaseMemSystemCounter` checks the 800 MHz rate between two bracketed reads, the 8-byte label, and the run-time store from `DecodeStores`. - `ReleaseMemValue` keeps `DATA_SEL = 3` as before. Not run: CUSA03312 or any title, and macOS.
XairRrR commented 2026-11-03 05:44:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T05:44:05Z.

Review: APPROVED


Re-checked — approved

main 5b913d40c6 is now merged into the branch, so the #9431 content is gone and the diff is only the GCN RELEASE_MEM DATA_SEL = 4 counter. A debt-entry commit (5c52198a02) records decode-time sampling, pins the nvd.h link and notes the Neo-mode 911 MHz mismatch. The merged tree builds on Linux/GCC and the PR's test passes. With main's Pm4.cpp restored, the test fails.

What changed since my last review

  • 05c9c4200c merges main 5b913d40c6, which already contains #9431. The diff against main now covers 3 files (+45 −11): Execution/src/Pm4.cpp, tests/Pm4.cpp and the RELEASE_MEM entry in docs/dev/debt/libSceAgcDriver.md.
  • 5c52198a02 rewrites that debt entry:
    • it records that DATA_SEL 3 and 4 are sampled when the packet is decoded;
    • it pins the amdgpu link to v6.18;
    • it records that sceGnmGetGpuCoreClockFrequency in libSceGnmDriverForNeoMode reports 911 MHz while the count stays at 800 MHz;
    • it drops the libSceGnmDriver lines.
  • The author answered every finding in their reply. The description now describes the new base and the revert checks.

What I ran

Head 5c52198a0291798daa362fd4a0cf94881d37c39c, main 5cb015caaaaf83f8ee431414ee6a457b5b307d49, merged tree 2eeead1b0efb74eb5d316ca404740533d94baf15. Debian 13 VM (Xeon Gold 6136, AVX2/FMA), GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19).

git diff --check 5cb015caaa...5c52198a02
python3 tools/check_conventions.py --base 5cb015caaa
git diff --stat 5cb015caaa 2eeead1b0e
# negative control
git show 5cb015caaa:core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp > core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
ninja -C build agc_driver_pm4_tests agc_driver_image_sample_lod_clamp_tests
ctest --test-dir build --output-on-failure -R '^(agc_driver_pm4|agc_driver_image_sample_lod_clamp_shader_lane|unwrap_self.*group)$'
# restore merged file
git show 2eeead1b0e:core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp > core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
ninja -C build agc_driver_pm4_tests agc_driver_image_sample_lod_clamp_tests
ctest --test-dir build -R '^agc_driver_pm4' --repeat until-fail:5
git status --porcelain   # empty

The script also built the whole merged tree (configure, build and libs all OK) and ran the 2167 tests the change can reach, with a Khronos validation comparison over 759 tests.

Check Result
git diff --check Clean
check_conventions.py Passed
Build of the merged tree (Linux x86_64, GCC 14.2, libstdc++; PipelineJournal.cpp asserts active) OK
agc_driver_pm4* (16 tests), 5 repeats 16/16 pass each time
Script test run 2047 passed, 112 expected skips, 6 known failures from main, 2 failures listed as new (both come from main, see below)
Validation layer Loaded in 758 of 759 tests; 0 tests with a new VUID- line compared with main

There are two "new" failures, agc_driver_image_sample_lod_clamp_shader_lane and unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group. Neither is caused by this PR:

  • The failure baseline is 096c45570f, 227 commits behind main.
  • Both tests still fail with this PR's only production file (Pm4.cpp) restored to main, with the same message (image_sample_lz ... thread 0 component 1 is 0.000000, expected 0.062500).
  • The PR's change does not reach either test's code.

Negative control

I restored only Execution/src/Pm4.cpp from main and rebuilt. agc_driver_pm4 then fails with RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented, which is testGcnReleaseMemSystemCounter. With the merged file back, all 16 agc_driver_pm4* tests pass five times in a row. The worktree is back to the merged tree. The author's per-piece revert checks (label decode, run-time store, rate, epoch) are accepted as author-reported; I did not repeat them.

Negative control output
1/1 Test #1714: agc_driver_pm4 ...................***Failed    0.02 sec
RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented

Previous findings

  • Blocking 1, PipelineJournal.cpp static_assert on Linux/libstdc++: Resolved. The PR no longer touches State/ShaderStages. The merged tree builds here with GCC 14.2 on x86_64 Linux, where the size guards are active.
  • Blocking 2, conflicts in State.hpp/State.cpp: Resolved. The PR no longer changes those files, and the script merged it into main 5cb015caaa without conflicts.
  • Non-blocking 1, counter sampled at decode, not at EOP: Resolved as documented debt. The RELEASE_MEM entry now says that both selectors are sampled at packet decode and that two deferred labels measure queue processing. Keeping the behaviour and recording it as debt is a reasonable choice.
  • Non-blocking 2, nvd.h link on master: Resolved. The link now points at tag v6.18, lines 379–380. I could not open it with no network.

New findings

Blocking

None.

Non-blocking

None. I re-read the code at the head:

  • the Validate gate at Pm4.cpp:491 still throws for a PS5 guest's DATA_SEL = 4, and for 5, 6 and 7;
  • ReleaseMemValue (Pm4.cpp:51) serves both the label path (:632) and the execute path (:1142);
  • DecodeStores' >= 3 only ever sees 3 or 4, because DecodeLabelWrite returns nullopt above 4.

Not verified

  • CUSA03312 or any title: not run.
  • Windows, AMD or NVIDIA hardware: I only used lavapipe. The author's RX 9070 XT runs and the other contributors' NVIDIA runs are author-reported.
  • The nvd.h v6.18 line numbers and the ntamas94 measurement link: no network here.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5747714901 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9893#pullrequestreview-5747714901). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T05:44:05Z. **Review:** APPROVED --- # Re-checked — approved `main` `5b913d40c6` is now merged into the branch, so the #9431 content is gone and the diff is only the GCN `RELEASE_MEM` `DATA_SEL = 4` counter. A debt-entry commit (`5c52198a02`) records decode-time sampling, pins the `nvd.h` link and notes the Neo-mode 911 MHz mismatch. The merged tree builds on Linux/GCC and the PR's test passes. With `main`'s `Pm4.cpp` restored, the test fails. ## What changed since my last review - `05c9c4200c` merges `main` `5b913d40c6`, which already contains #9431. The diff against `main` now covers 3 files (+45 −11): `Execution/src/Pm4.cpp`, `tests/Pm4.cpp` and the RELEASE_MEM entry in `docs/dev/debt/libSceAgcDriver.md`. - `5c52198a02` rewrites that debt entry: - it records that `DATA_SEL` 3 and 4 are sampled when the packet is decoded; - it pins the amdgpu link to `v6.18`; - it records that `sceGnmGetGpuCoreClockFrequency` in libSceGnmDriverForNeoMode reports 911 MHz while the count stays at 800 MHz; - it drops the libSceGnmDriver lines. - The author answered every finding in [their reply](https://github.com/boykopovar/AnyPS5/pull/9893#issuecomment-6520536163). The description now describes the new base and the revert checks. ## What I ran Head `5c52198a0291798daa362fd4a0cf94881d37c39c`, `main` `5cb015caaaaf83f8ee431414ee6a457b5b307d49`, merged tree `2eeead1b0efb74eb5d316ca404740533d94baf15`. Debian 13 VM (Xeon Gold 6136, AVX2/FMA), GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19). ```sh git diff --check 5cb015caaa...5c52198a02 python3 tools/check_conventions.py --base 5cb015caaa git diff --stat 5cb015caaa 2eeead1b0e # negative control git show 5cb015caaa:core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp > core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp ninja -C build agc_driver_pm4_tests agc_driver_image_sample_lod_clamp_tests ctest --test-dir build --output-on-failure -R '^(agc_driver_pm4|agc_driver_image_sample_lod_clamp_shader_lane|unwrap_self.*group)$' # restore merged file git show 2eeead1b0e:core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp > core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp ninja -C build agc_driver_pm4_tests agc_driver_image_sample_lod_clamp_tests ctest --test-dir build -R '^agc_driver_pm4' --repeat until-fail:5 git status --porcelain # empty ``` The script also built the whole merged tree (configure, build and `libs` all OK) and ran the 2167 tests the change can reach, with a Khronos validation comparison over 759 tests. | Check | Result | |---|---| | `git diff --check` | Clean | | `check_conventions.py` | Passed | | Build of the merged tree (Linux x86_64, GCC 14.2, libstdc++; `PipelineJournal.cpp` asserts active) | OK | | `agc_driver_pm4*` (16 tests), 5 repeats | 16/16 pass each time | | Script test run | 2047 passed, 112 expected skips, 6 known failures from `main`, 2 failures listed as new (both come from `main`, see below) | | Validation layer | Loaded in 758 of 759 tests; 0 tests with a new `VUID-` line compared with `main` | There are two "new" failures, `agc_driver_image_sample_lod_clamp_shader_lane` and `unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group`. Neither is caused by this PR: - The failure baseline is `096c45570f`, 227 commits behind `main`. - Both tests still fail with this PR's only production file (`Pm4.cpp`) restored to `main`, with the same message (`image_sample_lz ... thread 0 component 1 is 0.000000, expected 0.062500`). - The PR's change does not reach either test's code. ## Negative control I restored only `Execution/src/Pm4.cpp` from `main` and rebuilt. `agc_driver_pm4` then fails with `RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented`, which is `testGcnReleaseMemSystemCounter`. With the merged file back, all 16 `agc_driver_pm4*` tests pass five times in a row. The worktree is back to the merged tree. The author's per-piece revert checks (label decode, run-time store, rate, epoch) are accepted as author-reported; I did not repeat them. <details><summary>Negative control output</summary> ```text 1/1 Test #1714: agc_driver_pm4 ...................***Failed 0.02 sec RELEASE_MEM of the 64-bit system counter (DATA_SEL 4) is not implemented ``` </details> ## Previous findings - **Blocking 1, `PipelineJournal.cpp` static_assert on Linux/libstdc++: Resolved.** The PR no longer touches `State`/`ShaderStages`. The merged tree builds here with GCC 14.2 on x86_64 Linux, where the size guards are active. - **Blocking 2, conflicts in `State.hpp`/`State.cpp`: Resolved.** The PR no longer changes those files, and the script merged it into `main` `5cb015caaa` without conflicts. - **Non-blocking 1, counter sampled at decode, not at EOP: Resolved as documented debt.** The [RELEASE_MEM entry](https://github.com/boykopovar/AnyPS5/blob/5c52198a0291798daa362fd4a0cf94881d37c39c/docs/dev/debt/libSceAgcDriver.md#L34-L34) now says that both selectors are sampled at packet decode and that two deferred labels measure queue processing. Keeping the behaviour and recording it as debt is a reasonable choice. - **Non-blocking 2, `nvd.h` link on `master`: Resolved.** The link now points at tag `v6.18`, lines 379–380. I could not open it with no network. ## New findings ### Blocking None. ### Non-blocking None. I re-read the code at the head: - the `Validate` gate at `Pm4.cpp:491` still throws for a PS5 guest's `DATA_SEL = 4`, and for 5, 6 and 7; - `ReleaseMemValue` (`Pm4.cpp:51`) serves both the label path (`:632`) and the execute path (`:1142`); - `DecodeStores`' `>= 3` only ever sees 3 or 4, because `DecodeLabelWrite` returns `nullopt` above 4. ## Not verified - CUSA03312 or any title: not run. - Windows, AMD or NVIDIA hardware: I only used lavapipe. The author's RX 9070 XT runs and the other contributors' NVIDIA runs are author-reported. - The `nvd.h` v6.18 line numbers and the ntamas94 measurement link: no network here. <!-- anyps5-bots job=2882 head=5c52198a0291798daa362fd4a0cf94881d37c39c -->
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!9893
No description provided.