feat(libSceLibcInternal): implement unsigned byte extrema #15460

Merged
mkrieger95 merged 1 commit from upstream-pr/15460 into main 2026-11-07 13:17:33 +00:00
mkrieger95 commented 2026-11-03 12:21:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mkrieger95 on 2026-11-03T12:21:22Z.


What

Implement __std_min_1u (JkTHJqCAwss) and __std_max_1u (EY5VhjRs2Ns) in libSceLibcInternal, replacing two throwing inventory declarations. They return the smallest or largest unsigned byte in a nonempty half-open range and leave the input unchanged.

The signatures and valid-range behavior follow Microsoft's public STL vector_algorithms.cpp: two const void* endpoints and a uint8_t result. Its scalar reduction reads an initial element, so a valid range is nonempty. This implementation throws std::invalid_argument for null, empty or reversed ranges instead of invoking the source algorithm with invalid input.

The physical-module map contains both NIDs in libSceLibcInternal. The exact Sony implementation, PS5 ABI and invalid-input behavior remain unmeasured and are recorded in docs/dev/debt/libSceLibcInternal.md. The remaining placeholder count is reduced from 40 to 38.

The reductions are written against that public contract; no third-party source or dependency is added. No SIMD-equivalence, speed or title-unblock claim is made.

Tested

Linux x86-64, GCC 14.2, Release, BUILD_TESTING=ON; based on upstream 4f41f4c375f5abb487dbd184fbc150f31994d762. Tested head: 446b5d63fd6f1927018055b4af55a3ca58ebfb40 on 2026-11-03 UTC.

  • Built production libSceLibcInternal, guest_libc_internal_byte_extrema_tests and guest_vector_algorithms_tests.
  • 3/3 focused CTests pass: guest_libc_internal_min_byte, guest_libc_internal_max_byte, guest_vector_algorithms.
  • Each new test covers all 256 singleton values and all 65,536 ordered byte pairs; 19 range lengths through 512 bytes with 32 start offsets; exclusion of more-extreme values immediately outside the range; extrema at its start, middle and end; unchanged input; null, empty and reversed ranges.
  • Negative controls: retaining the corrected prototypes but restoring the original throwing bodies makes both new CTests fail with their respective not implemented errors. Replacing unsigned comparisons with signed-byte comparisons makes both fail their unsigned-ordering assertion. The committed implementation was then restored byte-for-byte, rebuilt and both tests passed again.
  • python3 core/libs/tests/test_public_headers.py --audit-only: 406 libraries, 28,302 exports pass.
  • python3 tools/check_conventions.py --base origin/main and git diff --check: pass.
  • tools/nid_names.py --name __std_min_1u --name __std_max_1u --where confirms both NIDs. A patched copy of the production library exports each NID exactly once.

Not tested: Windows, macOS, a title or a PS5. No console-parity or whole-project-build claim.

