Skip to content

fix(libc): compute atanh with FreeBSD msun's algorithm, as titles' libc.prx does - #10315

Merged
oneandonlydean merged 7 commits into
boykopovar:mainfrom
JJenkx:windows/libc-atanh-msun
Nov 5, 2026
Merged

oneandonlydean merged 7 commits into
boykopovar:mainfrom
JJenkx:windows/libc-atanh-msun

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What

atanh returned the host's atanh, so its last bit and its errno depended on the host. For example, atanh(0x3f03a67d5567227b) is 0x3f03a67d558ea76e in the bundled libc.prx and 0x3f03a67d558ea76f on Windows (UCRT). On 20 million random arguments, UCRT's atanh differs from the titles' copy on 1,841,966.

The titles' copy (NID YjbpxXpi6Zk) is FreeBSD msun's e_atanh.c, computed through msun's log1p. atanh now computes it over log1p_nid_postfix, the msun port supplied by the already merged #10314:

  • the domain checks;
  • the 2^-28 shortcut;
  • the |x| < 0.5 form 0.5 * log1p(2x + 2x^2 / (1 - x));
  • the 0.5 * log1p(2x / (1 - x)) form above it.

errno: msun sets none. The titles' copy sets it at msun's two error returns:

  • EDOM at (x - x) / (x - x), for |x| > 1, the infinities and every NaN, keeping NaN payloads;
  • ERANGE at x / 0, for ±1.

This is the same rule as the bundled library's atanhf already in the debt file. The internal log1p calls always get arguments ≥ 0, so log1p's own EDOM never fires from here.

Tested

Current-main refresh — 2026-11-04. Head 9811e07c2f421d3ea034cb7f3388a006dc354c11 merges main 9ab6a281ea61c9e62a7eb07eb4cef8f19ede1c5c while 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_internals each 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 7c767c439fb25a28415020465d9f727ecf964fe5 includes main 4f41f4c375f5abb487dbd184fbc150f31994d762 and retains the prior public history and attribution/licence notices. Main’s newer math implementations and fixtures remain alongside this topic.

Linux x86-64 Release, GCC 16.2.1, Ninja, BUILD_TESTING=ON: rebuilt actual libc and math executables. guest_math, guest_math_exact, and guest_dinkumware_internals each pass 3/3 (9 passes, zero skips); public_headers and 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 --check reports 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). That Linux archive makes no Windows/macOS, SDK-module, console, title/GPU or performance claim; older platform/reference reports retain their original pins. AI-assisted: yes (Codex). The prior Windows/negative-control head remains 0a95fd8f78c6b9c57c5a16212b48b3b01cbe0b0b; relevant atanh/log1p routines, edge fixtures, Dinkumware source/test and VABI header are byte-identical, that continuity proof remains separately scoped. Fresh final-head Linux and Windows controls are recorded below.

Fresh current-head Windows qualification — 2026-11-03: exact 7c767 Windows receipt records 12/12 initial math/exact/Dinkumware/header passes, a frozen-test body-only std::atanh negative at CheckAtanhConsoleBits, then 12/12 restored passes, zero skips. Actual module binding, 37,044 source/provider blobs and raw hashes are verified. Raw PE hashes differ; only timestamp/checksum fields are zeroed in a separate in-memory comparison, with all other bytes identical. This is not a fresh Linux negative or a new SDK-module/console/title/performance/full-suite result. AI-assisted: yes (Sol6.1medium).

Fresh current-head Linux negative/restoration — 2026-11-03: On the same exact 7c767c439fb25a28415020465d9f727ecf964fe5 head, the three math/exact/Dinkumware groups pass three times each (9). Replacing only the double atanh_nid_postfix body with return std::atanh(x); fails the unchanged CheckAtanhConsoleBits bit assertion at GuestMath.cpp:1417. Restoring the exact source returns all three groups to three passes each (9), plus public_headers, zero skips. The library and all three test executables have identical raw SHA-256s before and after restoration. Both 31,551-provider-blob audits match; source is clean and the actual private libc.prx loader path is recorded. Verified Linux control/restoration logs, JUnit and fingerprints, SHA-256 4cf51299cc068b43477322860d635451ba2450a478ea6b865af3e85b18c0ca5c. This supplies a fresh Linux final-tree negative separately from the historical controls; no new SDK-module, console, title or performance comparison. AI-assisted: yes (Codex).

Earlier dated qualifications below retain their recorded source/platform pins.

