Macos port #7201
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7201"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by 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 inspecifics/macos/; Linux and Windows code paths are unchanged except for the shared fixes listed at the end.Build and loading
dl_iterate_phdr/dladdr1/dlinfoover 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
nanosleep,strto*,getdirentries),mlock/munlockall, anonymousshm_openobjects,statvfs,renameover dangling links,O_CREATon directories,mktimerange,acosfrounding, thread CPU clock throughthread_info, guest thread stacks and exit destructors.sendto,shutdownafter peer shutdown,FIONREADon datagrams, AF_UNIX seqpacket pairs over datagram sockets, POLLPRI for urgent data, IPv4 literals in IPv6 lookups.std::terminategoes 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)
VK_EXT_depth_range_unrestricted, rect-list culling of invalid rectangles.forincrement and drops the header phi updates, which hung the GPU.APS5_DUMP_DRAW_SHADERdumps all stages of draws using one shader.Tests and CI
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.macos-port.yml, which publishes logs to a branch) is not part of this PR.Tested
guest_audio3d_port(a 128 ms timing check) fails on the loaded runner in some runs.tools/check_compile.pyon every change; the Linux test suite is unchanged.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch).mdfiles or images added to the repository🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01YV7XhGi2uc6xm2DZRYsyAt
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 newercontrollerClosedkept alongside yourendSeenatomicThreads.cpp:main's ceil-based deadline form keptExceptionRuntime.cpp: your structured platform include block kept, withmain's Linuxsys/prctl.hinclude restored inside the non-Apple branch (it is still needed at thePR_SET_DUMPABLEcall)__attribute__((visibility("hidden")))onAps5GuestTlsAllocateSlowdropped (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 knownmainregression (agc_driver_tessellationsegfault — Mesa, tracked in #5444), not this PR.To pick it up:
Head is
35f23940c.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:
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.mainand the Conventions check fails on the current head. A rebase is available from @blawesom (rebase/7201, see the handoff comment) if useful.main" and the GPUs-tested line (vendor/model/driver) are still unfilled.guest_audio3d_portis reported flaky on the macOS runner; please make the timing check robust (loop untilsteady_clockhas advanced) instead of relying on it passing most runs.Happy to review the pieces once they are separate.
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_gettimethread-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.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T02:07:01Z.
I am reviewing #9506, which adds
sceNetSetDnsInfo,sceNetSetDns6InfoandsceNetGetDns6Infoplus 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 inDepends onand the overlap note.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
ReadClockdispatch. 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.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.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, deviceNameApple M1 ProFAILED:steps-j 6 --timeout 120: 1234 of 1281 pass, 47 fail; 46 fail again on a serial rerunThe fork's CI log for
4b93bc35d(macOS 15.7) shows theagc_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
mainafter this branch's base (b260d8d79, Oct 16)precise_wait:PreciseSleepUs(50) returned before its requested duration.PreciseMonotonicNanosreadsCLOCK_MONOTONIC, which has 1000 ns resolution on this host (clock_getres, x86_64); the test measures with libc++steady_clock(ns).mainchanged this ina7b8a697d(CLOCK_MONOTONIC_RAWon Apple libc++), which this branch lacks. Passes on4b93bc35d(same host), which predates the POSIXPreciseWaitpath.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.ImageTableCapacityreserves 28 × 64 = 1792 sampled images againstmaxPerStageDescriptorSampledImages= 256, andSamplerTableCapacityreserves 32 againstmaxPerStageDescriptorSamplers= 16, so both return 0. The update-after-bind limits are 1000000 and 1024.mainchanged this in070a3f12c(Oct 19). It does not cherry-pick cleanly onto this branch, so this is not verified here.pr_overlap_tools,release_package,linux_fixed_basefail with/usr/bin/python33.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
4b93bc35dand6687cbac2(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 469guest_jit_shared_memory:std::system_error,map shared memory: Operation not permittedNot separated here: macOS 27 vs 15, or Apple silicon hardware vs the GitHub VM.
Fail at
6687cbac2only (pass at4b93bc35don 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 at4b93bc35d): fails aftersceKernelOpen path=/app0/Data/Small.txtwithout a message.MoltenVK features the tests need (vulkaninfo values from this device)
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_formsSPIR-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_multisampleshaderCullDistance= 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_tailshaderStorageImageMultisample= false:agc_driver_sample_multisample_targetsamplerFilterMinmax= false (guest sampler descriptor uses a min or max reduction which the device does not support):agc_driver_image_plane_bias_on_single_level_volumeVK_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 tfereads back 0xdeadbeef, expected 0agc_driver_store_over_untracked:the result did not reach a block the CPU left aloneagc_driver_gpu_indirect_arguments_misaligned_writer_ahead:deferred write-back failed: ... a direct memory page shared by several views; aliased writes are not implementedHost only
guest_refused_connectfailed once under-j 6and passed on the serial rerun.Not run: the
VK_LAYER_KHRONOS_validationcomparison againstmain, becausemainhas no macOS full build to compare with.AI-assisted: yes (Claude Code ran the build, the tests and the triage).
Imported from boykopovar/AnyPS5. Originally posted by maximilianfv on 2026-10-22T07:28:54Z.
Follow-up: the two failures that appear only at
6687cbac2Same host and build as my report above. This corrects the "Fail at
6687cbac2only" section.guest_path_lifetime: fixed onmainbyd10c1b43bThe child process registers
atexit(CheckPathsDuringExit)beforeResolvePath_nid_no_patch("/")first constructs the function-localstatic ArchiveinAppArchive.cpp(State(), fromb71434d9b). The archive's destructor therefore runs before the exit handler. When the handler resolves a path, it locks the destroyedArchive::mutex, and macOS returnsEINVALfor that (mutex lock failed: Invalid argument).d10c1b43b(Oct 17, "keep the app0.zar state through exit handlers") changes it tostatic auto* archive = new Archive;. It is not in this branch. It cherry-picks cleanly onto6687cbac2(2 lines), and with it applied,guest_path_lifetimepasses on this host.guest_kernel_app_archive_mmap: exception state is not visible to the guest terminate handler on macOSThere is no fix for this on
main. The test installsOnMmapRefusedwithstd::set_terminate, calls thenoexceptmmap_nid_postfixon anapp0.zarfile, and expects the handler to see theruntime_errorfromNotImplemented_nid_no_patchthrough__cxa_current_exception_type_nid_postfixand__cxa_current_primary_exception_nid_postfix.Under lldb on this branch:
NotImplemented_nid_no_patch←File::RefuseArchivedFile←mmap_nid_postfix.__clang_call_terminate→ libc++abistd::terminate→LibcException::HostTerminate→InvokeTerminate→OnMmapRefused.__cxa_current_exception_type_nid_postfixreturns0, so the handler exits 1.core/libs/prx/libc/include/specifics/gcc/SymbolAlias.hppdefinesGCC_GLOBAL_ALIASonly under__linux__. On Linux,exception/Exports.cppmakes__cxa_throw,__cxa_begin_catchand_ZSt9terminatevresolve to the guest runtime, which setsglobals.caught. On macOS these aliases expand to nothing, so a C++ throw inside the.prxlibraries is owned by Apple libc++abi andglobals.caughtstays empty.HostTerminateforwards 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).
Imported from boykopovar/AnyPS5. Originally posted by maximilianfv on 2026-10-22T09:25:17Z.
exception_runtimeon this host: the libunwind fallback dropsmainfrom_Unwind_BacktraceSame host and build as above. This is separate from the
guest_kernel_app_archive_mmapgap.CheckGuestUnwindInterfacefails atassert(backtrace == _URC_END_OF_STACK && frames >= 2)(ExceptionRuntime.cpp:469). A standalone x86_64 program linked against this branch'slibc.prxreproduces it. Calling_Unwind_Backtrace_nid_postfixfromRun()called frommain()reports 1 frame (Run) and_URC_END_OF_STACK.mainis never reported.None of the binaries involved (
exception_runtime_tests,libc.prx, the probe) has an__eh_framesection, only__unwind_info.DecodeFrametherefore fails for every frame, and every step goes through the new__APPLE__VirtualUnwindinexception/Unwind.cpp. Replaying its calls (unw_init_local,unw_set_regfor registers 0–15 and IP − 1,unw_step) frame by frame on this host:Run→main:unw_stepreturns 1.main→ caller:unw_stepreturns 0 (UNW_STEP_END), and the cursor's IP is already in dyld'sstart.VirtualUnwindreturns false forunw_step(...) <= 0.GetRulestherefore fails onmain's frame, and_Unwind_Backtrace_nid_postfixreturns before calling the trace function formain. In LLVM's libunwind,step()returnsUNW_STEP_ENDafter 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, andmainitself unwound correctly. I have not checked whether dyld'sstartunwinds differently on macOS 15, where the fork's CI passes.Simply accepting 0 (
< 0instead 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_ENDprobably needs to report the current frame and then end the walk, rather than step paststart.AI-assisted: yes (Claude Code ran the probes and the write-up).
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'sENOTCONNfor an already-shut direction as success only whengetpeernamestill reports a peer, and retriesSHUT_WRafterSHUT_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.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
mainin dozens of files, so we can't fix it for you without redesigning how it is split.mainis a good first piece; @maximilianfv's reports (exception_runtimeunwind fallback, JIT shared memory, MoltenVKPrimitiveId/image atomics) are useful for the pieces they belong to.SpirvLoopContinue.{hpp,cpp}): agree which PR lands it and list the other under Depends on. Also coordinate with #9501 (thread CPU clock inReadClock), #9506 and #9625 (Udp.cppshutdown), as noted in the thread.main", GPUs tested vendor/model/driver) is unfilled.guest_audio3d_port: make the timing check loop untilsteady_clockhas 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