fix(agc): reject late profiling output after shutdown #7755
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7755"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-19T06:07:10Z.
What
After
StopProfileOutput_nid_no_patch()drains and joins the diagnostic writer, a lateProfilePrint_nid_no_patch()throwsprofile output is stopping. This was the final exception during an ordinary close of a Crimson Spires (PPSA03568) profiling run. Independently, the oversized formatting path can increment the dropped-message count after the worker has exited, leaving a subsequentFlush()waiting forever.Reject late writes with
false, matching the queue’s existing rejection result, and stop oversized messages from adding work after shutdown. Accepted output still drains beforeStop()returns. Actual writer failures still propagate, including after stop and through all formatting paths. This changes diagnostic output only; it adds no guest API fallback.Overlap check: #7622 could not be compared automatically because it conflicts with main. Its patch in this header only includes
HostThread.hppand replaces the worker constructor withLibc::StartHostThread; inspected manually, it is independent of this queue shutdown change. No dependency.Tested
Arch Linux x86-64, GCC, base
46f27623c28b237f6b7dab93862a318e4977cc19, changef085363ef22b4335d0385444c246d64876705465.profile output is stopping. A separate main-only reproducer (Stop(); Print()with 10000 characters and capacity 8192;Flush()) times out after 3 seconds, exit 124.ProfileOutput.cpppasses as a standalone C++20/pthread executable, and under AddressSanitizer + UndefinedBehaviorSanitizer. Tests cover repeated stop, drain ordering, empty and late writes, small/heap/oversized formatting, eight concurrent producers racing stop, bounded overflow and actual writer-error propagation after stop.libsand CMakeagc_profile_output_tests: both build successfully.ctest --test-dir build-full --output-on-failure -R '^agc_profile_output$': 1/1 passed, 0.02 s.python3 tools/check_conventions.py --base origin/mainandgit diff --checkpass.Native integration validation (Crimson Spires, PPSA03568): prior diagnostic integration head
9f6fc8b877c7f1fc48ad572327c56bc716a6461dexits 134 during ordinary close withprofile output is stopping. Adding only this PR’s patch produces integration head45bab09c33a7f484bb8b69119ee98992ccf0a8e1: ordinary close requested at 129.36 s, process exits 0 at 131.37 s, PID gone and kernel limit restored to 64 MiB. Noprofile output is stoppingor termination exception appears. The focused profiler CTest also passes on the integration build.The existing integration uses main
9f5d4bd929862fc7c50e6cbb256032cf2095b10f, infinite-depth-bounds and resident/layer-window fixes, and sampled-storage diagnostic counters. Both native runs use the same relinked title, profiling switches, two scheduled Cross inputs at 60/70 seconds after first present and ordinary close at 125 seconds after first present. Cache contents evolve; this establishes shutdown behavior, not a speed comparison. This is a native integration result, not an isolated title test of the PR head on current main.26 GPU-readback frames were saved; selected frames show the menu and driving cutscene. X11 snapshots at 100/115 seconds repeat despite advancing frame counts, so scene inspection uses GPU frames. AMD RX 6650 XT / RADV Mesa 26.2.4, Arch Linux. No performance result.
Independent Windows regression validation: savvaniss reports three serial runs each on Intel UHD 770 (driver 32.0.101.7088) and AMD RX 9070 XT (driver 32.0.31041.1004), Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release.
agc_profile_outputpasses with PR headf085363efmerged into main6b8228b2b; the PR test file alone on that main fails withprofile output is stoppingon both GPUs. Every execution test was built;ANYPS5_NO_SHADER_CACHE=1, with the AMDVkCacheemptied first. This is contributor-reported focused regression evidence, not a Windows native-title or performance test.Additional Linux native integration validation (Smurfs Dreams, PPSA21607 v01.002.000): profiling integration
97a9225d722842fc1e893ceabca3969617230e47reached the village but exited 134 after the scheduled ordinary close, ending inprofile output is stopping. Applying only this PR’s patch produced11b1d62ade7eb71f13acb05ca78f2ea2ad7f2944: the village still renders, ordinary close was requested at 355.66 s, and the process exited 0 at 357.67 s. PID gone; udmabuf limit restored to 64 MiB; no profiling-stop or termination exception. The CPU-onlyagc_profile_outputCTest passes on both integrations. Both runs use the same relinked title, restored checkpoint,APS5_PROFILE_DRAW=1,APS5_PROFILE_GPU=1, scheduled inputs and close procedure. Caches evolve; this is functional shutdown evidence, not a performance comparison. The base integration is main3aa35dc014a84b783c2fbe642f8e08341feb1a30plus #6959 and #6948; this is not an isolated title test of the PR head on current main. RX 6650 XT / RADV Mesa 26.2.4, Linux. Existing pending-storage-image shutdown diagnostics remain.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-19T06:24:14Z.
Native macOS confirmation at exact head
f085363ef22b4335d0385444c246d64876705465, against parent46f27623c28b237f6b7dab93862a318e4977cc19: both shutdown failures reproduce here, including through the public profiling wrappers.macOS 27.2 arm64, AppleClang 21.0.0/libc++, standalone C++20/pthread builds using the exact production header. No other PRs applied.
Stop()Write("late")profile output is stoppingFlush()finishesPrintof 10000 charactersPrintreturns;Flush()exceeds 2 sProfilePrint_nid_no_patchafterStopProfileOutput_nid_no_patch, small textThe oversized timeout is after
Stop()returned and after formatting returned, with the accepted output already drained. A local queue reproduces it without the global singleton. This fits the specific chain in the header: the stopped worker has exited, the old oversized path incrementsdropped, andFlush()waits fordropped == 0with no worker left to clear it.Two isolated controls separate the fixes:
Write()guard: both small-text probes fail again; both oversized probes still pass.The unchanged PR
ProfileOutput.cppalso passes 50 fresh optimized runs and 20 fresh AddressSanitizer + UndefinedBehaviorSanitizer runs, with no sanitizer diagnostics. That includes accepted-output draining, eight producers racing stop, overflow, and all six real-writer-failure paths (including formatting after stop). Thus the late-output rejection does not swallow the injected writer error in those checks.This is native queue/wrapper verification, not a macOS title run, full AGC build, or full application-teardown test. No performance or Windows result is claimed.
Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T07:52:18Z.
Intel and AMD Windows data:
agc_profile_outputfails onmainand passes with this PR, on an Intel UHD 770 and an AMD RX 9070 XT.Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built,
ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, withVkCacheemptied first. This headf085363efmerged intomain6b8228b2b. "Without" means this PR's test file onmain6b8228b2b, with none of its other changes.agc_profile_outputprofile output is stoppingAI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-19T23:40:29Z.
Linux title shutdown corroboration: Snoopy (PPSA28795) reached the backyard with draw profiling enabled, then an ordinary window close completed with native exit 0. The process was gone and the harness restored its kernel configuration. I inspected the final gameplay capture.
The preceding run on integration
31418b2d60terminated with exit 134 andprofile output is stoppingafter the same ordinary-close schedule. Cherry-picking this PR ased307c29dafdwas the only source change for the successful run. Both used the same relinked title, pipelined draws/DMA, full SPIR-V optimization, draw profiling/cache diagnostics, input schedule, and close at 270 seconds.This is an integration regression check: the common base is
f3fe95b4b9plus the DCC-clear and partial draw-history changes, not current main. It supports the teardown fix and makes no performance claim. Local evidence:sync190baseline andsync192-snoopy-profile-stopcandidate; candidate build and the focusedagc_profile_outputtest also passed.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T01:44:56Z.
Checked the three
Print/Writepaths afterStop(): late writes now return false like the queue-full rejection, the oversized path no longer bumpsdroppedafter the worker exited (soFlush()can't hang), and a real writer failure is still rethrown first. The new tests fail on main and cover repeated stop, concurrent producers racing stop and writer errors after stop; the macOS and Windows runs in the thread agree; merged.