Overlap: python3 tools/pr_overlap.py --branch feat/libc-internal-byte-extrema --repo boykopovar/AnyPS5 checked 1,675 open upstream PRs against 4f41f4c375f5abb487dbd184fbc150f31994d762. Completed comparisons report no conflicting lines, same exports or same new files. It exits 2 because existing base conflicts prevent full comparisons with #5021, #13486, #13778, #13782, #14158, #14212, #14401, #14837 and #14936. Every reported shared CMake/debt file was compared manually using its common ancestor: merging this head produces exactly the same conflict hunks as merging unmodified main. None of those patches changes either helper or adds this test. The change adds no overlap requiring a landing-order dependency or author coordination.

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: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5137130234 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15460). Originally posted by [mkrieger95](https://github.com/mkrieger95) on 2026-11-03T12:21:22Z. --- ### What Implement `__std_min_1u` (`JkTHJqCAwss`) and `__std_max_1u` (`EY5VhjRs2Ns`) in `libSceLibcInternal`, replacing two throwing inventory declarations. They return the smallest or largest unsigned byte in a nonempty half-open range and leave the input unchanged. The signatures and valid-range behavior follow Microsoft's public STL [`vector_algorithms.cpp`](https://github.com/microsoft/STL/blob/b53b100c3c08f3e2a4453bbe75e3156d4127ffc1/stl/src/vector_algorithms.cpp#L3865-L3912): two `const void*` endpoints and a `uint8_t` result. Its scalar reduction reads an initial element, so a valid range is nonempty. This implementation throws `std::invalid_argument` for null, empty or reversed ranges instead of invoking the source algorithm with invalid input. The [physical-module map](https://github.com/boykopovar/ps5-nid-map/blob/cc1d586fddab576a520f226da6b2632b031e6d09/data/Modules/libSceLibcInternal.inc) contains both NIDs in `libSceLibcInternal`. The exact Sony implementation, PS5 ABI and invalid-input behavior remain unmeasured and are recorded in `docs/dev/debt/libSceLibcInternal.md`. The remaining placeholder count is reduced from 40 to 38. The reductions are written against that public contract; no third-party source or dependency is added. No SIMD-equivalence, speed or title-unblock claim is made. ### 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. --> Linux x86-64, GCC 14.2, Release, `BUILD_TESTING=ON`; based on upstream `4f41f4c375f5abb487dbd184fbc150f31994d762`. Tested head: `446b5d63fd6f1927018055b4af55a3ca58ebfb40` on 2026-11-03 UTC. - Built production `libSceLibcInternal`, `guest_libc_internal_byte_extrema_tests` and `guest_vector_algorithms_tests`. - 3/3 focused CTests pass: `guest_libc_internal_min_byte`, `guest_libc_internal_max_byte`, `guest_vector_algorithms`. - Each new test covers all 256 singleton values and all 65,536 ordered byte pairs; 19 range lengths through 512 bytes with 32 start offsets; exclusion of more-extreme values immediately outside the range; extrema at its start, middle and end; unchanged input; null, empty and reversed ranges. - Negative controls: retaining the corrected prototypes but restoring the original throwing bodies makes both new CTests fail with their respective `not implemented` errors. Replacing unsigned comparisons with signed-byte comparisons makes both fail their unsigned-ordering assertion. The committed implementation was then restored byte-for-byte, rebuilt and both tests passed again. - `python3 core/libs/tests/test_public_headers.py --audit-only`: 406 libraries, 28,302 exports pass. - `python3 tools/check_conventions.py --base origin/main` and `git diff --check`: pass. - `tools/nid_names.py --name __std_min_1u --name __std_max_1u --where` confirms both NIDs. A patched copy of the production library exports each NID exactly once. Not tested: Windows, macOS, a title or a PS5. No console-parity or whole-project-build claim. Overlap: `python3 tools/pr_overlap.py --branch feat/libc-internal-byte-extrema --repo boykopovar/AnyPS5` checked 1,675 open upstream PRs against `4f41f4c375f5abb487dbd184fbc150f31994d762`. Completed comparisons report no conflicting lines, same exports or same new files. It exits 2 because existing base conflicts prevent full comparisons with #5021, #13486, #13778, #13782, #14158, #14212, #14401, #14837 and #14936. Every reported shared CMake/debt file was compared manually using its common ancestor: merging this head produces exactly the same conflict hunks as merging unmodified main. None of those patches changes either helper or adds this test. The change adds no overlap requiring a landing-order dependency or author coordination. ### 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: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-11-03 12:55:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T12:55:59Z.

Review: APPROVED


Reviewed — looks good

I found no blocking issue at this head, and all applicable hosted checks have completed successfully.

What I ran

Reviewed all five changed files at head 446b5d63fd6f1927018055b4af55a3ca58ebfb40 against base 4f41f4c375f5abb487dbd184fbc150f31994d762. The exact head previews cleanly against current main. Environment: Debian 12 x86_64, Python 3.11.2, Git 2.39.5, GCC 12.2.0. I did not build or run CTest; test results below are author-reported.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15460 --output-dir /tmp/anyps5-pr-precheck/15460-20261103
git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...446b5d63fd6f1927018055b4af55a3ca58ebfb40
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 4f41f4c375f5abb487dbd184fbc150f31994d762 --head 446b5d63fd6f1927018055b4af55a3ca58ebfb40 --json
python3 tools/nid_names.py --name __std_min_1u --name __std_max_1u --json
python3 tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/15460-20261103/head-446b5d63fd6f-5f6e5bab --json core/libs/tests/GuestLibcInternalByteExtrema.cpp
python3 tools/pr_stack_check.py 15460 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/15460-stack
gh pr checks 15460 --repo boykopovar/AnyPS5

Results

Check Result Note
Diff and conventions passed Exact-head diff and repository conventions passed.
ABI and NIDs passed 40 symbols audited with no findings; both NIDs match the names.
Test registration passed CMake registers both focused CTests; the heuristic warning is a false positive.
Main preview passed The head merges cleanly against the current base.
Hosted checks passed Windows, conventions, intake, labels, portability, eligibility and report passed.
Local build and CTest not run No local compilation or test execution was performed.
Precheck optional helpers failed The isolated PR snapshot does not contain the reviewer-only audit scripts.
Precheck table and check output
| Check | Status | Command / reason |
|---|---|---|
| build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` |
| diff_check | passed | `git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...446b5d63fd6f1927018055b4af55a3ca58ebfb40` |
| conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 --head 446b5d63fd6f1927018055b4af55a3ca58ebfb40 --title feat(libSceLibcInternal): implement unsigned byte extrema --body /tmp/anyps5-pr-precheck/15460-20261103/pr-body.md` |
| changed_export_abi_audit | failed | `tools/pr_abi_audit.py` is absent from the isolated PR snapshot. |
| python_syntax | not_applicable | No changed Python implementation files. |
| related_python_unit_tests | not_applicable | No changed tools module with a sibling unit-test suite. |
| python_test_registration | not_applicable | No changed Python test files. |
| live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 15460 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/15460-20261103/stack` |
| build_dependent_cpp_tests | not_applicable | C++ tests require a build; the precheck does not build. |
| test_quality_heuristics | failed | `tools/pr_test_quality.py` is absent from the isolated PR snapshot. |
| negative_controls | not_applicable | No changed Python test module supports a no-build base-source control. |
All conventions checks passed.
passed symbols 40 findings []

The NID lookup returned __std_min_1u → JkTHJqCAwss and __std_max_1u → EY5VhjRs2Ns. The test-quality helper warned that it could not find a literal test source path in CMake; inspection confirms the source is passed through ${LIBS_INCLUDE_DIR}/tests/GuestLibcInternalByteExtrema.cpp and both CTest entries are present.

# PR stack check — fresh
Target: https://github.com/boykopovar/AnyPS5/pull/15460
All heads unchanged: True
Dependency order: #15460
- PR #15460: clean against current base
No declared PR dependencies were found in the target PR chain.

Exact gh pr checks output at final refresh:

edge-watch	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913957150
linux	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913956668
register-context	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913957229
relinker	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913955727
relinker-asan	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913956595
windows	pass	24m17s	https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913953456
write-watch	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913956569
conventions	pass	24s	https://github.com/boykopovar/AnyPS5/actions/runs/41635013678/job/125913891414
eligibility	pass	5s	https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913891200
intake	pass	24s	https://github.com/boykopovar/AnyPS5/actions/runs/41635013616/job/125913890697
labels	pass	10s	https://github.com/boykopovar/AnyPS5/actions/runs/41635013665/job/125913891558
library-portability	pass	1m51s	https://github.com/boykopovar/AnyPS5/actions/runs/41635014056/job/125913889804
report	pass	34s	https://github.com/boykopovar/AnyPS5/actions/runs/41635014227/job/125913890408

Relevant Windows job log lines:

windows	Build and run changed guest core/libs tests	2026-11-03T12:30:46.2424600Z guest_vector_algorithms_tests
windows	Build and run changed guest core/libs tests	2026-11-03T12:39:20.7873111Z [112/1192] Building CXX object core/libs/prx/libc/CMakeFiles/guest_vector_algorithms_tests.dir/__/__/tests/GuestVectorAlgorithms.cpp.obj
windows	Build and run changed guest core/libs tests	2026-11-03T12:42:40.7834885Z [716/1192] Linking CXX executable tests\guest_vector_algorithms_tests.exe
windows	Build and run changed guest core/libs tests	2026-11-03T12:43:16.1746349Z           Start  872: guest_vector_algorithms
windows	Build and run changed guest core/libs tests	2026-11-03T12:43:16.2085209Z  326/3093 Test  #872: guest_vector_algorithms ...............................................   Passed    0.03 sec
windows	Build and run changed guest core/libs tests	2026-11-03T12:44:15.2263274Z           Start 2840: guest_libc_internal_min_byte
windows	Build and run changed guest core/libs tests	2026-11-03T12:44:15.2438557Z           Start 2841: guest_libc_internal_max_byte
windows	Build and run changed guest core/libs tests	2026-11-03T12:44:15.2542098Z 2255/3093 Test #2840: guest_libc_internal_min_byte ..........................................   Passed    0.03 sec
windows	Build and run changed guest core/libs tests	2026-11-03T12:44:15.2623951Z 2256/3093 Test #2841: guest_libc_internal_max_byte ..........................................   Passed    0.02 sec
windows	Build and run changed guest core/libs tests	2026-11-03T12:45:39.9579915Z 100% tests passed, 0 tests failed out of 3093
windows	Build and run changed guest core/libs tests	2026-11-03T12:45:39.9580895Z Total Test time (real) = 148.22 sec

Negative control

Assertion Change to code under test Did the test fail?
The tests reject the original unimplemented behavior. Author reports restoring the throwing bodies. Yes, author-reported; not run by me.
The comparisons use unsigned byte ordering. Author reports replacing the unsigned comparisons with signed comparisons. Yes, author-reported; not run by me.

Findings

Blocking

None found in the reviewed source.

Non-blocking

The PR reports focused tests and negative controls on Linux, but I did not reproduce them locally. Console ABI and invalid-range behavior remain unmeasured, as the PR records. Linux and specialized hosted jobs were skipped.

Sources

Not verified

I did not run a local build, CTest, either reported negative control, Windows/macOS/Linux runtime tests, or console behavior. The hosted Windows job is pending; Linux and specialized hosted jobs were skipped.

To get this to a good state

No code change is requested for this head. If the head changes, I will review the new diff and rerun applicable checks.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5752507367 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15460#pullrequestreview-5752507367). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-03T12:55:59Z. **Review:** APPROVED --- # Reviewed — looks good I found no blocking issue at this head, and all applicable hosted checks have completed successfully. ## What I ran Reviewed all five changed files at head `446b5d63fd6f1927018055b4af55a3ca58ebfb40` against base `4f41f4c375f5abb487dbd184fbc150f31994d762`. The exact head previews cleanly against current `main`. Environment: Debian 12 x86_64, Python 3.11.2, Git 2.39.5, GCC 12.2.0. I did not build or run CTest; test results below are author-reported. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15460 --output-dir /tmp/anyps5-pr-precheck/15460-20261103 git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...446b5d63fd6f1927018055b4af55a3ca58ebfb40 python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 4f41f4c375f5abb487dbd184fbc150f31994d762 --head 446b5d63fd6f1927018055b4af55a3ca58ebfb40 --json python3 tools/nid_names.py --name __std_min_1u --name __std_max_1u --json python3 tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/15460-20261103/head-446b5d63fd6f-5f6e5bab --json core/libs/tests/GuestLibcInternalByteExtrema.cpp python3 tools/pr_stack_check.py 15460 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/15460-stack gh pr checks 15460 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | Note | |---|---|---| | Diff and conventions | passed | Exact-head diff and repository conventions passed. | | ABI and NIDs | passed | 40 symbols audited with no findings; both NIDs match the names. | | Test registration | passed | CMake registers both focused CTests; the heuristic warning is a false positive. | | Main preview | passed | The head merges cleanly against the current base. | | Hosted checks | passed | Windows, conventions, intake, labels, portability, eligibility and report passed. | | Local build and CTest | not run | No local compilation or test execution was performed. | | Precheck optional helpers | failed | The isolated PR snapshot does not contain the reviewer-only audit scripts. | <details> <summary>Precheck table and check output</summary> ```text | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...446b5d63fd6f1927018055b4af55a3ca58ebfb40` | | conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 --head 446b5d63fd6f1927018055b4af55a3ca58ebfb40 --title feat(libSceLibcInternal): implement unsigned byte extrema --body /tmp/anyps5-pr-precheck/15460-20261103/pr-body.md` | | changed_export_abi_audit | failed | `tools/pr_abi_audit.py` is absent from the isolated PR snapshot. | | python_syntax | not_applicable | No changed Python implementation files. | | related_python_unit_tests | not_applicable | No changed tools module with a sibling unit-test suite. | | python_test_registration | not_applicable | No changed Python test files. | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 15460 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/15460-20261103/stack` | | build_dependent_cpp_tests | not_applicable | C++ tests require a build; the precheck does not build. | | test_quality_heuristics | failed | `tools/pr_test_quality.py` is absent from the isolated PR snapshot. | | negative_controls | not_applicable | No changed Python test module supports a no-build base-source control. | ``` ```text All conventions checks passed. ``` ```text passed symbols 40 findings [] ``` The NID lookup returned `__std_min_1u` → `JkTHJqCAwss` and `__std_max_1u` → `EY5VhjRs2Ns`. The test-quality helper warned that it could not find a literal test source path in CMake; inspection confirms the source is passed through `${LIBS_INCLUDE_DIR}/tests/GuestLibcInternalByteExtrema.cpp` and both CTest entries are present. ```text # PR stack check — fresh Target: https://github.com/boykopovar/AnyPS5/pull/15460 All heads unchanged: True Dependency order: #15460 - PR #15460: clean against current base No declared PR dependencies were found in the target PR chain. ``` Exact `gh pr checks` output at final refresh: ```text edge-watch skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913957150 linux skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913956668 register-context skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913957229 relinker skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913955727 relinker-asan skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913956595 windows pass 24m17s https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913953456 write-watch skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913956569 conventions pass 24s https://github.com/boykopovar/AnyPS5/actions/runs/41635013678/job/125913891414 eligibility pass 5s https://github.com/boykopovar/AnyPS5/actions/runs/41635014136/job/125913891200 intake pass 24s https://github.com/boykopovar/AnyPS5/actions/runs/41635013616/job/125913890697 labels pass 10s https://github.com/boykopovar/AnyPS5/actions/runs/41635013665/job/125913891558 library-portability pass 1m51s https://github.com/boykopovar/AnyPS5/actions/runs/41635014056/job/125913889804 report pass 34s https://github.com/boykopovar/AnyPS5/actions/runs/41635014227/job/125913890408 ``` Relevant Windows job log lines: ```text windows Build and run changed guest core/libs tests 2026-11-03T12:30:46.2424600Z guest_vector_algorithms_tests windows Build and run changed guest core/libs tests 2026-11-03T12:39:20.7873111Z [112/1192] Building CXX object core/libs/prx/libc/CMakeFiles/guest_vector_algorithms_tests.dir/__/__/tests/GuestVectorAlgorithms.cpp.obj windows Build and run changed guest core/libs tests 2026-11-03T12:42:40.7834885Z [716/1192] Linking CXX executable tests\guest_vector_algorithms_tests.exe windows Build and run changed guest core/libs tests 2026-11-03T12:43:16.1746349Z Start 872: guest_vector_algorithms windows Build and run changed guest core/libs tests 2026-11-03T12:43:16.2085209Z 326/3093 Test #872: guest_vector_algorithms ............................................... Passed 0.03 sec windows Build and run changed guest core/libs tests 2026-11-03T12:44:15.2263274Z Start 2840: guest_libc_internal_min_byte windows Build and run changed guest core/libs tests 2026-11-03T12:44:15.2438557Z Start 2841: guest_libc_internal_max_byte windows Build and run changed guest core/libs tests 2026-11-03T12:44:15.2542098Z 2255/3093 Test #2840: guest_libc_internal_min_byte .......................................... Passed 0.03 sec windows Build and run changed guest core/libs tests 2026-11-03T12:44:15.2623951Z 2256/3093 Test #2841: guest_libc_internal_max_byte .......................................... Passed 0.02 sec windows Build and run changed guest core/libs tests 2026-11-03T12:45:39.9579915Z 100% tests passed, 0 tests failed out of 3093 windows Build and run changed guest core/libs tests 2026-11-03T12:45:39.9580895Z Total Test time (real) = 148.22 sec ``` </details> ## Negative control | Assertion | Change to code under test | Did the test fail? | |---|---|---| | The tests reject the original unimplemented behavior. | Author reports restoring the throwing bodies. | Yes, author-reported; not run by me. | | The comparisons use unsigned byte ordering. | Author reports replacing the unsigned comparisons with signed comparisons. | Yes, author-reported; not run by me. | ## Findings ### Blocking None found in the reviewed source. ### Non-blocking The PR reports focused tests and negative controls on Linux, but I did not reproduce them locally. Console ABI and invalid-range behavior remain unmeasured, as the PR records. Linux and specialized hosted jobs were skipped. ## Sources - [Microsoft STL byte extrema declarations and dispatch at the pinned source revision](https://github.com/microsoft/STL/blob/b53b100c3c08f3e2a4453bbe75e3156d4127ffc1/stl/src/vector_algorithms.cpp#L3865-L3912) - [Implementation at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/446b5d63fd6f1927018055b4af55a3ca58ebfb40/core/libs/prx/libSceLibcInternal/RecoveredInventory.cpp#L1-L80) - [Tests at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/446b5d63fd6f1927018055b4af55a3ca58ebfb40/core/libs/tests/GuestLibcInternalByteExtrema.cpp) - [CTest registration at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/446b5d63fd6f1927018055b4af55a3ca58ebfb40/core/libs/prx/libSceLibcInternal/CMakeLists.txt#L1-L16) ## Not verified I did not run a local build, CTest, either reported negative control, Windows/macOS/Linux runtime tests, or console behavior. The hosted Windows job is pending; Linux and specialized hosted jobs were skipped. ## To get this to a good state No code change is requested for this head. If the head changes, I will review the new diff and rerun applicable checks.
XairRrR commented 2026-11-03 13:06:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T13:06:59Z.

Review: APPROVED


Reviewed — approved

__std_min_1u and __std_max_1u work correctly on valid ranges, the focused tests pass on the merged tree, and the new tests fail under both negative controls I ran myself.

What I ran

Head 446b5d63fd6f1927018055b4af55a3ca58ebfb40 merged with --no-ff into main 4f41f4c375f5abb487dbd184fbc150f31994d762 (merged tree 5594b63da4e643d1c308860bc1eb829f4d73acf7). Machine: Debian 13 VM, 2× Xeon Gold 6136 (32 vCPU), GCC 14.2.0, Release, Ninja, BUILD_TESTING=ON.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...446b5d63fd6f1927018055b4af55a3ca58ebfb40
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "^(guest_libc_internal_(min|max)_byte|guest_vector_algorithms|public_headers)$"
# negative control 1: both bodies -> NotImplemented_nid_no_patch(__func__)
ninja -C build -j32 -l32 guest_libc_internal_byte_extrema_tests
ctest --test-dir build --output-on-failure -R "^guest_libc_internal_(min|max)_byte$"
# negative control 2: comparisons through std::int8_t
ninja -C build -j32 -l32 guest_libc_internal_byte_extrema_tests
ctest --test-dir build --output-on-failure -R "^guest_libc_internal_(min|max)_byte$"
# restore the merged file, rebuild, re-run, then:
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Build of the merged tree (script) OK
guest_libc_internal_min_byte, guest_libc_internal_max_byte passed, 0.01 s each
guest_vector_algorithms passed
public_headers passed (50 s; this test already exists and the PR does not affect its runtime)
Script test run (3725 tests) no new failures or timeouts; the 9 known failures also fail on main
Vulkan validation comparison skipped by the script; the PR changes no AGC, shader or VideoOut files
Worktree after the controls clean (git status --porcelain empty)
Negative control output
terminate called after throwing an instance of 'std::runtime_error'
  what():  __std_max_1u_nid_postfix not implemented
0% tests passed, 2 tests failed out of 2
---
libc internal byte extrema: unsigned byte ordering must hold for every pair
libc internal byte extrema: unsigned byte ordering must hold for every pair
0% tests passed, 2 tests failed out of 2

Negative control

The PR has no new production file, and restoring RecoveredInventory.cpp from main while keeping the new header would not compile. So I applied two mutations to the merged file instead:

  1. Both bodies call NotImplemented_nid_no_patch(__func__): both new tests fail ("not implemented").
  2. The comparisons are made as signed bytes (std::int8_t): both tests fail the unsigned-ordering assertion.

After each mutation I restored the merged file, rebuilt, and both tests passed again. The author's description reports the same two controls, and the earlier review by MarcZX10 marked them as not reproduced. They are now reproduced.

Findings

Blocking

None.

Non-blocking

  • Invalid ranges are handled differently from the sibling exports in libc. At core/libs/prx/libSceLibcInternal/RecoveredInventory.cpp:7, null, empty or reversed ranges throw std::invalid_argument through APS5_INVALID_ARG_EX. The existing __std_min_8u and __std_max_8i in core/libs/prx/libc/src/VectorAlgorithms.cpp:142 and :161 treat the same inputs as unimplemented and call NotImplemented_nid_no_patch(__func__). Both follow the rule that every function either works or throws, and the PR records this behaviour in the debt entry. However:

    • __func__ here expands to ByteExtremum, so the error does not name the guest export.
    • The same STL family now reports invalid ranges in two different ways.

    Suggestion: either pass the export name into the helper, or follow the VectorAlgorithms.cpp pattern. Optionally, put the byte variants next to the other __std_min_*/__std_max_* helpers later.

  • A tiny point: the header uses std::uint8_t through SceTypes.hpp without including <cstdint> itself. public_headers compiles fine, so this works today.

Not verified

  • PS5 ABI and results compared with the console module (the PR records this as debt).
  • Windows and macOS builds. I ran no title (none is claimed).
  • Behaviour when a title passes an unaligned or very large range: the implementation is a plain scalar loop, so this only affects speed, and no speed claim is made.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5752685242 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15460#pullrequestreview-5752685242). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T13:06:59Z. **Review:** APPROVED --- # Reviewed — approved `__std_min_1u` and `__std_max_1u` work correctly on valid ranges, the focused tests pass on the merged tree, and the new tests fail under both negative controls I ran myself. ## What I ran Head `446b5d63fd6f1927018055b4af55a3ca58ebfb40` merged with `--no-ff` into `main` `4f41f4c375f5abb487dbd184fbc150f31994d762` (merged tree `5594b63da4e643d1c308860bc1eb829f4d73acf7`). Machine: Debian 13 VM, 2× Xeon Gold 6136 (32 vCPU), GCC 14.2.0, Release, Ninja, `BUILD_TESTING=ON`. ```sh git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...446b5d63fd6f1927018055b4af55a3ca58ebfb40 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "^(guest_libc_internal_(min|max)_byte|guest_vector_algorithms|public_headers)$" # negative control 1: both bodies -> NotImplemented_nid_no_patch(__func__) ninja -C build -j32 -l32 guest_libc_internal_byte_extrema_tests ctest --test-dir build --output-on-failure -R "^guest_libc_internal_(min|max)_byte$" # negative control 2: comparisons through std::int8_t ninja -C build -j32 -l32 guest_libc_internal_byte_extrema_tests ctest --test-dir build --output-on-failure -R "^guest_libc_internal_(min|max)_byte$" # restore the merged file, rebuild, re-run, then: git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Build of the merged tree (script) | OK | | `guest_libc_internal_min_byte`, `guest_libc_internal_max_byte` | passed, 0.01 s each | | `guest_vector_algorithms` | passed | | `public_headers` | passed (50 s; this test already exists and the PR does not affect its runtime) | | Script test run (3725 tests) | no new failures or timeouts; the 9 known failures also fail on `main` | | Vulkan validation comparison | skipped by the script; the PR changes no AGC, shader or VideoOut files | | Worktree after the controls | clean (`git status --porcelain` empty) | <details><summary>Negative control output</summary> ``` terminate called after throwing an instance of 'std::runtime_error' what(): __std_max_1u_nid_postfix not implemented 0% tests passed, 2 tests failed out of 2 --- libc internal byte extrema: unsigned byte ordering must hold for every pair libc internal byte extrema: unsigned byte ordering must hold for every pair 0% tests passed, 2 tests failed out of 2 ``` </details> ## Negative control The PR has no new production file, and restoring `RecoveredInventory.cpp` from `main` while keeping the new header would not compile. So I applied two mutations to the merged file instead: 1. Both bodies call `NotImplemented_nid_no_patch(__func__)`: both new tests fail ("not implemented"). 2. The comparisons are made as signed bytes (`std::int8_t`): both tests fail the unsigned-ordering assertion. After each mutation I restored the merged file, rebuilt, and both tests passed again. The author's description reports the same two controls, and the earlier review by MarcZX10 marked them as not reproduced. They are now reproduced. ## Findings ### Blocking None. ### Non-blocking - **Invalid ranges are handled differently from the sibling exports in libc.** At `core/libs/prx/libSceLibcInternal/RecoveredInventory.cpp:7`, null, empty or reversed ranges throw `std::invalid_argument` through `APS5_INVALID_ARG_EX`. The existing `__std_min_8u` and `__std_max_8i` in `core/libs/prx/libc/src/VectorAlgorithms.cpp:142` and `:161` treat the same inputs as unimplemented and call `NotImplemented_nid_no_patch(__func__)`. Both follow the rule that every function either works or throws, and the PR records this behaviour in the debt entry. However: - `__func__` here expands to `ByteExtremum`, so the error does not name the guest export. - The same STL family now reports invalid ranges in two different ways. Suggestion: either pass the export name into the helper, or follow the `VectorAlgorithms.cpp` pattern. Optionally, put the byte variants next to the other `__std_min_*`/`__std_max_*` helpers later. - A tiny point: the header uses `std::uint8_t` through `SceTypes.hpp` without including `<cstdint>` itself. `public_headers` compiles fine, so this works today. ## Not verified - PS5 ABI and results compared with the console module (the PR records this as debt). - Windows and macOS builds. I ran no title (none is claimed). - Behaviour when a title passes an unaligned or very large range: the implementation is a plain scalar loop, so this only affects speed, and no speed claim is made. <!-- anyps5-bots job=3333 head=446b5d63fd6f1927018055b4af55a3ca58ebfb40 -->
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!15460
No description provided.