feat(libSceAmpr): implement the std::_Pad thread launch helpers #3743
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3743"
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 YossiYad on 2026-10-11T16:16:33Z.
What
Carries David's
screamm/AnyPS5:feat/ampr-pad-launchcommit from #3361 onto currentmain, preserving its author, and adds three follow-up commits:std::_Padconstruction, destruction,_Launch(pthread**)and_Release()in libSceAmpr. The constructor creates and locks the synchronization objects; launch starts a guest pthread and waits for its_Go()callback to release the caller; destruction releases the synchronization objects while the worker can keep running. Deathloop and Minecraft Legends import these functions, as reported in #3361.guest_ampr_threadswith four simultaneous launchers, immediate release, exit codes with the high bit set, and overwriting the destroyed pad while its worker continues from its saved arguments._nid_no_patchsuffix so it is excluded from the export inventory. The four public implementations move the library progress from 2903/3383 (85.81%) to 2907/3383 (85.93%), without counting that helper._Padfailures as the gueststd::system_errorthat Dinkumware's_Throw_C_errorpicks for the code (_Thrd_busy→device_or_resource_busy,_Thrd_error→invalid_argument,_Thrd_nomem/_Thrd_timedoutand a failing thread start →resource_unavailable_try_again), through the_Throw_Cpp_errorthatmainnow has, instead of a host exception no guest catch sees._Releasenow uses_Cnd_signallikethreadcall.cpp, since libc has it now.The implementation follows the Dinkumware thread-call sources cited in #3361. Console layout, named overloads, default thread attributes and error-reporting limitations remain recorded in
docs/dev/debt/libSceAmpr.md.Closes #3361.
Tested
Linux (Bazzite 44, GCC 16.2.1, Ninja, Release,
-DBUILD_TESTING=ON), based onmaina11c8f7f; rebased onto0f2683cbon 2026-10-13:libs, and fullctest: 824 pass, 8 skip, no failures (832 registered tests). The GPUagc_driver_pixel_interlocktest failed on an earlier run and passed on the final full run; the changed library does not participate in that test.guest_ampr_threadspasses 10 consecutive runs. The final targeted run ofguest_ampr_threads,guest_libc_threads,patched_librariesandprogress_reportpasses (4/4).mainfails at the unimplemented_Padconstructor.ctest1043/1044; the one failure,agc_driver_tessellation(segfault), does not have this PR's files among its build inputs. In a forked child with a guest terminate handler,guest_ampr_threadschecks that_Releaseon the thread still holding the pad's mutex throwsstd::system_errorwithEBUSY. The test fails with the previous host exception and with busy mapped toinvalid_argument.tools/check_conventions.py --base upstream/mainandgit diff --checkpass.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T16:16:56Z.
Progress report (
0f2683c→dd1deb6)📈 System libraries: 87.93% (+0.11%, +4 implemented functions)
✅ 4 implemented
_ZNSt4_Pad7_LaunchEPP7pthread_nid_postfix_ZNSt4_Pad8_ReleaseEv_nid_postfix_ZNSt4_PadC2Ev_nid_postfix_ZNSt4_PadD2Ev_nid_postfixImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T16:33:02Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)_ZNSt4_Pad7_LaunchEPP7pthread_nid_postfix_ZNSt4_Pad8_ReleaseEv_nid_postfix_ZNSt4_PadC2Ev_nid_postfix_ZNSt4_PadD2Ev_nid_postfixImported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-11T17:11:46Z.
#3742 carries the same commit from #3361. This PR adds two things on top: the private entry trampoline is renamed with
_nid_no_patchso the inventory no longer countsPadEntryas an export (the progress report on #3742 lists it as a fifth implemented function), andguest_ampr_threadsgains four simultaneous launchers, immediate release, high-bit exit codes and a destroyed pad whose worker keeps running. If #3742 is merged first, I'm happy to rebase the two follow-up commits onto it as a separate PR.Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T17:19:13Z.
Cross-reference: #3742 (MarcZX100) implements the same functions (the
std::_Padthread-launch helpers) — opened at the same minute (16:16 UTC).CONTRIBUTING.md asks authors to "check that no open pull request already implements the same functions" before starting — both PRs are open, so flagging for the maintainers.
The limitation this creates: only one of the two can be merged; the other gets closed as duplicate.
Related: this is also the fix tracked in #3361, which has a two-platform-verified branch (
blawesom:verify/3361, full suite green on Linux and macOS) — cross-linking so the maintainers can compare against the original author's commit if they prefer that.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T08:24:02Z.
Which title stops at one of the
std::_Padexports on main? #3361 names Deathloop and Minecraft Legends as importing them, but no run that reaches the throw. With the title ID and the log line this can go in.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T20:33:37Z.
Review: CHANGES_REQUESTED
Thanks for carrying this. Before it can go in:
main(core/libs/prx/libSceAmpr/Export.cppafter #3814, anddocs/dev/TechnicalDebt.md). Please rebase and rerunguest_ampr_threads._ZNSt4_PadC2Ev,_ZNSt4_PadD2Ev,_ZNSt4_Pad7_Launch...and_ZNSt4_Pad8_Release...(see the pr-overlap comment). CONTRIBUTING allows only one PR per function: coordinate there so these four exports land in one PR only, and list the other under "Depends on" if this one goes second.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T13:08:02Z.
Review: APPROVED
Rebased state checked:
guest_ampr_threadsand the rest of the libSceAmpr/libs ctest pass on currentmain, and the new test fails without theExport.cppchange. Layout, lock/wait order, error mapping to the gueststd::system_errorand the TechnicalDebt entry look consistent with the cited Dinkumware sources.Note for #4164: it also implements the four
std::_Padexports; this PR came first, so that part should be dropped there.Merging once the full Build is green.