Skip to content

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

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

oneandonlydean merged 4 commits into
boykopovar:mainfrom
JJenkx:windows/libc-hypot-msun

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What

hypot returned the host's hypot after an infinity check, so its last bit and its NaN results depended on the host. For example:

  • hypot(0x4093ddc11a2e2b93, 0xc0095f93495aa618) is 0x4093ddc527348f7f in the bundled libc.prx comparison and 0x4093ddc527348f80 on Windows (UCRT);
  • hypot(-NaN(2), NaN(1)) is 0x7ff8000000000002 in the bundled libc.prx comparison and 0xfff8000000000002 on Windows.

On 4 million random pairs, UCRT's hypot differs from the titles' copy on 182,931.

The titles' copy (NID YFoOw5GkkK0) is FreeBSD msun's e_hypot.c. hypot now computes it:

  • the ordering by high word;
  • the a + b return when the ratio exceeds 2^60;
  • the infinity and NaN handling, where an infinity wins over a NaN and a NaN result keeps the argument order, with its sign cleared;
  • the 2^-600, 2^600 and 2^1022 scaling;
  • the two sqrt forms with the operands split at their low words.

The older fdlibm version gives the same bits on the same 4 million pairs. main's existing hypot tests still pass. They include an infinity with a signalling NaN in both orders, which msun's ordering already returns as infinity, so the separate infinity check goes away. hypot3 calls this hypot, and its existing tests still pass too.

errno: neither msun nor the titles' copy sets it, even when a finite pair overflows to infinity (hypot(DBL_MAX, DBL_MAX)), and this port sets none either.

Tested

Current-main integration — 2026-11-03. Head 9079b1e8c3d4d1b9b650d52813454a00a9f078e4 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).

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

Current-main refresh — 2026-11-02. Published head 0d0d95368df2b1377eb17106fc9ec11ff4da750e includes pinned main a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8. The hypot production body and CheckHypotConsoleBits fixture remain unchanged. Main’s log10/log2/atan functions and test calls are retained. The refreshed topic is linear on pinned main with original authorship.

Rebuilt actual libc/Ampr and selected tests from the final input tree. guest_math, guest_math_exact, guest_dinkumware_internals each pass three consecutive runs: 9 runtime passes, zero skips, plus public_headers. Conventions and whitespace pass. Source/input manifests, exact dependencies, library/test hashes, logs/JUnit and head-leased push receipts are attached. The same pinned main passes 18 selected groups three times (54 runtime passes) plus headers. All 34 recursive dependency trees/31,551 tracked blobs verify with zero errors; QuickJS’s update=none test262 corpus is explicitly excluded because it is not a library build input.

Linux-7.2.11-arch1-1-x86_64-with-glibc2.44, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON. Focused Linux CPU qualification only. Older Windows/module/reference reports retain their original pins; no fresh Windows/macOS, SDK-module, console, title/GPU or speed claim. AI-assisted: yes (Codex).

Evidence: https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/math-six-main-a4eca-linux-extra10321-20261102.tar.gz; SHA-256 525ccb31a5d3d0f5adced5fda58818d8432f06c0afa7290139adb60ae6664b54.

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

Rebased without merge commits onto main 73f4f7e06e4f210a8c6570e335fd654dc0a86134. Tested exact head 7f566e9afe54d53f9271d0f0de275f1023e9d991 on Linux x86-64 (AMD Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON, bundled dependencies).

Rebuilt libc, guest_math_tests, guest_math_exact_tests and guest_dinkumware_internals_tests. guest_math, guest_math_exact, guest_dinkumware_internals and public_headers each pass three consecutive times on both pinned main and this exact head: 12 passes per side, zero skips. Conventions and whitespace checks pass. GitHub current-main integration is now backed by these local tests; the latest fetched main also has a clean merge preview.

Original authored executable code and tests are preserved. The exp parent retains its FreeBSD notice; trailing whitespace was removed from three copyright-notice lines. No new Windows, macOS, bundled-SDK/console reference, GPU/title, performance or full-suite execution is claimed. Earlier reference comparisons retain their original source pins.

Source patches, source-preservation proof, exact pins, build logs, raw CTest logs, JUnit and binary hashes; SHA-256 46b6a1579d909a279510564f346f32b61073cc5d090decd6acc0684bfe6d706c. Uploaded copy downloaded and verified. AI-assisted: yes (Codex).

Checklist

@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 11661 docs/dev/debt/libc.md
PR 11689 docs/dev/debt/libc.md
PR 11698 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 12682 docs/dev/debt/libc.md
PR 12688 docs/dev/debt/libc.md
PR 12700 docs/dev/debt/libc.md
PR 12849 docs/dev/debt/libc.md
PR 12965 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 14212 docs/dev/debt/libc.md
PR 15797 core/libs/prx/libc/src/Math.cpp
PR 15798 core/libs/prx/libc/src/Math.cpp
PR 15799 core/libs/prx/libc/src/Math.cpp
PR 15800 core/libs/prx/libc/src/Math.cpp
docs/dev/debt/libc.md
PR 15801 core/libs/prx/libc/src/Math.cpp
docs/dev/debt/libc.md
PR 15802 core/libs/prx/libc/src/Math.cpp
docs/dev/debt/libc.md
PR 15803 core/libs/prx/libc/src/Math.cpp
docs/dev/debt/libc.md
PR 15804 core/libs/prx/libc/src/Math.cpp
docs/dev/debt/libc.md
PR 15806 core/libs/prx/libc/src/Math.cpp
PR 15807 core/libs/prx/libc/src/Math.cpp
docs/dev/debt/libc.md

@JJenkx

JJenkx commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Linux run at this PR's exact head f21eba3e99 (f21eba3e99be6d2c104866fa8559d2d525fa6ea9), not merged onto anything else; its base on main is 4883171f9f.

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-hypot-msun branch from f21eba3 to b584be3 Compare October 24, 2026 03:27
@JJenkx

JJenkx commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main9c85790c9a (including7465) as b584be3, one topic commit/no merges. Only additive debt conflicted; coshf and hypot entries both remain. The hypot implementation body is unchanged from f21eba3. Fresh Linux libc build and guest_math/guest_dinkumware_internals each pass3/3; diff and conventions pass. New logs/rebase proof are attached through the description. Earlier Windows/title-library sampling remains scoped to its original head; no renewed console/fenv result is claimed.

@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 7c2400d and FreeBSD msun e_hypot.c at release/9.0.0, 10.0.0, 11.4.0 and 12.0.0:

  • The port is a line-for-line match of 11.4.0, which is the only one of the four with the (1023+k)<<20 final scale, so the link is right. 9.0.0 and 10.0.0 differ only in ways that give the same bits.
  • I re-ran all 23 CheckHypotConsoleBits vectors, in both argument orders, through a Python emulation of the same operations in plain IEEE double, and every one matches. Main's infinity/signalling-NaN tests (GuestMath.cpp:548-551) also still return +inf with this code.
  • Optional: 12.0.0 changed the Inf/NaN line to fabsl(x+0.0L)-fabs(y+0), which on x86-64 should pick the NaN with the larger payload rather than the first argument. I couldn't run that; it comes from Intel's documented NaN rules. The current vector (NaN(2), NaN(1)) gives the same answer under both, and the swap check skips NaNs. If your title harness confirms it, a case like {0x7ff8000000000001, 0xfff8000000000002, 0x7ff8000000000001} would pin the 11.4.0 behaviour.
  • It merges cleanly into current main, and will conflict additively with #10328 (the test function, its call in main() and the debt line after coshf), which is easy to resolve whichever lands first.

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

@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-hypot-msun branch from b584be3 to 1777fc3 Compare October 24, 2026 07:35
@JJenkx

JJenkx commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 1e20650e84 as 1777fc3d7e52a95d91091cdce8fc8a50fb03ba5c, preserving the merged expm1 entries and this topic. Both Linux math suites pass 3/3; fresh module comparisons reproduce the previous observations. The suggested reversed quiet-NaN case is now in the regression, after checking both bundled copies. Current-head evidence. Windows remains untested for this refresh.

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

ycbuzi commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Windows run of 1777fc3 merged onto main fa515de (c8499c37b0, 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 PR now includes the reversed quiet-NaN regression, and the author reports repeated guest_math/guest_dinkumware_internals runs on Linux and Windows. After refreshing upstream/main, this branch's merge base is 1e20650e8458, with 6,822 current-main commits since it. CONTRIBUTING.md asks contributors to keep branches up to date with main, and current hosted product jobs are skipped. The current-base conventions and diff checks pass, and the merge is clean, but the math tests are still on the older base. Please update to current main and rerun both math suites on the resulting tree. I will revisit approval when current-base integration is validated.

@JJenkx
JJenkx force-pushed the windows/libc-hypot-msun branch from 1777fc3 to 7ef3248 Compare October 25, 2026 04:27
@JJenkx

JJenkx commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed onto current main as requested in review.

Current-head Linux refresh (2026-10-25): 7ef32484b22cd402cfff8ac5f9de2234da5f020e, one topic commit directly on main e7e3e9c1984c293f06bff08428b8c89b7b932ac2, with no merge commits. Depends on remains none. The complete production function is byte-identical to the previous public head, and all original regression cases, including the reversed quiet-NaN check, are retained. Main's merged exp2f/expm1, exact-rounding tests and current public declarations are preserved.

  • Fresh focused libc, guest_math_tests, guest_math_exact_tests and guest_dinkumware_internals_tests builds pass.
  • guest_math, guest_math_exact, guest_dinkumware_internals and public_headers each pass three consecutive runs, with no skips.
  • Negative control restores only main's production Math.cpp while keeping the final fixtures: guest_math aborts and guest_dinkumware_internals passes. Restore the final source, rebuild to the byte-identical libc.prx, then both suites pass three more runs each.
  • Conventions and whitespace checks pass, and the branch merges cleanly with current main.

The earlier Windows/module comparisons below are historical; no fresh Windows, title or console run is claimed. Our Windows host remains explicitly user-paused. Download exact-head source pins, logs, JUnit, negative and restoration results; SHA-256 91a0ee7bc1b8ccfe356dee6cfcbe1dc7b96bf13d06a8ec05f7e4bfb06fd5ec74.

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 Oct 25, 2026
@JJenkx
JJenkx force-pushed the windows/libc-hypot-msun branch from de1272c to f942c93 Compare October 26, 2026 02:29
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 26, 2026
@JJenkx
JJenkx force-pushed the windows/libc-hypot-msun branch from f942c93 to f78469e Compare October 26, 2026 12:27
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 26, 2026

@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.

Re-checked — changes requested

The new Linux qualification is valid evidence for d08fdf47159ca7e888e212baf49e5a3393aeb233, but that head is still based on 2227f136…, not current main.

What I ran

Reviewed PR head d08fdf47159ca7e888e212baf49e5a3393aeb233 against its base 2227f1366188cda5699dd20e2e756a18006a5d4b. Current main is 60bdb061356db736928eee431cd8bd4c9ba68036, 3,334 commits ahead of that base. I downloaded the author-provided Linux qualification archive and verified its SHA-256 and the 10325 result and test logs.

gh api repos/boykopovar/AnyPS5/compare/2227f1366188cda5699dd20e2e756a18006a5d4b...60bdb061356db736928eee431cd8bd4c9ba68036 --jq '{status:.status,ahead_by:.ahead_by,behind_by:.behind_by}'
sha256sum /tmp/anyps5-math-followups-20261031/math-four-dinkumware-exactheads-linux-20261031.tar.gz
tar -xOf /tmp/anyps5-math-followups-20261031/math-four-dinkumware-exactheads-linux-20261031.tar.gz 10325/tests.log
gh api repos/boykopovar/AnyPS5/pulls/10325 --jq '{base:.base.sha,head:.head.sha}'

Results

Check Result
Author-provided Linux guest_dinkumware_internals artifact 3/3 passed, zero skips; result metadata pins the exact PR head above
Evidence archive integrity SHA-256 matches the value posted with the archive
Hosted Windows Passed at the exact PR head; Linux product job skipped
Current-main integration Not checked: the PR base remains 2227f136…, 3,334 commits behind current main
Unedited Linux test-log excerpt
    Start 451: guest_dinkumware_internals
451: Test command: /mnt/sas-ssd/AnyPS5-work/workspace/pr-review-followups-20261026/pr8123/build/tests/guest_dinkumware_internals_tests
451: Test #451: guest_dinkumware_internals .......   Passed    0.00 sec
    Start 451: guest_dinkumware_internals
451: Test command: /mnt/sas-ssd/AnyPS5-work/workspace/pr-review-followups-20261026/pr8123/build/tests/guest_dinkumware_internals_tests
451: Test #451: guest_dinkumware_internals .......   Passed    0.00 sec
    Start 451: guest_dinkumware_internals
1/1 Test #451: guest_dinkumware_internals .......   Passed    0.00 sec
100% tests passed out of 1
Total Test time (real) = 0.04 sec

Negative control

Not run for this re-check. The supplemental report adds positive tests and does not claim a new negative control.

Findings

Blocking

  • The exact-head tests are on the old base. CONTRIBUTING.md requires branches to stay up to date with main; current main has advanced by 3,334 commits. Please refresh this branch onto current main and rerun the focused tests on the resulting head before approval. For #10321, refresh its open prerequisite #10234 first, then update the dependent branch.

Non-blocking

  • The Linux evidence package is internally consistent and its digest matches the posted SHA-256. The Windows test runs described in the PR comments are author-reported; I did not independently reproduce them.

Sources

Not verified

I did not rebuild or rerun the C++ tests locally. Windows evidence is author-reported. No console, SDK, title, GPU, or full-suite testing was performed in this re-check.

To get this to a good state

Rebase onto current main, preserving declared dependency order, then provide exact-head results for the focused math and Dinkumware tests. I will re-run the same source and integration checks on the refreshed heads.

@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.

Re-checked — changes requested

The supplemental Linux evidence is pinned to the current PR head, but it does not test the combination with current main, which has since changed the same source, test, and debt files.

What I ran

Reviewed PR head d08fdf47159ca7e888e212baf49e5a3393aeb233 (base 2227f1366188cda5699dd20e2e756a18006a5d4b) and current main 60bdb061356db736928eee431cd8bd4c9ba68036. Compared the changed-path lists and fetched file identities for core/libs/prx/libc/src/Math.cpp, core/libs/tests/GuestMath.cpp, and docs/dev/debt/libc.md. Downloaded the author-provided Linux evidence archive and verified its SHA-256 and 10325 test log.

gh api repos/boykopovar/AnyPS5/pulls/10325 --jq '{base:.base.sha,head:.head.sha,mergeable:.mergeable}'
gh api repos/boykopovar/AnyPS5/contents/core/libs/prx/libc/src/Math.cpp?ref=2227f1366188cda5699dd20e2e756a18006a5d4b --jq .sha
gh api repos/boykopovar/AnyPS5/contents/core/libs/prx/libc/src/Math.cpp?ref=60bdb061356db736928eee431cd8bd4c9ba68036 --jq .sha
sha256sum /tmp/anyps5-math-followups-20261031/math-four-dinkumware-exactheads-linux-20261031.tar.gz
tar -xOf /tmp/anyps5-math-followups-20261031/math-four-dinkumware-exactheads-linux-20261031.tar.gz 10325/tests.log

Results

Check Result
Supplemental Linux guest_dinkumware_internals Passed 3/3, zero skips according to the downloaded exact-head archive; archive SHA-256 matches the posted value
Earlier guest_math / guest_math_exact runs Author-reported on the same old base; not rerun in this re-check
Hosted Windows Passed at the current PR head; Linux product job skipped
Mergeability GitHub currently reports mergeable; current main still changed the three files also changed by this PR
Current-main integration tests Not run; the supplied logs use base 2227f136…
Unedited test-log excerpt from the supplied archive
    Start 451: guest_dinkumware_internals
451: Test command: /mnt/sas-ssd/AnyPS5-work/workspace/pr-review-followups-20261026/pr8123/build/tests/guest_dinkumware_internals_tests
451: Test #451: guest_dinkumware_internals .......   Passed    0.00 sec
    Start 451: guest_dinkumware_internals
451: Test command: /mnt/sas-ssd/AnyPS5-work/workspace/pr-review-followups-20261026/pr8123/build/tests/guest_dinkumware_internals_tests
451: Test #451: guest_dinkumware_internals .......   Passed    0.00 sec
    Start 451: guest_dinkumware_internals
1/1 Test #451: guest_dinkumware_internals .......   Passed    0.00 sec
100% tests passed out of 1
Total Test time (real) = 0.04 sec

Negative control

Not run in this re-check. The new report supplies positive runs and makes no new negative-control claim.

Findings

Blocking

  • Math.cpp, GuestMath.cpp, and docs/dev/debt/libc.md all changed on current main after the PR's base. For example, current Math.cpp still has the host-backed hypot path and current GuestMath.cpp has newer math/environment test changes; the supplied archive was built from the older tree. A passing old-base run does not establish the result when these changes are combined. Please refresh this branch onto current main and rerun the focused math and Dinkumware tests on the resulting head. For #10321, update its open prerequisite #10234 first, then refresh the dependent branch.

Non-blocking

  • The attached Linux Dinkumware logs are internally consistent and their archive digest matches. The Windows results described in the PR comments remain author-reported; I did not independently reproduce them.

Sources

Not verified

I did not rebuild or rerun C++ tests locally, and did not test the combined tree on current main. Console, SDK, title, GPU, and full-suite behavior were not verified in this re-check.

To get this to a good state

Refresh onto current main (respecting dependency order), then provide exact-head results for guest_math, guest_math_exact, and guest_dinkumware_internals. I will rerun the relevant source, test, and integration checks on that head.

@JJenkx
JJenkx force-pushed the windows/libc-hypot-msun branch from d08fdf4 to 7f566e9 Compare October 31, 2026 14:33
@JJenkx

JJenkx commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Current-main integration completed for 7f566e9afe54d53f9271d0f0de275f1023e9d991 against main 73f4f7e06e4f210a8c6570e335fd654dc0a86134. The branch has no merge commits. Both main and this refreshed head pass guest_math, guest_math_exact, guest_dinkumware_internals and public_headers, each three times (12 passes per side, zero skips), after rebuilding libc and the three math executables. Conventions and whitespace pass. The PR description now states these exact pins and limits.

Raw qualification evidence, SHA-256 46b6a1579d909a279510564f346f32b61073cc5d090decd6acc0684bfe6d706c (download verified). This is Linux CPU qualification; earlier Windows/reference results remain historical. AI-assisted: yes (Codex).

@MarcZX10, this addresses the current-main integration requested in your latest review. Please re-review this refreshed head.

…bc.prx does

hypot returned the host's hypot after an infinity check, so its last bit
and its NaN payloads depended on the host. The titles' copy is FreeBSD
msun's e_hypot.c, which sets no errno even on overflow; hypot now
computes that algorithm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JJenkx
JJenkx force-pushed the windows/libc-hypot-msun branch from 7f566e9 to 0d0d953 Compare November 2, 2026 18:12
@JJenkx

JJenkx commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Current-main refresh — 2026-11-02. Published head 0d0d95368df2b1377eb17106fc9ec11ff4da750e includes pinned main a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8. The hypot production body and CheckHypotConsoleBits fixture remain unchanged. Main’s log10/log2/atan functions and test calls are retained. The refreshed topic is linear on pinned main with original authorship.

Rebuilt actual libc/Ampr and selected tests from the final input tree. guest_math, guest_math_exact, guest_dinkumware_internals each pass three consecutive runs: 9 runtime passes, zero skips, plus public_headers. Conventions and whitespace pass. Source/input manifests, exact dependencies, library/test hashes, logs/JUnit and head-leased push receipts are attached. The same pinned main passes 18 selected groups three times (54 runtime passes) plus headers. All 34 recursive dependency trees/31,551 tracked blobs verify with zero errors; QuickJS’s update=none test262 corpus is explicitly excluded because it is not a library build input.

Linux-7.2.11-arch1-1-x86_64-with-glibc2.44, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON. Focused Linux CPU qualification only. Older Windows/module/reference reports retain their original pins; no fresh Windows/macOS, SDK-module, console, title/GPU or speed claim. AI-assisted: yes (Codex).

Evidence: https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/math-six-main-a4eca-linux-extra10321-20261102.tar.gz; SHA-256 525ccb31a5d3d0f5adced5fda58818d8432f06c0afa7290139adb60ae6664b54.

@MarcZX10 The current-main conflict is resolved on the tested head above; please re-review the final math/Dinkumware integration.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 2, 2026
hypot carries over FreeBSD msun's lib/msun/src/e_hypot.c at release/11.4.0. Name that source above the port, in the form the exp port uses, followed by the file's Sun copyright and permission notice copied verbatim from that revision. 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 (2fbc9d9c03, on top of 0d0d95368d): above hypot_nid_postfix a line in the exp port's form naming lib/msun/src/e_hypot.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 9079b1e8c3d4d1b9b650d52813454a00a9f078e4 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).

@MarcZX10 This supplies the requested current-main math/exact/Dinkumware integration evidence on the final refreshed head. Please re-review when available.

@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
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 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 7080ae351b merged onto main b611e634f7 (c942cbd8ab, 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 7080ae3 merged onto main b611e63 · tested 2026-11-05 03:24 UTC · 18 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,821 passed · 15 failed (0 new, 13 also fail on main, 2 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_pipeline_journal 120.6 s, ⚠️ agc_driver_graphics_maps_fallback 70.5 s, ⚠️ agc_driver_graphics 65.7 s, ⚠️ agc_driver_image_sample_unnormalized 61.1 s, ⚠️ agc_driver_lazy_resolved_abi 57.7 s
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)
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 (13, 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_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 7080ae351bce89addd907d555161819481ff0eab b611e634f7fc024f0c13e342d96de744448ef1d9
git checkout b611e634f7fc024f0c13e342d96de744448ef1d9 && git merge --no-ff 7080ae351bce89addd907d555161819481ff0eab
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.

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