Skip to content

fix(libc): compute asin and acos with FreeBSD msun's algorithm, as titles' libc.prx does - #10253

Merged
oneandonlydean merged 17 commits into
boykopovar:mainfrom
JJenkx:windows/libc-asin-acos-msun
Nov 6, 2026
Merged

oneandonlydean merged 17 commits into
boykopovar:mainfrom
JJenkx:windows/libc-asin-acos-msun

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What

asin and acos returned the host's functions, so their last bit and their errno depended on the host. For example, asin(0x3fef4102aaf38ef0) is 0x3ff5abc7e3600d9d on the console and 0x3ff5abc7e3600d9c on Windows (UCRT). Likewise acos(0x3fde7903ac7bb90a) is 0x3ff13151a8ce8628 there and 0x3ff13151a8ce8629 here.

For arguments outside [-1, 1], main's asin returns a negative NaN and raises FE_INVALID, but leaves errno alone (#3605, which followed FreeBSD's source). The titles' copy sets EDOM there. acos on main is the host's.

The titles' copies (NIDs 7Ly52zaL44Q and JBcgYuW8lPU) are FreeBSD msun's e_asin.c and e_acos.c. Both now compute them:

  • the |x| == 1 and |x| > 1 cases;
  • the tiny-argument shortcuts;
  • the pS/qS rational, written once as AsinRational because both files use the same coefficients;
  • the |x| < 0.5, 0.5 <= |x| < 0.975 and |x| >= 0.975 paths of asin, and the x < -0.5 and x > 0.5 paths of acos, with their sqrt split at the low word;
  • acos's pio2_lo, read at run time as msun's volatile read does.

errno: msun sets none, but the titles' copies set EDOM for every argument outside [-1, 1]: finite ones, the infinities, and every NaN. That is exactly msun's (x - x) / (x - x) return, which both ports now take. It gives the default negative NaN for non-NaN arguments, as main's asin tests expect, keeps a NaN argument's payload, and raises FE_INVALID itself. Arguments in [-1, 1] never set it.

Tested

Current-main refresh — 2026-11-04. Head 3135ae25861c85b24139896b133e7cbca68c9718 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).

Review follow-up — 7e375f18d465586d4e50d2893d4d2a9a840702e2. Restored main's float-trig debt wording: the existing TrigfKernelRemPio2 remains a separate one-word/precision-0 port, not shared with the new double reduction. Moved tan_nid_postfix and its complete s_tan.c notice together above the e_sinh.c notice, which again directly precedes sinh_nid_postfix. Trimmed the four notice-line trailing spaces. Executable tokens are unchanged except for the order of the tan definition; notice wording is retained.

Linux x86-64/GCC16.2.1 Release: rebuilt actual libc, guest_math_tests, and guest_math_exact_tests; both test groups pass three repetitions each (6 passes, zero skips). Conventions and git diff --check 4f41f4c375f pass. No new Windows, console, title or performance run is claimed. Review-fix patch, logs and source hashes, SHA-256 4ce442ee8617e329d8e5f1e6c36e628e65e921bf84421dcc4c15e50c88da1f2b (GitHub asset digest verified).

Current-main integration — 2026-11-03. Head af6e9e83fa50bfe3bff146f2560120f11b9f1d0a includes main 4f41f4c375f5abb487dbd184fbc150f31994d762 and retains the prior public history and attribution/licence notices. Main’s newer math implementations and fixtures remain alongside this topic. Main’s float argument-reduction tables, helper and TrigfRemPio2 remain byte-identical and separate from the retained topic double-trig implementation. Actual open prerequisite #10250 head 5c054e6b5e48aef1bde87b7f6c31b70a9e00d563 is 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, 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. The four notice-line trailing spaces from this integration are removed in the follow-up below; no claim that main uses them remains.

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): 2181a5edab48e035145cff5825c79240a87e8181 includes main a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8 and 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_exact and guest_dinkumware_internals each pass three times (9 passes, zero skips), and public_headers passes. 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-256 22866bd2a060ba69cd4387d471605afe20ed644e3257174b2d1488635f8c9b52 (download verified).

The current prerequisite #10250 head 5c054e6b5e48aef1bde87b7f6c31b70a9e00d563 is an ancestor of refreshed head af6e9e83fa50bfe3bff146f2560120f11b9f1d0a.

Main conflict refresh, 2026-10-27 10:18 UTC pass: exact head 57b6d204b0f7856c66cd6b997330c02dc9e5b83e on tested main 3fea2a937ba9fbab2f06c51691fe0c5763659aa3. The topic implementations and fixtures are retained alongside current main's newer math functions and coverage.

Linux Release focused rebuild: guest_math and guest_math_exact each pass three repetitions: 6 passes, zero skips. Conventions, whitespace and merge checks pass. Every refreshed head's submodule pointers match the pinned main; the private dependency checkouts used for the gates are aligned. No new negative-control, Windows, console, title, GPU, full-suite or performance run is claimed. Earlier measurements below retain their original exact pins. Fulfilled merge-order dependencies have been cleared from the checklist; open prerequisites remain.

Exact source/dependency pins, patch-preservation and gitlink proofs, builds, verbose tests, JUnit and lease-push receipts. SHA-256: 702c4110ee9dde421c2dd5e057ed53a2df05e0cf7b01f67e8fb9cb779e332f7c; downloaded copy verified.

Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release, BUILD_TESTING=ON, main 4be3da2.

Current Linux qualification (2026-10-28)

Rebased onto main 2227f1366188cda5699dd20e2e756a18006a5d4b. Linux CPU validation on 2026-10-28 at 5b96a875888056c5bd758270593be17d1a3f5542 (Arch Linux 7.2.9, AMD Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON).

libc, guest_math_tests and guest_math_exact_tests rebuilt from this exact source. guest_math and guest_math_exact each 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.

Current Linux qualification — 2026-10-29

Refreshed against main 5454cd2e455994d992aca39335ce60507eeda1eb.

Linux qualification at ec98fb890ddb084b3a597798521e2c24260fb344 (Arch Linux 7.2.9, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON): guest_math, guest_math_exact, guest_dinkumware_internals each pass three consecutive runs (9/9, no skips). The public_headers audit passes at this exact head. All tracked public-header files match the pinned main; the affected test targets rebuild against those headers. Conventions and whitespace checks pass. The same focused groups passed three times on the pinned main.

Evidence: immutable Linux qualification bundle. Its SHA-256 is 53b095da2f67f55b8aa56ba273681e0330fb39739be844458038dde410fb8cc4. No fresh Windows runtime execution is claimed; older measurements retain their recorded source pins.

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 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 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 9466 docs/dev/debt/libc.md
PR 9526 docs/dev/debt/libc.md
PR 10780 docs/dev/debt/libc.md
PR 11172 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 12518 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 12704 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 15773 docs/dev/debt/libc.md
PR 16004 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 4bc61ddfc3 (4bc61ddfc3f1fa3e97006129041f89535059434c), not merged onto anything else; its base on main is 4be3da2c6f.

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

Linux run at this PR's exact head f15494b583 (f15494b58357365c14a72c6a0408bbfd346c81e8), not merged onto anything else; its base on main is 1e20650e84.

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

@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_asin.c and e_acos.c:

  • It merges cleanly into current main, and main's asin/acos (Math.cpp:359-366) haven't changed since your base.
  • I compared both functions line by line with e_asin.c and e_acos.c. The branches, the cutoffs (0x3e500000, 0x3c600000, 0x3FEF3333), the low-word sqrt split and acos's volatile pio2_lo all match, and AsinRational is exactly msun's p/q.
  • All the constants match the source literals, and each one round-trips to the hex in msun's comments.
  • I ran a separate Python transcription of the two FreeBSD files on all 19 finite cases in CheckAsinConsoleBits. It gives the expected asin and acos bits for every one, including the three UCRT-differing arguments. So the expectations agree with the cited source, not only with the port.
  • Small note: this PR and #10247 both add their test function and call at the same place in GuestMath.cpp (just before CheckExpm1ConsoleBits), so they conflict textually and whichever lands second needs a trivial rebase. You've already listed the order.

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

@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
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 27, 2026
@JJenkx
JJenkx force-pushed the windows/libc-asin-acos-msun branch from 66039c0 to 57b6d20 Compare October 27, 2026 10:28
@JJenkx

JJenkx commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Main conflict refresh, 2026-10-27 10:18 UTC pass: exact head 57b6d204b0f7856c66cd6b997330c02dc9e5b83e on tested main 3fea2a937ba9fbab2f06c51691fe0c5763659aa3. The topic implementations and fixtures are retained alongside current main's newer math functions and coverage.

Linux Release focused rebuild: guest_math and guest_math_exact each pass three repetitions: 6 passes, zero skips. Conventions, whitespace and merge checks pass. Every refreshed head's submodule pointers match the pinned main; the private dependency checkouts used for the gates are aligned. No new negative-control, Windows, console, title, GPU, full-suite or performance run is claimed. Earlier measurements below retain their original exact pins. Fulfilled merge-order dependencies have been cleared from the checklist; open prerequisites remain.

Exact source/dependency pins, patch-preservation and gitlink proofs, builds, verbose tests, JUnit and lease-push receipts. SHA-256: 702c4110ee9dde421c2dd5e057ed53a2df05e0cf7b01f67e8fb9cb779e332f7c; downloaded copy verified.

AI-assisted: yes.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 4, 2026
… main merge

The merge commit 1ccf0b9 removed CheckTrigConsoleBits and its call from
GuestMath.cpp, so this branch carried the sin, cos and tan implementation
from boykopovar#10250 but no longer tested it. The function and its call are restored
verbatim from the commit that added them (4d98e81 by JJenkx); nothing
else changes.

Fix-up on the author's branch, credited to JJenkx.

Co-Authored-By: JJenkx <31495916+JJenkx@users.noreply.github.com>
@JJenkx

JJenkx commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Windows check for the scheduled cross-platform review, at head 6047b26a6e merged onto main b611e634f7 (01bb3669d1, 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.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 5, 2026
…s-msun

# Conflicts:
#	core/libs/tests/GuestMath.cpp
@JJenkx

JJenkx commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged current main 0eba5db30d into this branch as b7fce16e8c. The only conflict was in GuestMath.cpp, where main added CheckFdimFlags() at the same place as this PR's CheckAsinEdgeFlags(). Both functions and both calls are kept. Math.cpp merged without conflicts, and the algorithm and its source notices are unchanged.

Windows, exact head (Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release):

  • guest_math, guest_math_exact, guest_math_elementary, guest_dinkumware_internals and public_headers pass in 3 of 3 runs.
  • Negative control: main's libc/src/Math.cpp restored, keeping this PR's test. guest_math fails at GuestMath.cpp:3068, inside CheckAsinConsoleBits.
  • tools/check_conventions.py --base origin/main passes.

AI-assisted: yes.

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 5, 2026
…s-msun

# Conflicts:
#	core/libs/tests/GuestMath.cpp
@JJenkx

JJenkx commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed onto main 1e24993fa3 (merge 65ff7f781d). The only conflict was in the check list of core/libs/tests/GuestMath.cpp, where both sides added calls; I kept main's checks and this PR's checks.

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 CheckAsinConsoleBits.
  • Conventions: tools/check_conventions.py passes.

AI-assisted: yes.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head b7fce16 merged onto main 9b58b17 · tested 2026-11-05 04:49 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,828 passed · 15 failed (0 new, 12 also fail on main, 3 unstable on main) · 68 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,911 of 3,960 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 (1402 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.3 s, ⚠️ agc_driver_graphics_maps_fallback 79.1 s, ⚠️ agc_driver_graphics 78.8 s, ⚠️ public_headers 70.3 s, ⚠️ agc_driver_image_sample_unnormalized 54.0 s
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_depth_fast_clear_submit: failed in 2 of the last 10 main runs
agc_driver_pipeline_journal: failed in 9 of the last 10 main runs
guest_pthread_start: failed in 2 of the last 10 main runs
Failing on main too (12, not counted against this PR)
agc_driver_alpha_to_coverage_sample_mask_export
agc_driver_guest_memory_lifetime_direct
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
Validated but not compared (2, not in the main baseline's validation pass)
guest_pthread_start
guest_sleep_wake
Validation IDs already present on main (4 IDs in 808 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (808 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 800 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 (68)
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_recorded_draw_staging: skipped, the device does not keep host imports write-watched, so the target is never resident
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_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_storage_pending_key_refresh: skipped, refreshes over a pending key store are not testable here
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_host_resolution_disabled: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_four_k: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_height_only: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not availab
Reproduce
git fetch origin b7fce16e8cf7a1261eff7144c158a4f6c41a98e6 9b58b17eb84b62cd14599d12dd934b921fd2a8cf
git checkout 9b58b17eb84b62cd14599d12dd934b921fd2a8cf && git merge --no-ff b7fce16e8cf7a1261eff7144c158a4f6c41a98e6
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.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 5, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 5, 2026
…s-msun

# Conflicts:
#	core/libs/tests/GuestMath.cpp
@JJenkx

JJenkx commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed onto main e772fb25cc (merge 5b9155a418). The only conflict was in the check list of core/libs/tests/GuestMath.cpp, after #10325 landed; I kept main's checks and this PR's checks.

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 CheckAsinConsoleBits.
  • 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 5b9155a418. 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

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

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 5b9155a merged onto main e772fb2 · tested 2026-11-05 17:07 UTC · 27 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,936 passed · 17 failed (0 new, 10 also fail on main, 7 unstable on main) · 71 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 4,024 of 4,074 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 (1402 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.4 s, ⚠️ agc_driver_graphics_maps_fallback 120.3 s, ⚠️ agc_driver_graphics 120.1 s, ⚠️ agc_graphics_profile_draw 60.3 s, ⚠️ public_headers 53.4 s
Unstable on main (7, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_graphics: failed in 3 of the last 10 main runs
agc_driver_graphics_maps_fallback: failed in 2 of the last 10 main runs
agc_driver_job_manager_compute_capacity: failed in 8 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 5 of the last 10 main runs
agc_submit_progress: failed in 9 of the last 10 main runs
agc_submit_progress_no_timeline: failed in 9 of the last 10 main runs
Failing on main too (10, not counted against this PR)
agc_driver_alpha_to_coverage_sample_mask_export
agc_driver_guest_memory_lifetime_direct
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
guest_mmap_executable
guest_socket_options_multicast
Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)
agc_graphics_profile_draw: Timeout in the parallel run; also passed only on retry in 12 other runs in the last 7 days
Validation IDs already present on main (4 IDs in 805 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (805 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 797 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 (71)
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_recorded_draw_staging: skipped, the device does not keep host imports write-watched, so the target is never resident
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_storage_pending_key_refresh: skipped, refreshes over a pending key store are not testable here
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_net_ctl_disconnected: 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_device_capability: 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_host_resolution_disabled: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROL
Reproduce
git fetch origin 5b9155a418fd89461de5c4cb0661f4e0dd665774 e772fb25cc72ee5faf77847f06bbc69533016e82
git checkout e772fb25cc72ee5faf77847f06bbc69533016e82 && git merge --no-ff 5b9155a418fd89461de5c4cb0661f4e0dd665774
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 and others added 2 commits November 6, 2026 09:56
The e_acos.c licence block lacked the trailing space after "notice" that upstream FreeBSD release/11.4.0 has.

Co-authored-by: JJenkx <31495916+JJenkx@users.noreply.github.com>
@JJenkx

JJenkx commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Linux check of exact head 0cc3508bb7. 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 same tests as the previous Linux check.

AI-assisted: yes

@JJenkx

JJenkx commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Windows check of head 0cc3508bb7, merged onto main bf80054e7c (ac18140061, clean merge).

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

  • guest_math passes in 3 of 3 runs, none skipped.

AI-assisted: yes.

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

Copy link
Copy Markdown
Collaborator

Hi @JJenkx, I merged main (fb117687a9, merge 0cc3508bb7) into this branch so it can land, now that the shared msun reduction code from #10345 is on main. The only conflicts were in core/libs/tests/GuestMath.cpp, where main already had the tests on your side, so those regions take main's version. Git's automatic merge had also stripped a trailing space from three FreeBSD licence lines and reverted main's sinf entry in docs/dev/debt/libc.md; both are restored to main's text. I then added one more commit, 0e255c26fa: the e_acos.c notice in core/libs/prx/libc/src/Math.cpp (line 1046) lacked the trailing space after "provided that this notice" that upstream FreeBSD release/11.4.0 has, so the one space is restored to keep the notice verbatim. That commit is the only change on top of the merge, and it credits you as co-author. Your asin/acos port and tests are otherwise unchanged, and the guest_math tests built and passed locally on the merge commit (the last commit only changes a space inside a comment).

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.

6 participants