Historical head 0a95fd8f78c6b9c57c5a16212b48b3b01cbe0b0b merged main 92d2fdc3438f83e39d624eb65f3195bf2701568c into the existing branch, without rebasing or force-pushing. The conflict resolution retains both this PR's atanh test calls/debt entry and main's log10/log2 calls/debt entries. The atanh implementation is byte-identical to prior public head 72a6683e64531e4fc948e6115af96037b367ab5e.

Linux x86-64, Arch 7.2.11-arch1-1, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON, pinned dependency worktrees. Rebuilt actual libc and the math/exact-math/Dinkumware targets. guest_math, guest_math_exact, guest_dinkumware_internals, public_headers: 4/4 pass, zero skips.

Final-tree negative control: the same frozen math executable aborts under GDB at CheckAtanhConsoleBits when only atanh_nid_postfix is replaced with the pre-topic return std::atanh(x) wrapper. All other production functions and every test are retained. Exact source restoration rebuilds libc byte-for-byte identically; all four checks pass again. Conventions and whitespace checks pass; worktree clean.

Fresh build/control logs, JUnit, hashes and exact diff, SHA-256 abd0345d33231e5b624db479c7e01b85cca84b5329598e643a61595b4f78f85f.

Earlier reference measurements retain their original source pins and scope; see prior exact-head qualification. At historical head 0a95fd8, Windows qualification and the supported-behavior host-wrapper negative control were complete; see that Windows follow-up for the exact pins, 12/12 initial and 12/12 restored passes, loaded-module path and verified artifact. No new bundled-library reference, console, title/GPU or performance execution is claimed. The separate #10565 follow-up addresses matching x87 exception flags; that behavior is not added here.

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 (fix(libc): compute log1p with FreeBSD msun's algorithm, as titles' libc.prx does #10314 is merged)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (CPU-only libc change)
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/dev/debt/libc.md
PR 5303 docs/dev/debt/libc.md
PR 6295 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp
PR 6819 docs/dev/debt/libc.md
PR 7081 docs/dev/debt/libc.md
PR 7386 docs/dev/debt/libc.md
PR 7447 docs/dev/debt/libc.md
PR 7715 docs/dev/debt/libc.md
PR 7851 docs/dev/debt/libc.md
PR 8150 docs/dev/debt/libc.md
PR 8965 docs/dev/debt/libc.md
PR 9340 docs/dev/debt/libc.md
PR 9371 docs/dev/debt/libc.md
PR 9447 docs/dev/debt/libc.md
PR 9526 docs/dev/debt/libc.md
PR 10397 docs/dev/debt/libc.md
PR 10405 docs/dev/debt/libc.md
PR 10780 docs/dev/debt/libc.md
PR 11172 docs/dev/debt/libc.md
PR 11260 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp
docs/dev/debt/libc.md
PR 11262 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp
docs/dev/debt/libc.md
PR 11266 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp
docs/dev/debt/libc.md
PR 11332 docs/dev/debt/libc.md
PR 11724 docs/dev/debt/libc.md
PR 11726 docs/dev/debt/libc.md
PR 11831 docs/dev/debt/libc.md
PR 12849 docs/dev/debt/libc.md
PR 13449 docs/dev/debt/libc.md
PR 13486 core/libs/prx/libc/src/Math.cpp
docs/dev/debt/libc.md
PR 13794 docs/dev/debt/libc.md
PR 13804 docs/dev/debt/libc.md
PR 13809 docs/dev/debt/libc.md
PR 14085 docs/dev/debt/libc.md
PR 14212 docs/dev/debt/libc.md

@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026
@JJenkx

JJenkx commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Linux run at this PR's exact head b347b503cd (b347b503cde3db1143acbb4fe670055c791fa6b5), not merged onto anything else; its base on main is 990f45e17d.

Arch Linux, kernel 7.2.9, Ryzen 9 7950X, g++ (GCC) 16.2.1 20260810, glibc 2.44, x86-64. Release, BUILD_TESTING=ON.

  • guest_math: passed in each of 3 runs, exit code 0 each time, with no failed, skipped or not-run tests.

This is the focused test only; no title, console or floating-point exception flags were checked.

AI-assisted: yes (Claude Code).

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@JJenkx
JJenkx force-pushed the windows/libc-atanh-msun branch from b347b50 to 7b11c44 Compare October 24, 2026 04:53
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 24, 2026
@JJenkx JJenkx mentioned this pull request Oct 24, 2026
12 tasks done
JJenkx pushed a commit to JJenkx/AnyPS5 that referenced this pull request Oct 24, 2026
Additive conflicts with main's newer libc changes: the debt list keeps both
sides' entries (per entry) and GuestMath.cpp keeps both sides' test
functions and calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JJenkx

JJenkx commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Merged current main fe204e1a8d into this branch as e46b225b8a (was 7b11c4440e), a merge commit rather than a rebase. Done on Linux while the Windows session is paused.

  • The conflicts were additive: the docs/dev/debt/libc.md list keeps both sides' entries (checked per entry), and GuestMath.cpp keeps both sides' test functions and calls.
  • New head, Linux only: guest_math and guest_math_exact pass (Arch Linux, kernel 7.2.9, GCC 16.2.1, glibc 2.44, Release, BUILD_TESTING=ON). tools/check_conventions.py --base origin/main reports no errors.
  • Earlier Windows and comparison evidence in this thread stays pinned to the heads it was measured on.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@JJenkx

JJenkx commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Opened #10565 as a separate atanh pole/domain exception-state follow-up on exact parent e46b225. The parent matches result bits and errno, but the two bundled copies also raise the matching x87 exception; quiet NaNs take invalid in both banks. Two existing _Feraise calls preserve the parent’s returns and errno while matching those effects.

Same-test control fails by name; candidate math/exact/Dinkumware pass 3/3. Fresh actual control/change and FAR/Tetris bundled copies: 1,112 inputs × 48 environments = 53,376 calls per arm. Control has 12,608 exception-state mismatches; candidate has zero differences in every checked field, with no result-bit or errno changes. Full evidence/limits are in #10565. No change to this parent’s head or evidence, no Windows/physical-console/FPS claim. #10314 remains the transitive log1p dependency; the other log1p follow-ups are separate.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@JJenkx

JJenkx commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Merged current main 00198bfcdf into this branch as 1cc9d1a81d (was e46b225b8a), a merge commit rather than a rebase.

  • Math.cpp: this branch's msun atanh and main's new msun acoshf (fix(libc): follow msun for acoshf #10003) are both kept, each defined once. The merged file differs from main by exactly this branch's own Math.cpp changes.
  • New head, Linux only: guest_math and guest_math_exact pass (Arch Linux, GCC 16.2.1, Release, BUILD_TESTING=ON), and tools/check_conventions.py --base origin/main passes. Earlier Windows evidence stays pinned to the heads it was measured on.

AI-assisted: yes (Claude Code)

JJenkx pushed a commit to JJenkx/AnyPS5 that referenced this pull request Oct 24, 2026
Math.cpp: keep this branch's msun atanh and main's msun acoshf, each
defined once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 24, 2026

@harisibrar1 harisibrar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked against main 39a36bb and FreeBSD release/11.4.0 lib/msun/src/e_atanh.c (over s_log1p.c):

  • The port matches e_atanh.c: the (ix|((lx|-lx)>>31)) domain test, the x/zero pole, the 2^-28 shortcut and both log1p forms. EDOM and ERANGE are added only at msun's two error returns.
  • I wrote my own Python port of e_atanh.c over s_log1p.c (plain doubles), and it reproduces all 24 CheckAtanhConsoleBits expectations, including NaN payloads and errno.
  • Merge order with #10314: this branch carries the pre-rebase log1p commit 0c8ca62, not #10314's current head f4cb186, so git does not recognise it as the same change. I simulated main, then #10314, then this PR with git merge-file; the reverse order gives the same result.
    • All three files merge without conflict markers. Math.cpp ends up with a single log1p.
    • GuestMath.cpp gets two static void CheckLog1pConsoleBits() definitions, because this PR inserts it after MakeExtended and #10314 after CheckExpm1ConsoleBits. main() also gets two calls to it. That would fail to compile as a redefinition. I didn't build it.
    • docs/dev/debt/libc.md gets two identical log1p bullets, one before expm1 and one after.
    • Could you rebase onto #10314 once it lands, dropping 0c8ca62? Until then, could you put the log1p test and debt entry exactly where #10314 has them?
  • Otherwise this still merges cleanly onto current main, and main's atanh is still the host forwarder.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@JJenkx I checked 1cc9d1a and the intervening merge. Both atanh and main’s acoshf are preserved, with the Atanh, Expm1 and Acoshf checks intact and called once. My source verdict carries. Thanks for keeping the new Linux results separate from the older Windows evidence and for separating #10565. This still follows #10314 and needs final-head/full-composition CI, including Windows and Dinkumware coverage.

@JJenkx

JJenkx commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Aligned the inherited log1p definition, call and debt entry exactly with #10314 in c974e4e602c8082286317c029ba58c52ad9c3fc7. Reproduced the old clean-textual-merge/duplicate-definition issue, then verified both merge orders produce the same tree with exactly one copy. The standalone head, combined tree and restored head each freshly build and pass all three focused math groups. Production code and test bodies are unchanged. Evidence: pr10315-headc974e4e6-stack-alignment-linux.tar.gz. #10314 remains the dependency; the inherited commit can be dropped when it merges.

@ycbuzi

ycbuzi commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Windows run of c974e4e merged onto main dab0113 (dde318cfbf, clean), since Windows was not run on this head. Windows 11 Home 10.0.26200, MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release, BUILD_TESTING=ON.

Built libc, guest_math_tests and guest_dinkumware_internals_tests with no errors or warnings. ctest --repeat until-fail:2 on guest_math and guest_dinkumware_internals: both pass on both repeats. Negative control: with src/Math.cpp taken from main and the rest of this head, guest_math aborts (exit code 0xc0000409) and guest_dinkumware_internals still passes. Not run: a title.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The earlier review identified a real stacked-test collision with #10314; the updated description says the inherited log1p test and debt entry now align with that branch, which addresses that concern. The integration evidence is still based on 6c52b64, 6,822 commits behind current main, and the hosted Linux/Windows product jobs are skipped. Please refresh #10314 and this dependent branch onto current main, then rerun guest_math and guest_dinkumware_internals on the final head on Linux and Windows. Keep the negative control tied to that final tree.

@JJenkx
JJenkx force-pushed the windows/libc-atanh-msun branch from c974e4e to 916ef2d Compare October 24, 2026 23:50
@JJenkx

JJenkx commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Refreshed to current main 38d463a6cfd2bbddc147a34e8b14f5b6f661607a, exact head 916ef2d7fb63ba22dde66cf1202a18561f1913d5. #10315 now has refreshed #10314 as its actual direct parent: two linear commits across the stack, no merges or copied log1p placement fixes. Both integration orders give the identical child tree with one inherited log1p definition/call.

Fresh Linux libc/math builds pass. guest_math, guest_math_exact, guest_dinkumware_internals, public_headers and nid_database_cache each pass three times. The final fixture catches a production-only host-forwarder reversion of atanh; Dinkumware still passes. Restored source rebuilds to the same positive libc hash and all three math groups pass another three invocations.

Exact pins, patches, stack proof, logs/JUnit and negative/restoration; SHA-256 67d69a6f98f1ff9843b200c18bab0ac6271b5c35d54f81bc2e15a0017178fe33.

Fresh Windows coverage remains requested; our Windows machine is user-paused. Earlier independent Windows reports remain tied to their original integration pins. Original-module matrices were not rerun. Description updated with these limits.

Hosted update: both macOS relinker architectures passed in run40144377353. The remaining red job is write-watch macOS Intel, which failed while fetching refs (RPC failed; curl56, connection reset), before build/test. The focused rerun command returned job121022508046 cannot be rerun. Please retry that infrastructure failure; no source/test workaround was added. Windows math coverage remains outstanding.

@JJenkx

JJenkx commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Additional Linux integration check: refreshed #10314/#10315 with exact #10468 head 5cc53a56c94d2b874a33019adcc26e11bb5a9343. Production merges cleanly; GuestMath.cpp and docs/dev/debt/libc.md have additive insertion conflicts. The private combination preserves both sides unchanged; it is not an automatic clean merge of all three PRs.

Private combined head ec072ae9ba8e88e84753f0b8cd782f0b50c5370e: libc and focused builds pass; guest_math, guest_math_exact, guest_dinkumware_internals and public_headers each pass three times. One log1p, one atanh and one nextafter console fixture are retained. No combined production edits beyond the respective PR implementations.

Conflict-resolution receipts, combined patch, exact pins, build/test logs and JUnit, SHA-256 5569782380ed27cc179f32e44ff8a62bddc6697ca94be6e187a4463b858967e3. This does not add Windows or macOS coverage. It means a full CI run combining these PRs would first need the additive conflicts resolved; individual refreshed PRs remain mergeable against main.

@JJenkx
JJenkx force-pushed the windows/libc-atanh-msun branch from 916ef2d to cb1a8b2 Compare October 25, 2026 07:03
@JJenkx

JJenkx commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Windows exact-head qualification of 72a6683e64531e4fc948e6115af96037b367ab5e. This completes the Windows half of the requested math qualification; the Linux half is in the comment above.

Setup:

  • Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7 (g++ (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r7) 15.2.0), CMake 4.4.4, Ninja, Release, BUILD_TESTING=ON.
  • The source tree is a clean checkout of the exact head, with all submodules at their pinned commits. Its build directory is separate from every other.
  • Targets built: libc, guest_math_tests, guest_dinkumware_internals_tests and guest_math_exact_tests. Each test loads libc.prx from this build's core/libs/libs/unpatched.
  • Each run went through the Windows FIFO's title-free sentinel (PPSA00003) with ctest -V.
Step Source libc.prx Result
Positive exact head, clean built from it guest_math, guest_dinkumware_internals, guest_math_exact: each pass 3 of 3 (--repeat until-fail:3). guest_math prints Scaled hyperbolic checks: 1835 on every run.
Negative only atanh_nid_postfix changed, to double APS5_VABI atanh_nid_postfix(double x) { return std::atanh(x); } (Math.cpp: 1 insertion, 28 deletions; no other file) rebuilt; the three test executables keep their positive hashes guest_math fails, abort(), exit 0xc0000409
Restored Math.cpp checked out from the head; blob 1fb4fca6ee31 equals HEAD's; tree clean rebuilt guest_math, guest_dinkumware_internals, guest_math_exact: each pass 3 of 3 again (Scaled hyperbolic checks: 1835 on all three guest_math runs); no processes left

Negative attribution: the test's Require is a bare abort(), so I attributed the failure from the crash's return address in guest_math_tests.exe. That executable is the same file in all three steps, SHA-256 aebdfc62…8347.

  • The return address is guest_math_tests.exe+0x1167a, which is 0x14001167a.
  • It immediately follows call abort at CheckAtanhConsoleBits()+0xa6.
  • CheckAtanhConsoleBits() spans 0x1400115cf up to CheckAsinl() at 0x140011703, so the failure is the intended CheckAtanhConsoleBits assertion.

Binary identity of positive and restored:

  • The finding: on this toolchain, relinking libc.prx from the same objects changes only the PE TimeDateStamp (offset 0x88) and CheckSum (offsets 0xd8–0xd9) fields. I checked by deleting and relinking with nothing recompiled: two bytes differ, at 0x88 and 0xd8. So raw hashes differ between any two links.
  • The comparison: I kept every libc.prx across a positive → atanh-only negative → restored cycle and hashed each with those two fields zeroed:
Build Raw SHA-256 SHA-256 with TimeDateStamp and CheckSum zeroed
Positive (exact source) f2eb1b2ab4a16cc6… 94379a37fe310104…
Negative (atanh only) f8e51c48489d6d36… e453141522b4aa1f…
Restored (exact source) ba5dd2c3639ec87d… 94379a37fe310104…
  • The positive FIFO run used an earlier link of the same exact source, raw cac956247dc155b4…. That file wasn't kept, so the table's positive row is a fresh link of the same tree, made at the start of the cycle.
  • Result: positive and restored differ only at bytes 0x88, 0xd8 and 0xd9. The test executables are byte-identical in every step: guest_math_tests aebdfc62…, guest_dinkumware_internals_tests bb466bd0…, guest_math_exact_tests 02d61ca5….

Scope:

  • No source beyond the one-function negative was changed.
  • No SDK, game, GPU or performance runs were part of this.
  • The full pins (submodules, hashes, receipts) are kept with the run evidence.

@MarcZX10 with the Linux results above and these Windows results, both requested exact-head runs and the narrow negative control are in. Could you re-review?

AI-assisted: yes (Claude Code).

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 2, 2026
@JJenkx

JJenkx commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@MarcZX10 Refreshed against main 92d2fdc3438f83e39d624eb65f3195bf2701568c as merge 0a95fd8f78c6b9c57c5a16212b48b3b01cbe0b0b, preserving public history with a normal fast-forward push.

Only additive conflicts needed resolution: the atanh calls/debt entry and main's log10/log2 calls/debt entries are all retained. The atanh body is byte-identical to reviewed public head 72a6683e64531e4fc948e6115af96037b367ab5e; #10314 is already merged and is not an open prerequisite.

Fresh Linux x86-64 Release: guest_math, guest_math_exact, guest_dinkumware_internals, public_headers 4/4 pass, zero skips. The same frozen math executable aborts at CheckAtanhConsoleBits under GDB when only atanh is replaced with the pre-topic host wrapper. Exact restore rebuilds libc byte-for-byte identically, and all four checks pass again. Conventions and whitespace checks pass.

Current-merge logs, JUnit, control backtrace, hashes and exact diff, SHA-256 abd0345d33231e5b624db479c7e01b85cca84b5329598e643a61595b4f78f85f; uploaded digest verified. The description is refreshed and distinguishes this Linux evidence from historical reference measurements. Current-head Windows qualification and its negative control remain pending; this does not claim to close them. No new console/title/GPU or performance run.

AI-assisted: yes.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 2, 2026
@JJenkx

JJenkx commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Current-head Windows qualification is complete at 0a95fd8f78c6b9c57c5a16212b48b3b01cbe0b0b (Windows 11 22621, GCC 15.2 UCRT r7, Ninja Release, BUILD_TESTING=ON). Rebuilt actual libc and the three math test executables. guest_math, guest_math_exact, guest_dinkumware_internals and public_headers each pass three times: 12/12 passes, zero skips. GDB records this private build's exact libs/unpatched/libc.prx loaded path; executable and library hashes are attached.

Supported-behavior negative: replacing only atanh_nid_postfix with the prior return std::atanh(x) wrapper makes the frozen guest_math executable fail at CheckAtanhConsoleBits. Other production functions and every test remain unchanged. Exact source restoration rebuilds libc with identical bytes outside its PE timestamp/checksum fields, then all four groups pass three more times (12/12, zero skips). No unsupported-call assertion is used. Raw original/negative/restored hashes are recorded. A separate in-memory hash comparison zeroes only the COFF timestamp and PE checksum; the production binaries used by the tests remain unmodified. Earlier attempts are retained as excluded evidence (raw PE hash gate/provider-version drift).

Frozen source proofs, bounded harness, raw logs/JUnit, hashes and terminal FIFO receipts, SHA-256 c94f173e29d4a945243ad2f3f1d7e46cc9cd59ee8a3d6fb722f1a3fbabc3bdc2; downloaded bytes and all 105 manifest members verified.

This is focused Windows HLE CPU qualification. Earlier reference measurements retain their original pins; no new bundled-library reference, console, title/GPU, performance or full-suite result. AI-assisted: yes (Sol6.1medium).

@MarcZX10, please re-review this exact head and trigger upstream full CI with the requested current-head Windows and negative-control evidence now attached.

atanh carries over FreeBSD msun's lib/msun/src/e_atanh.c at release/11.4.0. Name
that source above atanh_nid_postfix, in the form the exp port uses, followed by
the file's Sun copyright and permission notice copied verbatim (its trailing space
included, as main keeps it for the other SunSoft notices). No code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JJenkx

JJenkx commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Added the source note and licence notice this port was missing (292a50a944, on top of 0a95fd8f78): above atanh_nid_postfix a line in the exp port's form naming lib/msun/src/e_atanh.c at release/11.4.0, followed by that file's Sun copyright and permission notice copied verbatim from that revision, the same correction oneandonlydean asked for on #10321. No code changes. check_conventions.py --base origin/main passes; git diff --check reports the notice's trailing space, which is in the original and which main keeps for the other SunSoft notices in this file.

AI-assisted: yes.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 3, 2026
@JJenkx

JJenkx commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Current-main integration — 2026-11-03. Head 7c767c439fb25a28415020465d9f727ecf964fe5 includes main 4f41f4c375f5abb487dbd184fbc150f31994d762 and retains the prior public history and attribution/licence notices. Main’s newer math implementations and fixtures remain alongside this topic.

Linux x86-64 Release, GCC 16.2.1, Ninja, BUILD_TESTING=ON: rebuilt actual libc and math executables. guest_math, guest_math_exact, and guest_dinkumware_internals each pass 3/3 (9 passes, zero skips); public_headers and 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 --check reports 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). The prior Windows/negative-control head remains 0a95fd8f78c6b9c57c5a16212b48b3b01cbe0b0b; relevant atanh/log1p routines, edge fixtures, Dinkumware source/test and VABI header are byte-identical, but this is not a new-head Windows or negative-control run.

