fix(libc): preserve atanh pole and domain exception flags #10565
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10565"
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-24T10:15:31Z.
What
Follow-up stacked on #10315 (whose log1p dependency is #10314). The port computes matching
atanhresult bits and errno, but its arithmetic error returns only raise SSE flags. Both supplied bundled copies raise the matching exception in both SSE and x87; quiet NaN arguments also take the invalid-domain path even though NaN arithmetic alone need not raise invalid.Call the existing
_Feraise_nid_postfixwith invalid for the domain path and divide-by-zero for the ±1 poles. Keep the parent’s arithmetic return expressions, payload handling and explicit errno assignments. This adds two helper calls, plus a 576-call regression (12 inputs × four rounding modes × four DAZ/FTZ combinations × three sticky seeds). There is no input-specific production branch and no new export.Only these changes are new relative to refreshed exact parent
cb1a8b2c3060a53745d7657f6104f63755a3aa2e; the included log1p/atanh ports belong to their existing PRs. #10512 and #10546 independently fix log1p behavior and are not included or required for this atanh error-path change. The overlap scan identifies inherited log1p and additive GuestMath/debt insertions; preserve those topics when integrating, without treating unrelated math changes as dependencies.Tested
Latest integration (2026-11-05): head
d953e1baed78bff455936e618bd9ff783b0f322d, tested on main1859e6af1cad6e19e0c79530bca8f4d6c1d43a82. This supersedes the integration pins in earlier reports below. Main now includes the atanh port #10315; its new regressions and the hypot regressions are retained alongside this PR's cases.Fresh Linux Release qualification: the actual libc CMake owner plus
guest_math,guest_math_exactandguest_dinkumware_internals, each repeated three times on main and this head, all pass with zero skips. The frozen branch math fixture fails with the baseline library and passes again with its own restored library. Conventions and whitespace pass; final merge preview against main6a337633c649805fb469960e53d43ec612e6e6d3is clean. Fresh validation is CPU-only; earlier Windows/module reports remain at their recorded pins.Source diffs, exact pins, actual-owner recipe, build/test/JUnit/control logs and binary/provider hashes, SHA-256
ad099369f7cae288f5353e8aeb196df80367b61ddc8454cf939a5dc522dbba1b(download verified). No new SDK-module sampling, whole-project, Windows or title-performance result is claimed.Current integration — 2026-11-05. Head
a6730016ab7f0267e166609c1fc74bcb2d4bf4afincludes pinned main6d173c1a19788ff69d43b3d0ca62833e312ef939and retains the previous public history, notices, main math implementations and actual prerequisites. Open prerequisite #10315 at9811e07c2f421d3ea034cb7f3388a006dc354c11is an ancestor.Linux x86-64 Release, GCC 16.2.1: rebuilt libc and the three math executables;
guest_math,guest_math_exactandguest_dinkumware_internalseach pass 3/3 (9 passes, zero skips). The same groups pass 3/3 on pinned main. Source/parent/macro/notice checks and conventions pass. All 34 recursive provider trees / 31,551 tracked blobs verify before and after the gate; QuickJS test262 is excluded as declared update=none test data.Shared main blocker:
public_headersfails on this head and pinned main for the same five missingWKSecurityOrigindeclarations. PR #16010 restores them separately; a maintainer needs to merge that fix and rerun required checks. This math branch does not contain the unrelated WebKit patch. Header audits and all required CI are not claimed green.The older Windows compile failure in
DepthSurface.cppwas a shared main API mismatch, fixed upstream by merged PR #15855, already included in this head. Its own hosted Windows compile job passed; this is not a fresh Windows qualification of this math head.Immutable source/audit/log/JUnit/hash and exact-lease push evidence, SHA-256
ef9e085442553c0fce1a4a6ce15781e4e890dc001a3424e1ef972f9b769f3065(download and member hashes verified). Earlier dated platform/negative/reference reports retain their original source pins. No new Windows, console/SDK-module, GPU/title, exhaustive or performance result. AI-assisted: yes, Codex Sol6.1 medium.All earlier qualification text below is historical and retains its recorded source/platform pins, including earlier linear/no-merge descriptions.
Current-main refresh — 2026-11-04. Head
292116ce1315b45cd944262c96c30b9428601623merges main9ab6a281ea61c9e62a7eb07eb4cef8f19ede1c5cwhile retaining the prior public head as an ancestor. Main’s newer code, regression fixtures and debt entries are preserved alongside this topic.Linux x86-64, GCC16.2.1, Ninja Release: actual libc, libkernel and libSceAmpr CMake owners rebuilt coherently.
guest_math,guest_math_exact,guest_dinkumware_internalseach pass three consecutive runs (9 passes, zero skips). The same groups pass three times on pinned main. Public-header audit and conventions pass. Original licence-notice trailing whitespace is retained where present. The scoped recipe reuses frozen ZArchive/zstd providers; this is not a whole-project build. No new Windows, bundled-SDK, physical-console, title/GPU or FPS measurement is claimed; earlier reports retain their original pins.Exact source/parent proofs, per-branch patches/input manifests, build and CTest logs/JUnit, library/executable hashes and scoped CMake recipe, SHA-256
97a2377bc996be1690e8853e1ea090a98b5ed808bcc37a15a5cdada5c2e00845(download verified). AI-assisted: yes (Codex).Current-main integration — 2026-11-03. Head
ffe19d7c2a18e85f35263e66aed36a9a46dc2836includes main4f41f4c375f5abb487dbd184fbc150f31994d762and retains the prior public history and attribution/licence notices. Main’s newer math implementations and fixtures remain alongside this topic. Actual open prerequisite #10315 head7c767c439fb25a28415020465d9f727ecf964fe5is an ancestor.Linux x86-64 Release, GCC 16.2.1, Ninja, BUILD_TESTING=ON: rebuilt actual libc and math executables.
guest_math,guest_math_exact, andguest_dinkumware_internalseach pass 3/3 (9 passes, zero skips);public_headersand conventions pass. The same three groups pass 3/3 plus headers on pinned main. All 34 recursive dependency trees and 31,551 tracked blobs verify with zero errors; the update=none QuickJS test262 corpus is excluded from these library inputs.git diff --checkreports the preserved verbatim licence trailing-space line; no other whitespace warnings occur.Source/parent/gitlink proofs, exact library/test hashes, raw logs/JUnit, and head-leased push receipts: qualification archive, SHA-256
e6a50522bc28e30871fdc2c12a88d2537515914239e8166f6237f48895126a06(download verified). Older platform/reference reports retain their original pins; no new Windows/macOS, SDK-module, console, title/GPU or performance claim. AI-assisted: yes (Codex).Earlier dated qualifications below retain their recorded source/platform pins.
Current-main integration (2026-11-02):
21eaa25d8a25b58cbcda0e8be043be4cdd3e078dincludes maina4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8and retains the existing public commits. Conflicts preserve main’s math implementations, regression checks and debt entries alongside this topic. Linux x86-64 Release, GCC 16.2.1: rebuilt libc and the three math executables;guest_math,guest_math_exactandguest_dinkumware_internalseach pass three times (9 passes, zero skips), andpublic_headerspasses. The same baseline groups pass on main; conventions and whitespace pass. Source and dependency blobs, executable/library hashes, raw logs and JUnit are retained. This refresh adds no new console, Windows, title, GPU or numerical-reference measurement. Qualification evidence, SHA-25622866bd2a060ba69cd4387d471605afe20ed644e3257174b2d1488635f8c9b52(download verified).The current prerequisite #10315 head
7c767c439fb25a28415020465d9f727ecf964fe5is an ancestor of refreshed headffe19d7c2a18e85f35263e66aed36a9a46dc2836.Current-main conflict refresh, 2026-10-27 UTC: exact head
2be8ac25abebb7e2332f83554e74103290b300cdon tested main74acfad65b3f0fd4eab653f3a3989d298fba1157. Resolved overlapping test/debt context while preserving this branch's authored production/test edits and main's nextafter environment implementation and coverage. Existing prerequisite commits remain in their original series order.Linux focused rebuild of
libcand selected test executables passesguest_mathandguest_math_exact, each three times: 6 passes, zero skips. Conventions and whitespace checks pass. Final fetched maincb45ae2ddf6e113a4619e8fed91fe7b9333c5c0fmerges cleanly; its later change is an unrelated Windows crash-test pattern, and the executed qualification remains pinned to the stated base. No new Windows, console, GPU, title, full-suite or negative-control run is claimed. Earlier reference/Windows evidence keeps its original pins.Exact pins, branch patches, preservation proofs, build/test logs, JUnit and lease-push receipts for this refresh batch. SHA-256:
e33f98cc467f038af662cc5fa491c3acc1806bb47171cf77b748f0d4d052c1f2; downloaded copy verified.Fresh current-main qualification: head
7ea2737c685391aef19e354bf2fe3ea7cd6e415f, base main6c7a3256f25d2ea56702d06a2283ecc27ff133b3, exact immediate parentcb1a8b2c3060a53745d7657f6104f63755a3aa2e. Two exception-regression/topic commits directly on refreshed #10315; no merge commits.Linux x86-64 Release: rebuilt libc and the three math test targets;
guest_math,guest_math_exact,guest_dinkumware_internalsandpublic_headerseach pass three repeats. Retaining the final tests and substituting only the immediate parent’s productionMath.cppmakesguest_mathabort; exact-math and Dinkumware controls pass. Restoring the candidate passes all four groups three times and produces a byte-identical libc. Source checks confirm the entire Math.cpp equals current main plus the original topic functions, and the relevant regression functions are unchanged. Conventions and whitespace checks pass. No reference-copy matrix, whole application, Windows or performance run was repeated for this refresh.All three exact-head builds, regression/negative/restoration logs, source preservation, pins and topic patches, SHA-256
744790aa28706c7df7d8a54906ccc1d2b1a5d33ae7fcc85288d3778a0cf7d3c0.Historical independent Windows evidence: ycbuzi’s report tests prior public head
75dd11da82merged onto maindab0113e06as cleanb40ef9fd3e, Windows11 Home26200, MinGW GCC15.2.0 Release. Math and Dinkumware pass twice; a main-Math negative aborts math while Dinkumware passes. No title was run. This is attributed integration evidence, not a current-head author-run Windows result.Earlier qualification (historical source pins)
Current Linux parent-alignment refresh:
75dd11da82e9d364fa2a26368582d4244526a8f9, incorporating #10315 atc974e4e602c8082286317c029ba58c52ad9c3fc7. Preserves this PR's original 576-call regression exactly and keeps runtimeMath.cppbyte-identical to previous public head45628b4d. There is one inherited log1p definition/call and one atanh-domain definition/call, including the merge with #10314. Fresh Release build and all three focused math groups pass. The newly built candidate was run through 53,376 calls and compared with each saved FAR/Tetris original-module matrix: zero differing rows in all recorded fields. The original modules were not freshly executed for this refresh. Conventions/whitespace pass. Refresh logs, matrix, composition receipt and patch (SHA-2561fa7a1046ef2419dcc58fbc02e9e41499c15a6936679664f412f44295180b9bb). No fresh Windows, physical-console, full-app or performance claim.Arch Linux 7.2.9, GCC 16.2.1, Ryzen 9 7950X, x86-64 masked exceptions.
7cfe2147bc: actual libc andguest_math,guest_math_exact,guest_dinkumware_internalsbuild and pass (3/3).a845dac00d, production unchanged from #10315:guest_mathfails specifically atatanh domain:on +1 (missing x87 divide-by-zero). MathExact and Dinkumware pass. An initial candidate build missed the existing helper declaration; the complete build log is retained, then the declaration was added and the final candidate rebuilt and tested.60465afd3a; that is a mergeability check, not a separate build of a new main integration. PR overlap checked.Exact pins, source patch, regression/probe, numerical logs, reference identities and build/test history, SHA-256
05ab054930c7b3e4b250f901b4ccf06782dbf8724fa957bccd11935fd1b6462f.Not tested: Windows, unmasked traps, physical consoles, other SDK builds, title bring-up or FPS. No performance improvement is claimed.
Current Linux qualification (2026-10-28)
Rebased onto
main2227f1366188cda5699dd20e2e756a18006a5d4b. Linux CPU validation on 2026-10-28 at26c43ad44c145126c7ab24707957d520a5bdf9fc(Arch Linux 7.2.9, AMD Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON).libc,guest_math_testsandguest_math_exact_testsrebuilt from this exact source.guest_mathandguest_math_exacteach passed three consecutive runs (6/6, no skips); the same two suites each passed three runs on the pinned main (6/6). Conventions and whitespace checks pass.Exact source pins, preservation proofs, dependency checks, build logs and JUnit, SHA-256
1176269c9e6948b5252a5db9e660978d7f978fb2d9f4ed6c68bc050b10b5ae68. This is focused Linux CPU qualification; earlier Windows/title/reference measurements retain their original pins. No new title or performance result is claimed.Independent reports on this head:
21eaa25d8amerged ontomaina4eca2a: 3,468 passed · 14 failed (0 new, 13 also fail on main, 1 unstable on main) · 59 skipped (ANYPS5_REQUIRE_VULKAN=1); validation: ✅ no new validation IDs vs main (1306 tests run on the GPU).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)aa5df70114688ad4d5a2479ee88ec74fef6f43c9, included in tested main1859e6af1cad)Current-main refresh (2026-10-24)
Head
45628b4d3d56bc92e409cb8d4a213a723fc3a238merges main00198bfcdfc4ca42f5d7519281786758dfdc688a. The only content conflict was adjacentacoshf/atanhimplementations; both are preserved. Freshguest_math,guest_math_exact, andguest_dinkumware_internalstests pass (3/3), with conventions and whitespace checks passing. The rebuilt library produces zero differences for all 53,376 sampled atanh calls against each previously captured reference matrix; original-module captures and the negative control remain evidence from the earlier pinned head. No fresh Windows/title/performance claim. Refresh logs and matrix, SHA25671d170cd663576a8a82810428487d227067234c18d951386a0058ebd9f0fb198.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T10:27:26Z.
Review: APPROVED
Reviewed the change relative to its stated parent. The two additions invoke the existing
_Feraise_nid_postfixonly on theatanhpole and invalid-domain paths; that helper sets the requested exception in both x87 and SSE status. The new guest regression checks result bits, errno, preserved sticky flags, and both status banks across rounding and DAZ/FTZ combinations, including quiet/signaling NaNs and ±1. The implementation follows the pinned FreeBSD msun source and keeps the established errno behavior. I found no correctness issue in this delta. Hosted eligibility, conventions, intake, labels, report, relinker matrix, ASAN, and register-context checks pass; Linux/Windows full builds were skipped by the repository’s eligibility gate. macOS Intel write-watch was still running at the time of review.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T12:23:10Z.
Review: APPROVED
The refreshed head adds only the documented merge of current main, resolving the adjacent acoshf/atanh conflict while retaining both implementations. The atanh exception-raising code and regression remain the reviewed delta; the author reports rebuilding the math, exact-math, and Dinkumware targets and rerunning all 53,376 sampled comparisons on this head. Hosted relinker, ASAN, register-context, and write-watch checks now pass, along with structural checks. Full Linux/Windows product builds and Windows/console behavior remain untested.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T16:34:28Z.
Review: APPROVED
Re-reviewed exact head 75dd11da82e9d364fa2a26368582d4244526a8f9. The commits since my prior approval only realign the inherited log1p test block and debt entry after the #10315/#10314 stack update; the atanh implementation and its domain/exception regression are unchanged. I checked the current diff,
git diff --check upstream/main...HEAD, andtools/check_conventions.py --base upstream/main --head HEAD; all pass, and the current-main merge-tree is clean. The author reports all three focused math test groups passing and 53,376 candidate calls matching the saved reference matrices at this head. I did not independently rebuild/run those math tests in this session. Hosted structural and cross-platform relinker/register-context/write-watch checks pass; full product builds are skipped. The checklist declares the open #10315 and #10314 prerequisites. No blocker remains on the reviewed head.