Skip to content

fix(agc): finish the run report when the frame replay ends - #24021

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
chitters2004:fix/frame-replay-run-report
Nov 27, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
chitters2004:fix/frame-replay-run-report

Conversation

@chitters2004

Copy link
Copy Markdown
Contributor

What

agc_frame_replay (core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp) wrote no run report with APS5_REPORT=1 in three cases. On Windows the report is written only when the guest calls exit or _exit, because the DLL exit handlers run inside the loader lock; the replay is a host program whose main returns, so a successful replay never wrote one. On every OS, a failed replay and a --shaders or --submits listing end with std::_Exit, which skips the exit handler that writes the report on Linux and macOS.

main now calls LibcRunReportFinishExit_nid_no_patch(code) after the driver has shut down and before it returns or exits. The call is idempotent, so on Linux and macOS the exit handler finds the report already written and does nothing. The Windows relaunch path (relaunch, which waits for the child and exits with its code) is unchanged: the child process writes the report of the replay that ran.

tests/FrameReplayTool.cmake gets a run_report mode, registered as agc_driver_frame_replay_run_report: it runs the tool with APS5_REPORT=1 on a listing (exit 0) and on a missing capture (exit 2) and requires exactly one anyps5-report.json with that exitCode after each.

+3 lines, -1 in FrameReplay.cpp, +33 in FrameReplayTool.cmake (the test runs the tool with its report folder redirected to a temporary folder and accepts the report next to the executable or in that folder), +1 word in agc_driver_frame_replay_state_tests.cmake.