@JJenkx

JJenkx commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Fresh final-head Windows follow-up to review5640048774, at exact public 7c767c439fb25a28415020465d9f727ecf964fe5 (main 4f41f4c375f5abb487dbd184fbc150f31994d762 integrated). Windows 11 22621, GCC 15.2 UCRT r7, Ninja Release, BUILD_TESTING=ON. This is a new execution of the rebuilt full module; the older 0a95fd8 Windows result remains historical.

Rebuilt libc and the three math/Dinkumware executables. guest_math, guest_math_exact, guest_dinkumware_internals and public_headers each pass three times: 12/12 initial passes, zero skips. GDB verifies the exact private libs/unpatched/libc.prx loaded path; raw library/executable hashes are attached. All 37,044 materialized repository/provider Git input blobs match the final head before and after, with CRLF normalization and optional unmaterialized upstream app/test refs explicitly recorded.

The supported-behavior negative changes only atanh_nid_postfix to the prior return std::atanh(x) body. The frozen guest_math executable fails at CheckAtanhConsoleBits; other production functions and every test remain unchanged. Exact source restoration and rebuild are followed by 12/12 restored passes, zero skips. No unsupported-call assertion is used.

Raw original/negative/restored PE hashes are retained. Original/restored raw hashes differ in PE metadata; a separate in-memory comparison zeroes ONLY the COFF timestamp and PE checksum and proves all remaining bytes identical. Production binaries are not normalized or patched, and all frozen executable/source hashes are restored.

