fix(agc): flush the shared logger from native clients #7709

Merged
Scramblrrrr merged 1 commit from upstream-pr/7709 into main 2026-10-19 03:25:07 +00:00
Scramblrrrr commented 2026-10-19 02:07:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-19T02:07:47Z.


What

FlushAsyncLog_nid_no_patch is inline and reaches the header-local AsyncLog::Get. A Windows executable that calls it creates its own logger instead of flushing the driver's logger. When the other PE image initializes its logger, libc rejects its different end-flush callback with libc: end flush already registered; the new ABI-deferral tests abort before checking shader behavior.

Define this existing helper in the driver's lifecycle translation unit and leave its declaration in the header. Native clients then flush the same logger as the driver. The async logger, shutdown hook and test assertions keep their existing behavior.

Tested

Windows 11 Pro build 26200, MinGW-w64 GCC 15.2.0, Release, SPIRV-Tools OFF; RTX 5070 Ti / NVIDIA 617.42 / Ryzen 7800X3D.

  • Clean main 324e0e48e, original production code and unchanged existing fixtures: all six agc_driver_prepared_shaders_abi_deferred_{pixel,stages,undecodable_state,registration_failure,vertex_inputs,rectangle_pairs} cases fail. Five report 0xc0000409, one reports an access violation during the failing logger initialization; the control captures the duplicate end-flush diagnostic.
  • Exact fix head 88c8320e3: 29/29 pass (19.92 s) across all registered agc_driver_prepared_shaders*, agc_driver_shutdown_threads*, agc_async_log and agc_async_log_fatal cases. This includes all six original failures, with no fixture changes.
  • The same two-file fix in the separate 007 integration 7bdb95886: 114/114 native checks pass (52.81 s), including serialization, image-table reuse, indirect draws, HDR, APR and the logger/shutdown checks.
  • Conventions and diff checks pass. The overlap tool reported eight conflicting Lifecycle PRs (#5021, #5925, #6188, #6946, #6947, #7201, #7332, #7642); manual review found stack/platform handling, journal flushing and finisher shutdown changes, with no competing change to this flush helper. No title-performance or playable-game claim.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 Pro build 26200
  • AI-assisted: yes (Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4914814971 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7709). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-19T02:07:47Z. --- ### What `FlushAsyncLog_nid_no_patch` is inline and reaches the header-local `AsyncLog::Get`. A Windows executable that calls it creates its own logger instead of flushing the driver's logger. When the other PE image initializes its logger, libc rejects its different end-flush callback with `libc: end flush already registered`; the new ABI-deferral tests abort before checking shader behavior. Define this existing helper in the driver's lifecycle translation unit and leave its declaration in the header. Native clients then flush the same logger as the driver. The async logger, shutdown hook and test assertions keep their existing behavior. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 Pro build 26200, MinGW-w64 GCC 15.2.0, Release, SPIRV-Tools OFF; RTX 5070 Ti / NVIDIA 617.42 / Ryzen 7800X3D. - Clean main `324e0e48e`, original production code and unchanged existing fixtures: all six `agc_driver_prepared_shaders_abi_deferred_{pixel,stages,undecodable_state,registration_failure,vertex_inputs,rectangle_pairs}` cases fail. Five report `0xc0000409`, one reports an access violation during the failing logger initialization; the control captures the duplicate end-flush diagnostic. - Exact fix head `88c8320e3`: **29/29 pass (19.92 s)** across all registered `agc_driver_prepared_shaders*`, `agc_driver_shutdown_threads*`, `agc_async_log` and `agc_async_log_fatal` cases. This includes all six original failures, with no fixture changes. - The same two-file fix in the separate 007 integration `7bdb95886`: **114/114 native checks pass (52.81 s)**, including serialization, image-table reuse, indirect draws, HDR, APR and the logger/shutdown checks. - Conventions and diff checks pass. The overlap tool reported eight conflicting Lifecycle PRs (#5021, #5925, #6188, #6946, #6947, #7201, #7332, #7642); manual review found stack/platform handling, journal flushing and finisher shutdown changes, with no competing change to this flush helper. No title-performance or playable-game claim. ### 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: none - [x] GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 Pro build 26200 - [x] AI-assisted: yes (Codex)
github-actions[bot] commented 2026-10-19 02:19:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T02:19:35Z.


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 5021 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 6457 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 6479 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 6730 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 6946 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 6947 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 7201 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 7622 core/libs/prx/libSceAgcDriver/Execution/include/AsyncLog.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6258267864 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7709#issuecomment-6258267864). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T02:19:35Z. --- <!-- pr-overlap --> 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 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp` | | [PR 6457](https://www.github.com/boykopovar/AnyPS5/pull/6457) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp` | | [PR 6479](https://www.github.com/boykopovar/AnyPS5/pull/6479) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp` | | [PR 6730](https://www.github.com/boykopovar/AnyPS5/pull/6730) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp` | | [PR 6946](https://www.github.com/boykopovar/AnyPS5/pull/6946) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp` | | [PR 7622](https://www.github.com/boykopovar/AnyPS5/pull/7622) | `core/libs/prx/libSceAgcDriver/Execution/include/AsyncLog.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp` | | [PR 7642](https://www.github.com/boykopovar/AnyPS5/pull/7642) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp` |
karimibrahim07 commented 2026-10-19 03:17:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karimibrahim07 on 2026-10-19T03:17:27Z.

Review: COMMENTED


Windows run of head 88c8320e3, merged onto main ccbd40240 together with #7669, #7670, #7717 and #7680 (each merge clean, built once). Windows 11 Pro (26300), Ryzen 5 3600, NVIDIA GeForce RTX 3060 (driver 610.88), WinLibs GCC 15.2.0 r7, Ninja Release, BUILD_TESTING=ON, ANYPS5_AGC_EXECUTION_TESTS with PreparedShaders and ShutdownThreads added.

  • All 29 cases you list pass (the 19 agc_driver_prepared_shaders*, the 8 agc_driver_shutdown_threads*, agc_async_log and agc_async_log_fatal), --repeat until-fail:3.
  • Negative control: with main's AsyncLog.hpp and Lifecycle.cpp, the same six cases as in your description fail: abi_deferred_pixel, _stages, _undecodable_state, _registration_failure, _vertex_inputs and _rectangle_pairs, each with libc: end flush already registered (0xc0000409). abi_deferred_compute and abi_deferred_rectangle pass either way. Here all six were 0xc0000409; I didn't see the access violation you got on one of them.

Code: an inline function whose body calls the header-local AsyncLog::Get() gives each PE image its own logger, so a native test exe and libSceAgcDriver each register an end-flush callback. The out-of-line definition in Lifecycle.cpp matches HoldAsyncLog() just below it, which already does this. InstallAsyncLog_nid_no_patch and FlushAsyncLogAtEnd_nid_no_patch stay inline. Their callers are inside the driver, so that's fine. I have no requests.

AI-assisted: yes. I ran the build, the tests and the negative control above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5566546200 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7709#pullrequestreview-5566546200). Originally posted by [karimibrahim07](https://github.com/karimibrahim07) on 2026-10-19T03:17:27Z. **Review:** COMMENTED --- Windows run of head `88c8320e3`, merged onto `main` `ccbd40240` together with #7669, #7670, #7717 and #7680 (each merge clean, built once). Windows 11 Pro (26300), Ryzen 5 3600, NVIDIA GeForce RTX 3060 (driver 610.88), WinLibs GCC 15.2.0 r7, Ninja Release, `BUILD_TESTING=ON`, `ANYPS5_AGC_EXECUTION_TESTS` with `PreparedShaders` and `ShutdownThreads` added. - All 29 cases you list pass (the 19 `agc_driver_prepared_shaders*`, the 8 `agc_driver_shutdown_threads*`, `agc_async_log` and `agc_async_log_fatal`), `--repeat until-fail:3`. - Negative control: with `main`'s `AsyncLog.hpp` and `Lifecycle.cpp`, the same six cases as in your description fail: `abi_deferred_pixel`, `_stages`, `_undecodable_state`, `_registration_failure`, `_vertex_inputs` and `_rectangle_pairs`, each with `libc: end flush already registered` (`0xc0000409`). `abi_deferred_compute` and `abi_deferred_rectangle` pass either way. Here all six were `0xc0000409`; I didn't see the access violation you got on one of them. **Code:** an `inline` function whose body calls the header-local `AsyncLog::Get()` gives each PE image its own logger, so a native test exe and `libSceAgcDriver` each register an end-flush callback. The out-of-line definition in `Lifecycle.cpp` matches `HoldAsyncLog()` just below it, which already does this. `InstallAsyncLog_nid_no_patch` and `FlushAsyncLogAtEnd_nid_no_patch` stay inline. Their callers are inside the driver, so that's fine. I have no requests. AI-assisted: yes. I ran the build, the tests and the negative control above.
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!7709
No description provided.