Macos port #7201

Closed
marion909 wants to merge 3 commits from upstream-pr/7201 into main
marion909 commented 2026-10-17 16:07:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by marion909 on 2026-10-17T16:07:00Z.


What

macOS host support (x86_64 under Rosetta 2, Vulkan through MoltenVK). Everything platform-specific sits behind __APPLE__ or in specifics/macos/; Linux and Windows code paths are unchanged except for the shared fixes listed at the end.

Build and loading

  • Mach-O build of the prx dylibs and relinked executables: export aliases, the guest image link map, dl_iterate_phdr/dladdr1/dlinfo over Mach-O images, process parameters and eh_frame ranges from the relinked image, one shared SDL2, the configured Vulkan loader for the display window.

Kernel, libc and network semantics

  • XNU differences answered the way Linux does: errno preservation (nanosleep, strto*, getdirentries), mlock/munlockall, anonymous shm_open objects, statvfs, rename over dangling links, O_CREAT on directories, mktime range, acosf rounding, thread CPU clock through thread_info, guest thread stacks and exit destructors.
  • Sockets: connected UDP sendto, shutdown after peer shutdown, FIONREAD on datagrams, AF_UNIX seqpacket pairs over datagram sockets, POLLPRI for urgent data, IPv4 literals in IPv6 lookups.
  • C++ exceptions: host code stays on libc++abi; host std::terminate goes to the guest handler; host frames without DWARF unwind info (the prx dylibs carry only compact unwind) are stepped with the system libunwind.

Graphics (MoltenVK)

  • Per-vertex pixel inputs reconstructed from barycentrics, viewport depth clamping without VK_EXT_depth_range_unrestricted, rect-list culling of invalid rectangles.
  • Every SPIR-V loop gets its own continue block: SPIRV-Cross otherwise folds a continue construct holding the loop body into the for increment and drops the header phi updates, which hung the GPU.
  • HTILE metadata fills are stored on the CPU when no GPU work touches the range, so the following draw does not wait for the whole open batch.
  • On a device loss the driver lists the last 32 draws and dispatches with their shaders; APS5_DUMP_DRAW_SHADER dumps all stages of draws using one shader.

Tests and CI

  • macOS variants for tests that probe Linux-only mechanisms (procfs, ELF interposition of the C++ runtime, uffd write tracking); no test is skipped.

Shared changes (all platforms)

  • fix(agc): portability-subset log line takes a format argument.
  • fix(shader): the request format no longer changes with the MoltenVK barycentric mode.
  • The macOS CI workflow of the fork (macos-port.yml, which publishes logs to a branch) is not part of this PR.

Tested

  • macOS 15.7 (GitHub macos-15 runner, Rosetta 2): 1243 of 1244 ctest tests pass; guest_audio3d_port (a 128 ms timing check) fails on the loaded runner in some runs.
  • Mac mini (Apple silicon), macOS, MoltenVK: Balatro (PPSA21402) runs.
  • Linux: tools/check_compile.py on every change; the Linux test suite is unchanged.

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)
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: Apple silicon (Mac mini), MoltenVK, macOS — vendor/model/driver to be filled in
  • AI-assisted: yes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01YV7XhGi2uc6xm2DZRYsyAt

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4901688703 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7201). Originally posted by [marion909](https://github.com/marion909) on 2026-10-17T16:07:00Z. --- ### What macOS host support (x86_64 under Rosetta 2, Vulkan through MoltenVK). Everything platform-specific sits behind `__APPLE__` or in `specifics/macos/`; Linux and Windows code paths are unchanged except for the shared fixes listed at the end. **Build and loading** - Mach-O build of the prx dylibs and relinked executables: export aliases, the guest image link map, `dl_iterate_phdr`/`dladdr1`/`dlinfo` over Mach-O images, process parameters and eh_frame ranges from the relinked image, one shared SDL2, the configured Vulkan loader for the display window. **Kernel, libc and network semantics** - XNU differences answered the way Linux does: errno preservation (`nanosleep`, `strto*`, `getdirentries`), `mlock`/`munlockall`, anonymous `shm_open` objects, `statvfs`, `rename` over dangling links, `O_CREAT` on directories, `mktime` range, `acosf` rounding, thread CPU clock through `thread_info`, guest thread stacks and exit destructors. - Sockets: connected UDP `sendto`, `shutdown` after peer shutdown, `FIONREAD` on datagrams, AF_UNIX seqpacket pairs over datagram sockets, POLLPRI for urgent data, IPv4 literals in IPv6 lookups. - C++ exceptions: host code stays on libc++abi; host `std::terminate` goes to the guest handler; host frames without DWARF unwind info (the prx dylibs carry only compact unwind) are stepped with the system libunwind. **Graphics (MoltenVK)** - Per-vertex pixel inputs reconstructed from barycentrics, viewport depth clamping without `VK_EXT_depth_range_unrestricted`, rect-list culling of invalid rectangles. - Every SPIR-V loop gets its own continue block: SPIRV-Cross otherwise folds a continue construct holding the loop body into the `for` increment and drops the header phi updates, which hung the GPU. - HTILE metadata fills are stored on the CPU when no GPU work touches the range, so the following draw does not wait for the whole open batch. - On a device loss the driver lists the last 32 draws and dispatches with their shaders; `APS5_DUMP_DRAW_SHADER` dumps all stages of draws using one shader. **Tests and CI** - macOS variants for tests that probe Linux-only mechanisms (procfs, ELF interposition of the C++ runtime, uffd write tracking); no test is skipped. **Shared changes (all platforms)** - `fix(agc)`: portability-subset log line takes a format argument. - `fix(shader)`: the request format no longer changes with the MoltenVK barycentric mode. - The macOS CI workflow of the fork (`macos-port.yml`, which publishes logs to a branch) is not part of this PR. ### Tested - macOS 15.7 (GitHub macos-15 runner, Rosetta 2): 1243 of 1244 ctest tests pass; `guest_audio3d_port` (a 128 ms timing check) fails on the loaded runner in some runs. - Mac mini (Apple silicon), macOS, MoltenVK: Balatro (PPSA21402) runs. - Linux: `tools/check_compile.py` on every change; the Linux test suite is unchanged. ### Checklist - [ ] Based on current `main`; no other open PR implements the same functions - [ ] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`) - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [ ] GPUs tested: Apple silicon (Mac mini), MoltenVK, macOS — vendor/model/driver to be filled in - [x] AI-assisted: yes 🤖 Generated with [[Claude Code](https://claude.com/claude-code)](https://claude.com/claude-code) https://claude.ai/code/session_01YV7XhGi2uc6xm2DZRYsyAt
blawesom commented 2026-10-17 18:48:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T18:48:48Z.


Rebase handoff — rebased onto current main (the two-commit macOS Rosetta 2 series, authorship unchanged). Resolutions:

  • AvPlayer.hpp: main's newer controllerClosed kept alongside your endSeen atomic
  • Threads.cpp: main's ceil-based deadline form kept
  • ExceptionRuntime.cpp: your structured platform include block kept, with main's Linux sys/prctl.h include restored inside the non-Apple branch (it is still needed at the PR_SET_DUMPABLE call)
  • one conventions fix: the __attribute__((visibility("hidden"))) on Aps5GuestTlsAllocateSlow dropped (hidden is the default for the non-exported symbol)

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds; conventions pass; full suite green apart from the known main regression (agc_driver_tessellation segfault — Mesa, tracked in #5444), not this PR.

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/7201
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 35f23940c.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6238900129 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7201#issuecomment-6238900129). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-17T18:48:48Z. --- **Rebase handoff** — rebased onto current `main` (the two-commit macOS Rosetta 2 series, authorship unchanged). Resolutions: - `AvPlayer.hpp`: `main`'s newer `controllerClosed` kept alongside your `endSeen` atomic - `Threads.cpp`: `main`'s ceil-based deadline form kept - `ExceptionRuntime.cpp`: your structured platform include block kept, with `main`'s Linux `sys/prctl.h` include restored inside the non-Apple branch (it is still needed at the `PR_SET_DUMPABLE` call) - one conventions fix: the `__attribute__((visibility("hidden")))` on `Aps5GuestTlsAllocateSlow` dropped (hidden is the default for the non-exported symbol) Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): builds; conventions pass; **full suite green apart from the known `main` regression** (`agc_driver_tessellation` segfault — Mesa, tracked in #5444), not this PR. **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/7201 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `35f23940c`.
adriadam10 commented 2026-10-19 13:17:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T13:17:52Z.

Review: CHANGES_REQUESTED


Thanks for the macOS work. As it stands this can't be reviewed or merged as one PR:

  • One topic per PR (your own unchecked checklist line): this mixes the Mach-O build/loading, XNU kernel/libc/socket semantics, C++ exception handling, the MoltenVK/SPIR-V backend changes and the test variants (118 files, +2982). Please split it into independent PRs (e.g. build + loader, kernel/libc errno fixes, sockets, exceptions, graphics, tests), each with its own What/Tested.
  • Overlap with #7332: both PRs add core/shader/recompiler/SpirvBackend/{include/SpirvBackend/SpirvLoopContinue.hpp,src/SpirvLoopContinue.cpp}. Please agree with that PR's author on which one lands the loop-continue change and list the other under Depends on.
  • Conflicts with main and the Conventions check fails on the current head. A rebase is available from @blawesom (rebase/7201, see the handoff comment) if useful.
  • Checklist: "Based on current main" and the GPUs-tested line (vendor/model/driver) are still unfilled.
  • Shared (all-platform) changes in the SPIR-V backend (per-loop continue block, rect-list culling, request-format change) need their own tests that run on Linux CI and show the failing case without the change, since the macOS-only tests don't cover them there.
  • guest_audio3d_port is reported flaky on the macOS runner; please make the timing check robust (loop until steady_clock has advanced) instead of relying on it passing most runs.

Happy to review the pieces once they are separate.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5572118007 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7201#pullrequestreview-5572118007). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T13:17:52Z. **Review:** CHANGES_REQUESTED --- Thanks for the macOS work. As it stands this can't be reviewed or merged as one PR: - **One topic per PR** (your own unchecked checklist line): this mixes the Mach-O build/loading, XNU kernel/libc/socket semantics, C++ exception handling, the MoltenVK/SPIR-V backend changes and the test variants (118 files, +2982). Please split it into independent PRs (e.g. build + loader, kernel/libc errno fixes, sockets, exceptions, graphics, tests), each with its own **What/Tested**. - **Overlap with #7332**: both PRs add `core/shader/recompiler/SpirvBackend/{include/SpirvBackend/SpirvLoopContinue.hpp,src/SpirvLoopContinue.cpp}`. Please agree with that PR's author on which one lands the loop-continue change and list the other under **Depends on**. - **Conflicts with `main`** and the **Conventions** check fails on the current head. A rebase is available from @blawesom (`rebase/7201`, see the handoff comment) if useful. - **Checklist**: "Based on current `main`" and the GPUs-tested line (vendor/model/driver) are still unfilled. - **Shared (all-platform) changes** in the SPIR-V backend (per-loop continue block, rect-list culling, request-format change) need their own tests that run on Linux CI and show the failing case without the change, since the macOS-only tests don't cover them there. - `guest_audio3d_port` is reported flaky on the macOS runner; please make the timing check robust (loop until `steady_clock` has advanced) instead of relying on it passing most runs. Happy to review the pieces once they are separate.
MarcZX10 commented 2026-10-22 01:32:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T01:32:01Z.


The overlap check could not compare this older-base branch with #9501. Manual review shows your macOS clock_gettime thread-CPU fallback intersects the same CPU-clock dispatch path that #9501 updates for encoded process clocks. Please coordinate with #9501’s author on the rebase/integration order and whether either branch must land first.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330500211 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7201#issuecomment-6330500211). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T01:32:01Z. --- The overlap check could not compare this older-base branch with #9501. Manual review shows your macOS `clock_gettime` thread-CPU fallback intersects the same CPU-clock dispatch path that #9501 updates for encoded process clocks. Please coordinate with #9501’s author on the rebase/integration order and whether either branch must land first.
MarcZX10 commented 2026-10-22 02:07:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T02:07:01Z.


I am reviewing #9506, which adds sceNetSetDnsInfo, sceNetSetDns6Info and sceNetGetDns6Info plus a new registered test and debt entry. The overlap bot could not compare some of these branches because of base conflicts, and this PR author has not yet recorded an agreed merge order. Please confirm whether your current changes overlap these exact exports, CMake/test insertion, or debt section, and whether #9506 can land before your PR or should depend on yours. The #9506 author is being asked to record the agreed order in Depends on and the overlap note.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330951762 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7201#issuecomment-6330951762). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T02:07:01Z. --- I am reviewing #9506, which adds `sceNetSetDnsInfo`, `sceNetSetDns6Info` and `sceNetGetDns6Info` plus a new registered test and debt entry. The overlap bot could not compare some of these branches because of base conflicts, and this PR author has not yet recorded an agreed merge order. Please confirm whether your current changes overlap these exact exports, CMake/test insertion, or debt section, and whether #9506 can land before your PR or should depend on yours. The #9506 author is being asked to record the agreed order in `Depends on` and the overlap note.
MarcZX10 commented 2026-10-22 02:08:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T02:08:23Z.


I am reviewing #9501, which adds encoded process CPU clocks in the shared ReadClock dispatch. The macOS thread-CPU fallback in #7201 is in the same path. Please confirm whether the two branches compose in either order or which should land first, so the authors can record the appropriate dependency/rebase plan.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330969275 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7201#issuecomment-6330969275). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T02:08:23Z. --- I am reviewing #9501, which adds encoded process CPU clocks in the shared `ReadClock` dispatch. The macOS thread-CPU fallback in #7201 is in the same path. Please confirm whether the two branches compose in either order or which should land first, so the authors can record the appropriate dependency/rebase plan.
maximilianfv commented 2026-10-22 07:05:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by maximilianfv on 2026-10-22T07:05:12Z.


Test report: Apple M1 Pro, macOS 27.0.1, MoltenVK

Head 6687cbac2, x86_64 under Rosetta 2, -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON.

  • Apple M1 Pro, 16 GB, macOS 27.0.1, Apple clang 21.0.0 (Command Line Tools)
  • Vulkan: LunarG SDK 1.4.363.0 loader (universal), DYLD_LIBRARY_PATH=<sdk>/macOS/lib, VK_DRIVER_FILES=<sdk>/macOS/share/vulkan/icd.d/MoltenVK_icd.json; MoltenVK 1.4.2, apiVersion 1.4.357, deviceName Apple M1 Pro
  • Build: completes, no FAILED: steps
  • ctest -j 6 --timeout 120: 1234 of 1281 pass, 47 fail; 46 fail again on a serial rerun

The fork's CI log for 4b93bc35d (macOS 15.7) shows the agc_driver_* tests as Skipped (no Vulkan loader on the runner), so the GPU results below are the first ones for this branch from a full ctest run.

Fixed on main after this branch's base (b260d8d79, Oct 16)

  • precise_wait: PreciseSleepUs(50) returned before its requested duration. PreciseMonotonicNanos reads CLOCK_MONOTONIC, which has 1000 ns resolution on this host (clock_getres, x86_64); the test measures with libc++ steady_clock (ns). main changed this in a7b8a697d (CLOCK_MONOTONIC_RAW on Apple libc++), which this branch lacks. Passes on 4b93bc35d (same host), which predates the POSIX PreciseWait path.
  • Image and sampler tables, 5 tests (agc_driver_bindless_images, agc_driver_image_sint8, agc_driver_image_table, agc_driver_image_table_cache_bounds, agc_driver_image_table_reuse): image tables need runtimeDescriptorArray, descriptorBindingPartiallyBound and descriptorBindingVariableDescriptorCount, which the device lacks. MoltenVK reports all three features. ImageTableCapacity reserves 28 × 64 = 1792 sampled images against maxPerStageDescriptorSampledImages = 256, and SamplerTableCapacity reserves 32 against maxPerStageDescriptorSamplers = 16, so both return 0. The update-after-bind limits are 1000000 and 1024. main changed this in 070a3f12c (Oct 19). It does not cherry-pick cleanly onto this branch, so this is not verified here.
  • pr_overlap_tools, release_package, linux_fixed_base fail with /usr/bin/python3 3.9.6 (zip(strict=...) and similar) and pass with Python 3.12. #7142 (merged Oct 17) keeps these on Python 3.9.

Fail on this host at both 4b93bc35d and 6687cbac2 (pass on the fork's macOS 15.7 CI)

  • exception_runtime: Assertion failed: (backtrace == _URC_END_OF_STACK && frames >= 2), function CheckGuestUnwindInterface, file ExceptionRuntime.cpp, line 469
  • guest_jit_shared_memory: std::system_error, map shared memory: Operation not permitted

Not separated here: macOS 27 vs 15, or Apple silicon hardware vs the GitHub VM.

Fail at 6687cbac2 only (pass at 4b93bc35d on this host)

  • guest_path_lifetime: path services during exit: mutex lock failed: Invalid argument. Root cause not traced.
  • guest_kernel_app_archive_mmap (not present at 4b93bc35d): fails after sceKernelOpen path=/app0/Data/Small.txt without a message.

MoltenVK features the tests need (vulkaninfo values from this device)

  • f16/f32 denormals, 14 tests: denormal results are flushed to +0, losing the sign of a negative result (e.g. v_ldexp_f16 ... is 0x00000000, expected 0x00008000) or a product that rounds up to the minimum normal (f32_constant_factor_tininess, expected 0x00800000). shaderDenormPreserveFloat16 = shaderDenormPreserveFloat32 = false, denormBehaviorIndependence = NONE. agc_driver_dpp16_operands, agc_driver_f16_conversion_float_mode, agc_driver_f32_constant_factor_tininess, agc_driver_f32_denormal_flush, agc_driver_f32_output_modifier, agc_driver_float16_fma_rounding, agc_driver_float16_misc, agc_driver_float16_modifiers, agc_driver_float16_rounding, agc_driver_ldexp_f16_inline_constants, agc_driver_packed_alu, agc_driver_sdwa_float_selectors, agc_driver_sdwa_ldexp_f16, agc_driver_vop2_modifier_forms
  • SPIR-V requires unsupported device capability 2 (Geometry; geometryShader = false), 6 tests: agc_driver_layered_volume_draw, agc_driver_layered_volume_vertex, agc_driver_layered_volume_vertex_no_gpl, agc_driver_pixel_ancillary_word, agc_driver_relative_ancillary, agc_driver_sample_mask_multisample
  • Cull distance (shaderCullDistance = false), 4 tests: agc_driver_vertex_clip_cull_distances, agc_driver_vertex_clip_cull_draw, agc_driver_vertex_clip_cull_draw_no_key, agc_driver_vertex_user_data_tail
  • shaderStorageImageMultisample = false: agc_driver_sample_multisample_target
  • samplerFilterMinmax = false (guest sampler descriptor uses a min or max reduction which the device does not support): agc_driver_image_plane_bias_on_single_level_volume
  • MoltenVK pipeline compile failures (VK_ERROR_INITIALIZATION_FAILED): agc_driver_front_face_all_bits (#7703), agc_driver_pixel_interlock (Shader library compile failed)

These fail, where the agc_driver_f64_* tests skip on this device (shaderFloat64 = false).

GPU, root cause not traced

  • agc_driver_tessellation: an instanced patch does not take its blue channel from the hull's relative patch index across instances, (255, 0, 96, 255)
  • agc_driver_image_cache_bits, agc_driver_image_texel_status: image_store dlc / image_store tfe reads back 0xdeadbeef, expected 0
  • agc_driver_store_over_untracked: the result did not reach a block the CPU left alone
  • agc_driver_gpu_indirect_arguments_misaligned_writer_ahead: deferred write-back failed: ... a direct memory page shared by several views; aliased writes are not implemented

Host only

  • guest_refused_connect failed once under -j 6 and passed on the serial rerun.

Not run: the VK_LAYER_KHRONOS_validation comparison against main, because main has no macOS full build to compare with.

AI-assisted: yes (Claude Code ran the build, the tests and the triage).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6334885270 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7201#issuecomment-6334885270). Originally posted by [maximilianfv](https://github.com/maximilianfv) on 2026-10-22T07:05:12Z. --- ### Test report: Apple M1 Pro, macOS 27.0.1, MoltenVK Head `6687cbac2`, x86_64 under Rosetta 2, `-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON`. - Apple M1 Pro, 16 GB, macOS 27.0.1, Apple clang 21.0.0 (Command Line Tools) - Vulkan: LunarG SDK 1.4.363.0 loader (universal), `DYLD_LIBRARY_PATH=<sdk>/macOS/lib`, `VK_DRIVER_FILES=<sdk>/macOS/share/vulkan/icd.d/MoltenVK_icd.json`; MoltenVK 1.4.2, apiVersion 1.4.357, deviceName `Apple M1 Pro` - Build: completes, no `FAILED:` steps - ctest `-j 6 --timeout 120`: 1234 of 1281 pass, 47 fail; 46 fail again on a serial rerun The fork's CI log for `4b93bc35d` (macOS 15.7) shows the `agc_driver_*` tests as Skipped (no Vulkan loader on the runner), so the GPU results below are the first ones for this branch from a full ctest run. #### Fixed on `main` after this branch's base (`b260d8d79`, Oct 16) - `precise_wait`: `PreciseSleepUs(50) returned before its requested duration`. `PreciseMonotonicNanos` reads `CLOCK_MONOTONIC`, which has 1000 ns resolution on this host (`clock_getres`, x86_64); the test measures with libc++ `steady_clock` (ns). `main` changed this in a7b8a697d (`CLOCK_MONOTONIC_RAW` on Apple libc++), which this branch lacks. Passes on `4b93bc35d` (same host), which predates the POSIX `PreciseWait` path. - Image and sampler tables, 5 tests (`agc_driver_bindless_images`, `agc_driver_image_sint8`, `agc_driver_image_table`, `agc_driver_image_table_cache_bounds`, `agc_driver_image_table_reuse`): `image tables need runtimeDescriptorArray, descriptorBindingPartiallyBound and descriptorBindingVariableDescriptorCount, which the device lacks`. MoltenVK reports all three features. `ImageTableCapacity` reserves 28 × 64 = 1792 sampled images against `maxPerStageDescriptorSampledImages` = 256, and `SamplerTableCapacity` reserves 32 against `maxPerStageDescriptorSamplers` = 16, so both return 0. The update-after-bind limits are 1000000 and 1024. `main` changed this in 070a3f12c (Oct 19). It does not cherry-pick cleanly onto this branch, so this is not verified here. - `pr_overlap_tools`, `release_package`, `linux_fixed_base` fail with `/usr/bin/python3` 3.9.6 (`zip(strict=...)` and similar) and pass with Python 3.12. #7142 (merged Oct 17) keeps these on Python 3.9. #### Fail on this host at both `4b93bc35d` and `6687cbac2` (pass on the fork's macOS 15.7 CI) - `exception_runtime`: `Assertion failed: (backtrace == _URC_END_OF_STACK && frames >= 2), function CheckGuestUnwindInterface, file ExceptionRuntime.cpp, line 469` - `guest_jit_shared_memory`: `std::system_error`, `map shared memory: Operation not permitted` Not separated here: macOS 27 vs 15, or Apple silicon hardware vs the GitHub VM. #### Fail at `6687cbac2` only (pass at `4b93bc35d` on this host) - `guest_path_lifetime`: `path services during exit: mutex lock failed: Invalid argument`. Root cause not traced. - `guest_kernel_app_archive_mmap` (not present at `4b93bc35d`): fails after `sceKernelOpen path=/app0/Data/Small.txt` without a message. #### MoltenVK features the tests need (vulkaninfo values from this device) - f16/f32 denormals, 14 tests: denormal results are flushed to +0, losing the sign of a negative result (e.g. `v_ldexp_f16 ... is 0x00000000, expected 0x00008000`) or a product that rounds up to the minimum normal (`f32_constant_factor_tininess`, expected 0x00800000). `shaderDenormPreserveFloat16` = `shaderDenormPreserveFloat32` = false, `denormBehaviorIndependence` = NONE. `agc_driver_dpp16_operands`, `agc_driver_f16_conversion_float_mode`, `agc_driver_f32_constant_factor_tininess`, `agc_driver_f32_denormal_flush`, `agc_driver_f32_output_modifier`, `agc_driver_float16_fma_rounding`, `agc_driver_float16_misc`, `agc_driver_float16_modifiers`, `agc_driver_float16_rounding`, `agc_driver_ldexp_f16_inline_constants`, `agc_driver_packed_alu`, `agc_driver_sdwa_float_selectors`, `agc_driver_sdwa_ldexp_f16`, `agc_driver_vop2_modifier_forms` - `SPIR-V requires unsupported device capability 2` (Geometry; `geometryShader` = false), 6 tests: `agc_driver_layered_volume_draw`, `agc_driver_layered_volume_vertex`, `agc_driver_layered_volume_vertex_no_gpl`, `agc_driver_pixel_ancillary_word`, `agc_driver_relative_ancillary`, `agc_driver_sample_mask_multisample` - Cull distance (`shaderCullDistance` = false), 4 tests: `agc_driver_vertex_clip_cull_distances`, `agc_driver_vertex_clip_cull_draw`, `agc_driver_vertex_clip_cull_draw_no_key`, `agc_driver_vertex_user_data_tail` - `shaderStorageImageMultisample` = false: `agc_driver_sample_multisample_target` - `samplerFilterMinmax` = false (`guest sampler descriptor uses a min or max reduction which the device does not support`): `agc_driver_image_plane_bias_on_single_level_volume` - MoltenVK pipeline compile failures (`VK_ERROR_INITIALIZATION_FAILED`): `agc_driver_front_face_all_bits` (#7703), `agc_driver_pixel_interlock` (`Shader library compile failed`) These fail, where the `agc_driver_f64_*` tests skip on this device (`shaderFloat64` = false). #### GPU, root cause not traced - `agc_driver_tessellation`: an instanced patch does not take its blue channel from the hull's relative patch index across instances, `(255, 0, 96, 255)` - `agc_driver_image_cache_bits`, `agc_driver_image_texel_status`: `image_store dlc` / `image_store tfe` reads back 0xdeadbeef, expected 0 - `agc_driver_store_over_untracked`: `the result did not reach a block the CPU left alone` - `agc_driver_gpu_indirect_arguments_misaligned_writer_ahead`: `deferred write-back failed: ... a direct memory page shared by several views; aliased writes are not implemented` #### Host only - `guest_refused_connect` failed once under `-j 6` and passed on the serial rerun. Not run: the `VK_LAYER_KHRONOS_validation` comparison against `main`, because `main` has no macOS full build to compare with. AI-assisted: yes (Claude Code ran the build, the tests and the triage).
maximilianfv commented 2026-10-22 07:28:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by maximilianfv on 2026-10-22T07:28:54Z.


Follow-up: the two failures that appear only at 6687cbac2

Same host and build as my report above. This corrects the "Fail at 6687cbac2 only" section.

guest_path_lifetime: fixed on main by d10c1b43b

The child process registers atexit(CheckPathsDuringExit) before ResolvePath_nid_no_patch("/") first constructs the function-local static Archive in AppArchive.cpp (State(), from b71434d9b). The archive's destructor therefore runs before the exit handler. When the handler resolves a path, it locks the destroyed Archive::mutex, and macOS returns EINVAL for that (mutex lock failed: Invalid argument). d10c1b43b (Oct 17, "keep the app0.zar state through exit handlers") changes it to static auto* archive = new Archive;. It is not in this branch. It cherry-picks cleanly onto 6687cbac2 (2 lines), and with it applied, guest_path_lifetime passes on this host.

guest_kernel_app_archive_mmap: exception state is not visible to the guest terminate handler on macOS

There is no fix for this on main. The test installs OnMmapRefused with std::set_terminate, calls the noexcept mmap_nid_postfix on an app0.zar file, and expects the handler to see the runtime_error from NotImplemented_nid_no_patch through __cxa_current_exception_type_nid_postfix and __cxa_current_primary_exception_nid_postfix.

Under lldb on this branch:

  • The refusal does run: NotImplemented_nid_no_patch ← File::RefuseArchivedFile ← mmap_nid_postfix.
  • The handler is reached through the host runtime: __clang_call_terminate → libc++abi std::terminate → LibcException::HostTerminate → InvokeTerminate → OnMmapRefused.
  • Inside the handler, __cxa_current_exception_type_nid_postfix returns 0, so the handler exits 1.

core/libs/prx/libc/include/specifics/gcc/SymbolAlias.hpp defines GCC_GLOBAL_ALIAS only under __linux__. On Linux, exception/Exports.cpp makes __cxa_throw, __cxa_begin_catch and _ZSt9terminatev resolve to the guest runtime, which sets globals.caught. On macOS these aliases expand to nothing, so a C++ throw inside the .prx libraries is owned by Apple libc++abi and globals.caught stays empty. HostTerminate forwards the handler call, but not the exception that is in flight. The same applies to any guest terminate handler that inspects the current exception, not only this test.

I have not traced whether exception_runtime (CheckGuestUnwindInterface, ExceptionRuntime.cpp:469) comes from the same gap.

AI-assisted: yes (Claude Code ran the build, the debugger traces and the write-up).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6335267729 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7201#issuecomment-6335267729). Originally posted by [maximilianfv](https://github.com/maximilianfv) on 2026-10-22T07:28:54Z. --- ### Follow-up: the two failures that appear only at `6687cbac2` Same host and build as [my report above](https://github.com/boykopovar/AnyPS5/pull/7201#issuecomment-6334885270). This corrects the "Fail at `6687cbac2` only" section. #### `guest_path_lifetime`: fixed on `main` by d10c1b43b The child process registers `atexit(CheckPathsDuringExit)` before `ResolvePath_nid_no_patch("/")` first constructs the function-local `static Archive` in `AppArchive.cpp` (`State()`, from b71434d9b). The archive's destructor therefore runs before the exit handler. When the handler resolves a path, it locks the destroyed `Archive::mutex`, and macOS returns `EINVAL` for that (`mutex lock failed: Invalid argument`). d10c1b43b (Oct 17, "keep the app0.zar state through exit handlers") changes it to `static auto* archive = new Archive;`. It is not in this branch. It cherry-picks cleanly onto `6687cbac2` (2 lines), and with it applied, `guest_path_lifetime` passes on this host. #### `guest_kernel_app_archive_mmap`: exception state is not visible to the guest terminate handler on macOS There is no fix for this on `main`. The test installs `OnMmapRefused` with `std::set_terminate`, calls the `noexcept` `mmap_nid_postfix` on an `app0.zar` file, and expects the handler to see the `runtime_error` from `NotImplemented_nid_no_patch` through `__cxa_current_exception_type_nid_postfix` and `__cxa_current_primary_exception_nid_postfix`. Under lldb on this branch: - The refusal does run: `NotImplemented_nid_no_patch` ← `File::RefuseArchivedFile` ← `mmap_nid_postfix`. - The handler is reached through the host runtime: `__clang_call_terminate` → libc++abi `std::terminate` → `LibcException::HostTerminate` → `InvokeTerminate` → `OnMmapRefused`. - Inside the handler, `__cxa_current_exception_type_nid_postfix` returns `0`, so the handler exits 1. `core/libs/prx/libc/include/specifics/gcc/SymbolAlias.hpp` defines `GCC_GLOBAL_ALIAS` only under `__linux__`. On Linux, `exception/Exports.cpp` makes `__cxa_throw`, `__cxa_begin_catch` and `_ZSt9terminatev` resolve to the guest runtime, which sets `globals.caught`. On macOS these aliases expand to nothing, so a C++ throw inside the `.prx` libraries is owned by Apple libc++abi and `globals.caught` stays empty. `HostTerminate` forwards the handler call, but not the exception that is in flight. The same applies to any guest terminate handler that inspects the current exception, not only this test. I have not traced whether `exception_runtime` (`CheckGuestUnwindInterface`, `ExceptionRuntime.cpp:469`) comes from the same gap. AI-assisted: yes (Claude Code ran the build, the debugger traces and the write-up).
maximilianfv commented 2026-10-22 09:25:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by maximilianfv on 2026-10-22T09:25:17Z.


exception_runtime on this host: the libunwind fallback drops main from _Unwind_Backtrace

Same host and build as above. This is separate from the guest_kernel_app_archive_mmap gap.

CheckGuestUnwindInterface fails at assert(backtrace == _URC_END_OF_STACK && frames >= 2) (ExceptionRuntime.cpp:469). A standalone x86_64 program linked against this branch's libc.prx reproduces it. Calling _Unwind_Backtrace_nid_postfix from Run() called from main() reports 1 frame (Run) and _URC_END_OF_STACK. main is never reported.

None of the binaries involved (exception_runtime_tests, libc.prx, the probe) has an __eh_frame section, only __unwind_info. DecodeFrame therefore fails for every frame, and every step goes through the new __APPLE__ VirtualUnwind in exception/Unwind.cpp. Replaying its calls (unw_init_local, unw_set_reg for registers 0–15 and IP − 1, unw_step) frame by frame on this host:

  • Run → main: unw_step returns 1.
  • main → caller: unw_step returns 0 (UNW_STEP_END), and the cursor's IP is already in dyld's start.

VirtualUnwind returns false for unw_step(...) <= 0. GetRules therefore fails on main's frame, and _Unwind_Backtrace_nid_postfix returns before calling the trace function for main. In LLVM's libunwind, step() returns UNW_STEP_END after a successful step when the new IP has no unwind info. If that applies to Apple's build, the 0 means the next frame (start) has no unwind info, and main itself unwound correctly. I have not checked whether dyld's start unwinds differently on macOS 15, where the fork's CI passes.

Simply accepting 0 (< 0 instead of <= 0) does not fix it. The test then fails earlier, at the forced-unwind check (WEXITSTATUS(status) == 63, line 462), and takes about 29 s instead of 1.4 s. UNW_STEP_END probably needs to report the current frame and then end the walk, rather than step past start.

AI-assisted: yes (Claude Code ran the probes and the write-up).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6337385254 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7201#issuecomment-6337385254). Originally posted by [maximilianfv](https://github.com/maximilianfv) on 2026-10-22T09:25:17Z. --- ### `exception_runtime` on this host: the libunwind fallback drops `main` from `_Unwind_Backtrace` Same host and build as above. This is separate from the `guest_kernel_app_archive_mmap` gap. `CheckGuestUnwindInterface` fails at `assert(backtrace == _URC_END_OF_STACK && frames >= 2)` (`ExceptionRuntime.cpp:469`). A standalone x86_64 program linked against this branch's `libc.prx` reproduces it. Calling `_Unwind_Backtrace_nid_postfix` from `Run()` called from `main()` reports 1 frame (`Run`) and `_URC_END_OF_STACK`. `main` is never reported. None of the binaries involved (`exception_runtime_tests`, `libc.prx`, the probe) has an `__eh_frame` section, only `__unwind_info`. `DecodeFrame` therefore fails for every frame, and every step goes through the new `__APPLE__` `VirtualUnwind` in `exception/Unwind.cpp`. Replaying its calls (`unw_init_local`, `unw_set_reg` for registers 0–15 and IP − 1, `unw_step`) frame by frame on this host: - `Run` → `main`: `unw_step` returns 1. - `main` → caller: `unw_step` returns 0 (`UNW_STEP_END`), and the cursor's IP is already in dyld's `start`. `VirtualUnwind` returns false for `unw_step(...) <= 0`. `GetRules` therefore fails on `main`'s frame, and `_Unwind_Backtrace_nid_postfix` returns before calling the trace function for `main`. In LLVM's libunwind, `step()` returns `UNW_STEP_END` after a successful step when the new IP has no unwind info. If that applies to Apple's build, the 0 means the next frame (`start`) has no unwind info, and `main` itself unwound correctly. I have not checked whether dyld's `start` unwinds differently on macOS 15, where the fork's CI passes. Simply accepting 0 (`< 0` instead of `<= 0`) does not fix it. The test then fails earlier, at the forced-unwind check (`WEXITSTATUS(status) == 63`, line 462), and takes about 29 s instead of 1.4 s. `UNW_STEP_END` probably needs to report the current frame and then end the walk, rather than step past `start`. AI-assisted: yes (Claude Code ran the probes and the write-up).
rooklz commented 2026-10-22 13:30:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-22T13:30:12Z.


Merge-order note for one hunk this port shares with my #9625 (core/libs/prx/libkernel/Socket/src/Udp.cpp, shutdown_nid_postfix): #9625 treats XNU's ENOTCONN for an already-shut direction as success only when getpeername still reports a peer, and retries SHUT_WR after SHUT_RDWR. Whichever lands first, the other drops its copy of that hunk; if this port lands first I rebase #9625 onto it and keep whatever your version already handles. The same note is on #8658. If you would rather fold it into this PR, say so and I will close #9625.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6341989092 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7201#issuecomment-6341989092). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-22T13:30:12Z. --- Merge-order note for one hunk this port shares with my #9625 (`core/libs/prx/libkernel/Socket/src/Udp.cpp`, `shutdown_nid_postfix`): #9625 treats XNU's `ENOTCONN` for an already-shut direction as success only when `getpeername` still reports a peer, and retries `SHUT_WR` after `SHUT_RDWR`. Whichever lands first, the other drops its copy of that hunk; if this port lands first I rebase #9625 onto it and keep whatever your version already handles. The same note is on #8658. If you would rather fold it into this PR, say so and I will close #9625.
adriadam10 commented 2026-10-24 01:57:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-24T01:57:33Z.

Review: CHANGES_REQUESTED


Still blocked on the points from the previous review; no push since 2026-10-16 and the PR now conflicts with main in dozens of files, so we can't fix it for you without redesigning how it is split.

  • Split it: 118 files, +2982 across build/loading, XNU kernel/libc/socket semantics, exceptions, the MoltenVK/SPIR-V backend and tests. Each topic needs its own PR with its own What/Tested. @krishalivaibhav's list of the six libkernel files that don't compile on macOS on main is a good first piece; @maximilianfv's reports (exception_runtime unwind fallback, JIT shared memory, MoltenVK PrimitiveId/image atomics) are useful for the pieces they belong to.
  • Overlap with #7332 (SpirvLoopContinue.{hpp,cpp}): agree which PR lands it and list the other under Depends on. Also coordinate with #9501 (thread CPU clock in ReadClock), #9506 and #9625 (Udp.cpp shutdown), as noted in the thread.
  • Conventions check fails and the checklist ("Based on current main", GPUs tested vendor/model/driver) is unfilled.
  • Shared (all-platform) SPIR-V backend changes (per-loop continue block, rect-list culling, request-format change) need tests that run on Linux CI and fail without the change.
  • guest_audio3d_port: make the timing check loop until steady_clock has advanced instead of relying on it passing most runs.

If there is no push in the next 7 days it will be closed as stale; feel free to reopen the pieces rebased.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5636298523 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7201#pullrequestreview-5636298523). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-24T01:57:33Z. **Review:** CHANGES_REQUESTED --- Still blocked on the points from the previous review; no push since 2026-10-16 and the PR now conflicts with `main` in dozens of files, so we can't fix it for you without redesigning how it is split. - **Split it**: 118 files, +2982 across build/loading, XNU kernel/libc/socket semantics, exceptions, the MoltenVK/SPIR-V backend and tests. Each topic needs its own PR with its own **What/Tested**. @krishalivaibhav's list of the six libkernel files that don't compile on macOS on `main` is a good first piece; @maximilianfv's reports (`exception_runtime` unwind fallback, JIT shared memory, MoltenVK `PrimitiveId`/image atomics) are useful for the pieces they belong to. - **Overlap with #7332** (`SpirvLoopContinue.{hpp,cpp}`): agree which PR lands it and list the other under **Depends on**. Also coordinate with #9501 (thread CPU clock in `ReadClock`), #9506 and #9625 (`Udp.cpp` `shutdown`), as noted in the thread. - **Conventions** check fails and the checklist ("Based on current `main`", GPUs tested vendor/model/driver) is unfilled. - **Shared (all-platform) SPIR-V backend changes** (per-loop continue block, rect-list culling, request-format change) need tests that run on Linux CI and fail without the change. - `guest_audio3d_port`: make the timing check loop until `steady_clock` has advanced instead of relying on it passing most runs. If there is no push in the next 7 days it will be closed as stale; feel free to reopen the pieces rebased.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!7201
No description provided.