Exact source/provider/module proofs, raw logs/JUnit, narrow negative patch, PE comparison and terminal FIFO cleanup, SHA-256 caadb62734927bb0a12cc38700477a9c7a46a07c243b34d3e0d1a7557aa238e8; downloaded bytes and all 56 manifest members verified. No SDK/game binaries or assets included.

This closes the fresh Windows portion only. The separate Linux refresh/negative evidence keeps its own pins and scope; no fresh Linux negative, SDK-module reference, macOS, console, title/GPU, performance or full-suite result is claimed here. AI-assisted: yes (Sol6.1medium).

@MarcZX10, please re-review this exact-head Windows positive/negative/restoration evidence; upstream full CI remains separate.

@JJenkx

JJenkx commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Fresh Linux negative/restoration qualification for final head 7c767c439fb25a28415020465d9f727ecf964fe5 on main 4f41f4c375f5abb487dbd184fbc150f31994d762: guest_math, guest_math_exact and guest_dinkumware_internals each pass three times before the control (9 passes). Replacing only the double atanh_nid_postfix body with return std::atanh(x); makes guest_math fail the unchanged CheckAtanhConsoleBits assertion at GuestMath.cpp:1417. Restoring the exact source returns all three groups to three passes each (9), plus public_headers; the library and all three test executables have identical raw SHA-256 hashes before and after restoration. Zero skips. Both before/after audits verify 31,551 provider/source blobs with the same prescribed gitlinks; the private build's libc.prx loader path is recorded.