Tested

  • Windows 11, MinGW build, NVIDIA GeForce RTX 3080, local run of a real replay (agc_frame_replay frame-replay-once, APS5_REPORT=1, exit code 0): on main c3a823624f no anyps5-report.json is written; with this change one is written ("exit": "clean", "exitCode": 0, "stage": "first-draw").
  • Local ctest -R agc_driver_frame_replay_(run_report|submits|shader_output) with this change: 3 passed. Without the FrameReplay.cpp change: agc_driver_frame_replay_run_report fails with "a finished listing wrote no run report".
  • Fork CI on this head (Linux gate and Windows, lavapipe), agc_driver_frame_replay_run_report, agc_driver_frame_replay_submits, agc_driver_frame_replay_shader_output: 3 passed on both: https://github.com/chitters2004/AnyPS5/actions/runs/44649125986
  • Negative control (the new test on main's FrameReplay.cpp, branch draft/ci-370eaa5038c): agc_driver_frame_replay_run_report fails on Linux and Windows: https://github.com/chitters2004/AnyPS5/actions/runs/44649309512

Checklist

  • Based on current main (c3a8236); no other open PR implements the same functions (feat(run-report): recover the report of a run that ended without writing one #15973 adds a general run-report recovery in libc and does not touch FrameReplay.cpp; the open frame-replay PRs do not change the end of main)
  • 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: none
  • GPUs tested: NVIDIA GeForce RTX 3080 on Windows 11 (local real replay and the three tests above); lavapipe (Mesa, fork CI Linux and Windows)
  • AI-assisted: yes

🤖 Generated with Claude Code

agc_frame_replay is a host program, so it never ends through the guest's exit
or _exit, the only paths that write the run report on Windows (DLL exit
handlers run inside the loader lock). On every system it also ends a failed
run, and a listing, with std::_Exit, which skips the exit handler that writes
the report on Linux and macOS. APS5_REPORT=1 therefore wrote no report for a
Windows replay, for a failed replay or for a listing.

The replay now finishes the report itself, with its exit code, after the
driver has shut down and before it returns or exits. On Linux and macOS the
exit handler finds the report already written and does nothing.

agc_driver_frame_replay_run_report runs the tool with APS5_REPORT=1 on a
listing and on a missing capture and requires a report with the exit code of
each.
@github-actions github-actions Bot added build agc libSceAgc* labels Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 11435 core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_frame_replay_state_tests.cmake
core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
PR 11436 core/libs/prx/libSceAgcDriver/tests/FrameReplayTool.cmake
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_frame_replay_state_tests.cmake
core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
PR 15136 core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_frame_replay_state_tests.cmake
core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
PR 19557 core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_frame_replay_state_tests.cmake
core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
PR 19610 core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_frame_replay_state_tests.cmake
core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp

@Colewiz7

Copy link
Copy Markdown
Contributor

Head 0e2c3262c5 merged onto main e825fa1492 as a4853fa6a5, no conflict. Linux 7.3.4, GCC 16.2.1 Release, Mesa 26.2.6 RADV, RX 7900 XT (gfx1100) and 7800X3D iGPU (gfx1036).

No new failures and no new validation messages on either GPU.

RX 7900 XT iGPU
tests run (6356 on the 7900 XT, the 2037 GPU ones on the iGPU), new failures vs main none none
-R '^agc' ( tests) with the layer, new failures vs main none none
VUID- / SYNC-HAZARD lines 0 / 0 0 / 0

Layer runs used VK_LAYER_KHRONOS_validation 1.4.363.1 with VK_LOADER_DEBUG=layer and ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1; the loader inserted the layer in every run, and the set of distinct validation messages matches main.

AI-assisted: yes

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 21, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blocking findings

Nothing blocks this change; the optional point below is for test cleanup.

What I ran

Reviewed head 0e2c3262c53dc392948bd82001e394abf9af29b0. I did not run commands or tests. The author reports three targeted tests passed on Linux and Windows and describes a negative control; these runs were not independently verified.

Results

Check Result Note
Changed code review passed All three changed files read
Tests in this review not run Author reports three passed

Findings

Blocking

None.

Non-blocking

  • FrameReplayTool.cmake:135 removes the temporary report state only after both runs succeed. If a check fails, the test leaves that directory behind and may affect a later run using the same temp path. Consider adding cleanup on failure or using a unique per-run directory.

Not verified

No tests or builds were run. Author-reported Windows 11/RTX 3080 replay and CI results were not independently checked. No changed files were excluded; the three changed files listed as reviewed in the manifest were read.

To get this to a good state

Nothing is required. The cleanup suggestion is optional.

This was referenced Nov 21, 2026
@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head 0e2c3262c5, applied with git apply on main fd4aeed483 together with the other 26 PRs of one batch (#22789, #23721, #23979, #16597, #18471, #18594, #23377, #18819, #20156, #20441, #22399, #24345, #24425, #24522, #19433, #20909, #21516, #22794, #24455, #22622, #22807, #23023, #24422, #18206, #18441, #20067). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
(the test file this PR changes could not be matched to a ctest name by me) - -

Whole batch: the full ctest -j 12 (6525 tests) on the RTX 3080 has 5 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. Traced to other PRs of the batch, each by reverting it and testing again: #16597 (guest_audio_out); none is in this PR's area. The 2127 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the report finalization and added report checks are supported by the inspected code.

What I ran

Reviewed head a866a93e6c198d0b6d0b22c58a4229b0068c6a3a using repo_read.py access to the prepared review bundle and pinned repository source. No commands or tests were run by me; the description’s reported test runs are author supplied.

Results

Check Result Note
Changed code review passed All three changed files read
Tests run by reviewer not run Author reports CI and local passes

Findings

Blocking

None.

Non-blocking

None.

Not verified

No tests were run by me. The author reports local real replay and test results, plus fork CI results; these were not independently verified. The only changed files are core/libs/prx/libSceAgcDriver/tests/FrameReplayTool.cmake, core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_frame_replay_state_tests.cmake, and core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp; all three were read. files.json was not available through the reader.

To get this to a good state

Nothing is required.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 21, 2026
@oneandonlydean
oneandonlydean merged commit ab6fe4a into boykopovar:main Nov 27, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants