feat(libc): export std:🧵:hardware_concurrency (PPSA34015) #6086

Merged
notaxeltv merged 2 commits from upstream-pr/6086 into main 2026-10-24 06:18:54 +00:00
notaxeltv commented 2026-10-14 21:33:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by notaxeltv on 2026-10-14T21:33:50Z.


What

tools/import_audit.py on PPSA34015 lists absent libc.prx import CHrhwd8QSBs (_ZNSt6thread20hardware_concurrencyEv). Forwards to std::thread::hardware_concurrency(). Distinct from closed _Thrd_hardware_concurrency / __sce_v2 exports (#5415).

Tested

Windows 10, WinLibs GCC 15.2.0, guest_std_thread_hardware_concurrency passes. tools/check_conventions.py --base upstream/main passes.

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 (none)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA34015 (absent libc import)
  • GPUs tested: n/a
  • AI-assisted: yes

Made with Cursor

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4864845540 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6086). Originally posted by [notaxeltv](https://github.com/notaxeltv) on 2026-10-14T21:33:50Z. --- ### What `tools/import_audit.py` on PPSA34015 lists absent `libc.prx` import `CHrhwd8QSBs` (`_ZNSt6thread20hardware_concurrencyEv`). Forwards to `std::thread::hardware_concurrency()`. Distinct from closed `_Thrd_hardware_concurrency` / `__sce_v2` exports (#5415). ### Tested Windows 10, WinLibs GCC 15.2.0, `guest_std_thread_hardware_concurrency` passes. `tools/check_conventions.py --base upstream/main` passes. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical 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 (none) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA34015 (absent libc import) - [x] GPUs tested: n/a - [x] AI-assisted: yes Made with [Cursor](https://cursor.com)
adriadam10 commented 2026-10-16 22:43:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T22:43:46Z.

Review: CHANGES_REQUESTED


Built and ran guest_std_thread_hardware_concurrency locally: passes. Two things before merging:

  • core/libs/tests/GuestStdThreadHardwareConcurrency.cpp:23: the comparison against sysconf(_SC_NPROCESSORS_ONLN) / GetSystemInfo is not guaranteed to match std::thread::hardware_concurrency() (CPU affinity, cgroup limits, processor groups), so the test can fail spuriously. Keep only the comparison with std::thread::hardware_concurrency().
  • core/libs/prx/libc/src/Threads.cpp:273: the export returns the host CPU count; the PS5 value is not sourced from anywhere (no reference implements it). Add a line to the technical debt file under the right section saying the host count is returned instead of the console's, and what PPSA34015 expects if you know it.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5554448044 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6086#pullrequestreview-5554448044). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-16T22:43:46Z. **Review:** CHANGES_REQUESTED --- Built and ran `guest_std_thread_hardware_concurrency` locally: passes. Two things before merging: - `core/libs/tests/GuestStdThreadHardwareConcurrency.cpp:23`: the comparison against `sysconf(_SC_NPROCESSORS_ONLN)` / `GetSystemInfo` is not guaranteed to match `std::thread::hardware_concurrency()` (CPU affinity, cgroup limits, processor groups), so the test can fail spuriously. Keep only the comparison with `std::thread::hardware_concurrency()`. - `core/libs/prx/libc/src/Threads.cpp:273`: the export returns the host CPU count; the PS5 value is not sourced from anywhere (no reference implements it). Add a line to the technical debt file under the right section saying the host count is returned instead of the console's, and what PPSA34015 expects if you know it.
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!6086
No description provided.