Verified Linux logs, JUnit, control patch, source/provider fingerprints and restoration proof — SHA-256 4cf51299cc068b43477322860d635451ba2450a478ea6b865af3e85b18c0ca5c. This is a focused Linux CPU check; no new title/module/console/performance comparison is inferred. The separate fresh Windows receipt covers the same final head.

@MarcZX10 This supplies the final-tree Linux negative requested in review 5640048774; the older controls remain attributed to their original pins. Please re-review the refreshed head and current checks when available.

AI-assisted: yes (Codex).

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 3, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 4, 2026
@JJenkx

JJenkx commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Windows check for the scheduled cross-platform review, at head 9811e07c2f merged onto main b611e634f7 (990ce3cfb1, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run this test on pull requests.

  • guest_math passes in 3 of 3 runs.

AI-assisted: yes.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 9811e07 merged onto main b611e63 · tested 2026-11-05 03:35 UTC · 21 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 3,819 passed · 17 failed (0 new, 14 also fail on main, 3 unstable on main) · 61 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 3,897 of 3,946 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (1390 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_graphics_maps_fallback 120.3 s, ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ agc_driver_graphics 114.4 s, ⚠️ public_headers 49.1 s, ⚠️ agc_driver_image_sample_unnormalized 46.9 s
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_graphics_maps_fallback: failed in 2 of the last 10 main runs
agc_driver_pipeline_journal: failed in 9 of the last 10 main runs
agc_driver_two_sample_alpha_to_coverage_sample_mask_export: failed in 4 of the last 10 main runs
Failing on main too (14, not counted against this PR)
agc_driver_alpha_to_coverage_sample_mask_export
agc_driver_guest_memory_lifetime_direct
agc_driver_image_gather_volume
agc_driver_image_table
agc_driver_job_manager_compute_capacity
agc_driver_native_depth_bda_clear
agc_driver_native_depth_buffer_clear
agc_driver_native_depth_clears
agc_driver_native_multisample_depth
agc_driver_submit_progress
agc_submit_progress
agc_submit_progress_no_timeline
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (4 IDs in 807 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (807 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_draw_space_reuse, agc_driver_address_draw_space_reuse_held, agc_driver_address_draw_space_reuse_off, agc_driver_address_draw_space_reuse_transitions, agc_driver_address_draw_space_reuse_verify, agc_driver_address_passes, and 799 more
VUID-vkCmdCopyImage-srcImage-01548 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store_image_copy, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_partially_unmapped_plane, agc_driver_depth_plane_unmapped_plane, and 3 more
VUID-vkCmdCopyImage-srcImage-01551 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store_image_copy, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_partially_unmapped_plane, agc_driver_depth_plane_unmapped_plane, and 3 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
Skipped (61)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_copied_writer_label_order_drain: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_float16_unused_nan_payloads: skipped, the device has no native f16 conversions with RTE rounding and kept f16 denormals
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_image_table_vouched_lookups: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a watched imported table cannot be vouched for
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
agc_driver_ngg_vertex_wave_reduction: skipped, s3 describes a 32-lane wave only on 32-lane subgroups, and the device has 64 lanes
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_driver_unit_shadow_budget: skipped, the device does not import watched host memory for unit shadows
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_idle_publish_wait: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a forced watch of the import reads its submissions as CPU stores
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_shadowed_key_stores: skipped, the device imports no watched host memory under a unit shadow
agc_small_tiled_shadow_label: skipped, host imports are unavailable: the test block is not imported and watched
agc_storage_clear_hand_over: skipped, the device imports no watched host memory for the clear-key hand-over
agc_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in 
Reproduce
git fetch origin 9811e07c2f421d3ea034cb7f3388a006dc354c11 b611e634f7fc024f0c13e342d96de744448ef1d9
git checkout b611e634f7fc024f0c13e342d96de744448ef1d9 && git merge --no-ff 9811e07c2f421d3ea034cb7f3388a006dc354c11
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@oneandonlydean
oneandonlydean dismissed MarcZX10’s stale review November 5, 2026 09:28

Met: the branch was refreshed onto current main (head 9811e07) and guest_math + guest_dinkumware_internals were rerun on the final head on Linux and Windows, as asked. Dismissing as met.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 5, 2026
# Conflicts:
#	core/libs/tests/GuestMath.cpp
#	docs/dev/debt/libc.md
@JJenkx

JJenkx commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed onto main e772fb25cc (merge 7555c82248). #10325's CheckHypotConsoleBits landed next to this PR's checks, so GuestMath.cpp and the libc debt note conflicted.

Resolution: I kept main's versions and re-added only this PR's own changes:

  • CheckAtanhEdgeFlags and CheckAtanhConsoleBits, and their two calls;
  • the atanh debt entry.

The merge differs from main in exactly this PR's three files, with the same +75/-1 as its own diff.

Windows, WinLibs GCC 15.2 UCRT, Release:

  • Math tests: guest_math, guest_math_exact, guest_math_elementary, guest_dinkumware_internals and public_headers pass in 3 of 3 runs.
  • Negative control: with main's Math.cpp, guest_math fails in CheckAtanhConsoleBits.
  • Conventions: tools/check_conventions.py passes.

AI-assisted: yes.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 5, 2026
@JJenkx

JJenkx commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Linux check of exact head 7555c82248. Arch Linux 7.2.11, GCC 16.2.1, Release, BUILD_TESTING=ON.

guest_math, guest_math_exact, guest_math_elementary, guest_dinkumware_internals and public_headers pass in 3 of 3 runs each (ctest --repeat until-fail:3), none skipped. These are the tests the Windows refresh ran.

AI-assisted: yes

@oneandonlydean
oneandonlydean merged commit aa5df70 into boykopovar:main Nov 5, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants