fix(agc,videoout): report output file failures without stream exceptions #14982
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14982"
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-11-02T07:48:40Z.
What
Four file writers in
libSceAgcDriverandlibSceVideoOutturned onstd::ofstream::exceptions(badbit | failbit)and relied on the stream to throw when an open, write, flush or close failed. On Windows that exception cannot reach the writer's owncatch.std::ios_base::failureis thrown insidelibstdc++-6.dll(basic_ios::clear), and unwinding it needs SEH unwind data (.pdata) for every frame it crosses.With the DWARF-exception MinGW toolchain,
core/libs/CMakeLists.txtbuilds these libraries with-fno-asynchronous-unwind-tables, so their frames have none.The exception therefore stops at the first project frame. libc's crash report ends the process with
FATAL: C++ exception St13__ios_failure raised on thread N cannot be delivered: ...+0x... has no unwind data, the same pathundeliverable_host_exceptionchecks forbad_alloc.An exception thrown by project code is delivered normally on Windows, as the existing
std::system_errorcase ofReplaceGzipFileshows. So each writer now checks the stream state itself after each open, write, flush and close, and throwsstd::ios_base::failurefrom its own frame. This is the same exception type the stream threw before, so the existing catches and messages are unchanged.The four writers:
TraceFile::WriteGzipandTraceFile::AppendLine: the trace andAPS5_TRACE_BENCHfiles.Screenshot::Writewas a fifth; since main7c0784a081it writes through an exclusive create and a write loop that throw from project code, so this PR no longer changes it.FrameTimingLog.VideoOut
Telemetry::Writer.Before this change, on Windows a full disk, a locked file or a directory at the path took the whole process down at the throw. Now the failure reaches the code that already handles it. For example, the benchmark writer prints
[trace] writing ... failedand rethrows,FrameTimingLogstores the failure for the nextEnqueue, and the telemetry writer stops with its message.The test this unblocks:
ReplaceGzipFile's write-failure case, a directory at<name>.tmp, ran only off Windows for this reason. It now runs on Windows too, catchesstd::ios_base::failurespecifically, and its debt entry is removed.Tested
Linux refresh, 2026-11-12: head
c2b9a58a878dca65e5fe09c4b2b8ebbcb7284221integrates main4f9f5fffc91e5ec4cd29cb8bba9c3a991f09af48. The conflict resolution retains both the explicit stream-open check and main'sLibc::StartHostJThreadworker creation inFrameTimingLog. This PR's production/test added and removed lines are unchanged. A subsequent merge preview against maina221a742da421fc7b3b3f7c139346fe1b8642058is clean; that preview tree was not executed.Fresh Linux/RADV RX 6650 XT coverage, with frozen SDK banks and the same
PerformanceTrace.cppfixture source on both arms:agc_driver_gcn_display_present_triggerandvideo_out_flip_present.ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1, validation 1.4.363,VK_LOADER_DEBUG=layer; each physical case shows validation insertion on every repetition, and both full logs contain 0 VUID errors. Other cases exercise file output, CPU screenshot handling and window/caption behavior; they are not counted as physical rendering cases.The initial staged-main run omitted CMake-created output directories and failed five file cases opening their paths; it is excluded. The final
r2results above recreate the expected layout, preserve the intentionally missing open-failure parent and pass the complete set. No production changes were made to satisfy those staging failures.Exact pins, source-preservation/resolution proof, builds, complete verbose logs, JUnit and isolated commands, SHA-256
4d9078aaa2859011e532480562bd034d8d0e2fdf6951aa802ba5b93aa9cb1b38; archive and all 33 members downloaded/hash-verified. No fresh Windows, macOS, native-title or FPS result. Linux does not reproduce the original Windows DWARF exception-unwind defect; the earlier Windows negative control remains separately pinned evidence.Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7 (DWARF exceptions, the CI toolchain), Release, rebased onto
main947ebf3d2c. Thatmainalready fixedCaptureTracethe same way (03267ec5aa6), so that writer is no longer part of this PR. The results below are from the rebased head.Control:
agc_performance_tracewith this PR's test andmain'sTraceFile.cppfails withFATAL: C++ exception St13__ios_failure raised on thread ... cannot be delivered: ... agc_performance_trace_tests.exe+0xb7db has no unwind data. That address isbasic_ios::clear's return intoTraceFile::WriteGzip, which has no.pdataentry.The test reproduces the shipped library's setup.
agc_performance_trace_tests.exeis linked likelibSceAgcDriver.prx: both runconfigure_windows_unwindand both importbasic_ios::clearfromlibstdc++-6.dll(checked withobjdump -p). So the control's failure is the library's behaviour, not something only the test executable does.This PR:
agc_performance_tracepasses 3/3 with the case enabled.Affected tests, 3 repetitions each: all 23 tests matching
performance_trace|screenshot|capture_trace|telemetry|frame_timing|undeliverablepass, exceptvideo_out_telemetry_caption, which skips here because the display was off.Full host CTest run with Vulkan hidden: 3573/3574 pass. The one failure,
ngs2_pitchshift, also fails onmainand is fixed by #12864; the GPU tests skip.tools/check_conventions.py --base origin/mainpasses.Not run in the author’s Windows qualification above: Linux or macOS, where libstdc++ exceptions already unwind through these frames. That qualification did not execute GPU tests. Independent Linux reports below have their own source pins, selection and limitations; macOS remains untested.
Independent reports on this head:
43182c3ac6merged ontomain1d91f29: 2,620 passed · 4 failed (0 new, 2 also fail on main, 2 unstable on main) · 44 skipped (ANYPS5_REQUIRE_VULKAN=1); validation: ✅ no new validation IDs vs main (981 tests run on the GPU).Updated independent Linux coverage — 2026-11-06
TechLevelZero's new report tests the current PR head
25265fbdde059d5ec2cd9f560a0e0ccf8cd9d6d4merged onto main82fcf46d250e0ec2f436ceffd607dd2ff04c62d7, Release with SPIRV-Tools enabled, NVIDIA RTX 2000 Ada Generation / driver 595.99.02 on Linux. Of 2,965 selected tests, 2,905 passed, four failed and 56 skipped. Three failures also occur on main; the fourth (agc_driver_pipeline_journal) is reported unstable on main. The report records no new validation IDs against main across 979 GPU tests; existing validation IDs remain. Raw build and test logs.These are attributed contributor measurements on the stated integration, not a fresh local run or an all-green/full-suite claim. The earlier Windows negative control remains the evidence reproducing the output-exception defect. macOS remains untested.
Checklist
Based on current
main; no other open PR implements the same functionsOne 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 fileNo notes, investigation
.mdfiles 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: AMD Radeon RX 6650 XT, RADV, Linux; validation 1.4.363, two presentation/native-capture cases ×3 on both arms. Independent NVIDIA coverage retains the pins listed above.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T11:09:52Z.
Review: APPROVED
Looks right, and I reproduced both the crash and the fix on Windows.
Each writer now checks the stream after each open, write, flush and close, and throws
std::ios_base::failurefrom its own frame. The stream state is sticky, so checking afterclose()also catches an earlier failed write, andWriteGzip's per-chunk check covers the header write before the loop. The exception type is unchanged, so the existing catches still match.Tested on Windows 11, WinLibs GCC 15.2.0 (DWARF MinGW), Release, with head
43182c3ac6merged ontomain:agc_performance_trace,video_out_telemetryandvideo_out_telemetry_captionpass.TraceFile.cppput back tomain's version, the re-enabledReplaceGzipFilewrite-failure case ends the process withFATAL: C++ exception St13__ios_failure raised on thread … cannot be delivered: … agc_performance_trace_tests.exe+0xb7db has no unwind data, exactly the failure you describe.No GPU path changes, so I didn't run a validation-layer comparison.
Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-06T01:56:58Z.
Review: APPROVED
Re-checked — approved
@JJenkx thanks for the refresh and for the two runs. Re-checked at head
25265fbdde, which is the merge on top of43182c3ac6, the head I approved on 11-02.What moved after that approval. I compared the two heads file by file:
Execution/src/Screenshot.cppat this head is byte-identical tomain01f804bb2f, so none of this PR's writing is left in it and it is out of the diff. Keepingmain's exclusive_wopen/openversion looks right to me: it already throws from project code, which is what this PR wanted for that file.Execution/src/TraceFile.cpp,libSceVideoOut/include/FrameTimingLog.hppandlibSceVideoOut/src/Telemetry.cppare byte-identical to43182c3ac6.tests/PerformanceTrace.cppcarries the same change as before: the#ifndef _WIN32guards are gone and the catch is narrowed tostd::ios_base::failure(PerformanceTrace.cpp:611, with the check at:634). Its line numbers moved becausemainaddedWindowTriggerabove it, atPerformanceTrace.cpp:57onmain01f804bb2f.CONTRIBUTING.md("Documentation": a pull request that closes a gap removes its entry instead of rewriting it), since the test now runs on Windows too.My run. Head
25265fbddemerged intomain01f804bb2f(merge2751cbf419), Windows 11, WinLibs GCC, Release, AMD Radeon RX 9070 XT (device0x7550), driver32.0.32015.12012, Vulkan validation layer 1.4.363, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ctest -V:performance_trace|screenshot|capture_trace|telemetry|frame_timing|undeliverable: 23 of 23 pass, none skipped;VUID-orSYNC-HAZARDid appears on either side of the comparison.Negative control. With
TraceFile.cpp,FrameTimingLog.hppandTelemetry.cpptaken frommainand this branch's test kept,agc_performance_tracefails and the other 22 pass. So the test does reach the change, which is what I wanted to see again after the conflict resolution.Overlap. I ran
tools/pr_overlap.pyon this head myself. Two open pull requests conflict on lines this one changes.gh pr viewreports both as MERGEABLE againstmain, and neither of their changes contradicts this one. What follows is about rebase order.fix(trace): preserve Unicode output paths on Windows) edits the same two regions ofTraceFile.cpp: it adds#include <cstdlib>to the include block atTraceFile.cpp:3-10onmain, where this PR adds#include <ios>, and insertsTraceFile::Directory()directly afternamespace AgcDriver {atTraceFile.cpp:15onmain, where this PR inserts its anonymous namespace holdingRequireGood. It also adds aDirectory()case totests/PerformanceTrace.cpp. Whichever lands second needs a two-hunk rebase.fix(runtime): isolate host worker MXCSR) changesFrameTimingLog.hppthree lines below this PR's edit: it replaces thestd::jthreadatFrameTimingLog.hpp:28onmainwithLibc::StartHostJThread. One thing to watch on that rebase: #7622's copy still carriesfile.exceptions(std::ios::badbit | std::ios::failbit)atFrameTimingLog.hpp:25onmain, the line this PR removes, so a resolution that keeps #7622's side of the constructor wholesale would bring the MinGW unwind problem back.A further 48 open pull requests share files with this one but could not be compared, because each conflicts with the base; every shared path reported for them is
docs/dev/debt/libSceAgcDriver.md.Approving again at this head.