macOS support #1
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 TheGuyWhoIsIdiot on 2026-09-24T17:29:25Z.
It'd be wonderful having support with macOS as I am an intel Mac user.
For vulkan shaders load, you could attempt to use MoltenVK to process everything to load under Metal.
I'll probably make pull requests to introduce support for this project.
Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-09-24T19:18:51Z.
I'm not against a pull request for macOS support if:
But for macOS, I'm more concerned about the libc.prx (especially the work of exceptions) and libkernel.prx implementation. These libraries contain a lot of platform-specific code.
Imported from boykopovar/AnyPS5. Originally posted by Vladislav-Kalinkin on 2026-09-25T05:11:40Z.
Hello. Just about macOS. I'm implementing a similar project on Mac related to PS4 (a static recompiler on native Apple Silicon). If you want to support macOS, I won't mind if you use my code to support the processor (wie-project/PS4Recomp).
Imported from boykopovar/AnyPS5. Originally posted by franpeza on 2026-09-26T16:40:13Z.
Hi! I was interested in macOS support, so I started experimenting in my own fork to see how far a port could get. It went further than I expected (I have a game booting and running with sound), so I'm sharing the progress here in case it's useful.
Your conditions from this issue
libc exceptions and libkernel (the concerns you mentioned)
I also fixed a few problems that also affect other platforms (happy to send these as separate PRs)
Not verified yet: the Linux and Windows builds of the shared changes (exception runtime, TLS scan, unwinder helpers). I'd check those before opening any PR.
If this direction works for you, I'd be glad to split it into reviewable PRs.
Imported from boykopovar/AnyPS5. Originally posted by theChaosCoder on 2026-09-26T17:12:12Z.
Fyi Apple is phasing out Rosetta 2, with full support ending after macOS 27 (Golden Gate).
Imported from boykopovar/AnyPS5. Originally posted by TheGuyWhoIsIdiot on 2026-09-26T17:31:22Z.
Support only ends at macOS 28, though users can always dual boot older Mac versions.
Imported from boykopovar/AnyPS5. Originally posted by theChaosCoder on 2026-09-26T17:34:15Z.
nope ends with 27. https://developer.apple.com/news/?id=w5ngl9k2
Imported from boykopovar/AnyPS5. Originally posted by Vladislav-Kalinkin on 2026-09-26T18:16:04Z.
It's surprising that everyone heard that Rosetta 2 is dying, but its active implementation continues. Given that this is not a JIT emulator, it would be logical to make at least a fork with static translation of x64 instructions into C, and from it to ARM and adaptation to the specifics of macOS. It's much more difficult, of course, but I think it's cleaner. I don't know if I'll be able to finish my project (there is no such patience and incentive, because I don't play), but I managed to get to the first Unreal Engine 4 error in Hogwarts Legacy in my PS4 project. That is, at least the processor part is possible.
Imported from boykopovar/AnyPS5. Originally posted by TheGuyWhoIsIdiot on 2026-09-26T18:54:41Z.
After this update, which refers to macOS 28. I still can use Rosetta on a silicon chip Mac running this version, though with an explicit warning.
Imported from boykopovar/AnyPS5. Originally posted by TheGuyWhoIsIdiot on 2026-09-26T18:55:41Z.
I genuinely think this goes against the idea of the project which targets native execution rather than being transformation recompilation.
Imported from boykopovar/AnyPS5. Originally posted by Vladislav-Kalinkin on 2026-09-26T19:03:03Z.
But tell me. And what about, for example, those who buy new Macs, which initially have the minimum version - 28? Even if you imagine the possibility of a rollback, most of you won't even know about it. And also what to do with Wine, Shadps4 and many other projects? “We won't support your version anymore?”
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-05T20:47:49Z.
Hi @boykopovar, I have a macOS port working locally, rebased on current
main. It runs x86-64 under Rosetta 2 and was tested on an M5 Max with macOS 26.5. Before opening pull requests I'd like to know how you want it split, and to avoid overlapping with @franpeza's port.Your conditions:
?:/&&;.app. The Linux and Windows builds are unchanged.libc and libkernel:
__cxa_throwtwo-level. libc.prx's runtime serves guest code.PT_GNU_EH_FRAME, using adl_iterate_phdremulation over the original program headers that the relinker keeps.__TEXT,__eh_frame; the prx are linked with-no_compact_unwind.__APPLE__branches:%fsaccesses into stubs;Relinker:
--macoswrites Mach-O executables and guest modules: rebases, flat-namespace binds, the export trie, guest TLS (including general-dynamic TLS across modules) and init/fini.--to-intelplaces its stubs there too. For Rosetta it also lowers RDSEED, RDPID and CLWB. Rosetta runs AVX2, FMA and BMI, but not SSE4a, SHA, ADX, RDSEED, RDPID, CLWB, CLZERO or MONITORX.Tested on macOS:
The code was written with AI assistance; I reviewed and tested it.
Proposed split, each against
main:__gcc_personality_v0exported for guest C code (it is missing on every platform), and strtoimax/strtoumax errno.relinker --macos(depends on 3).@franpeza, you mentioned a port that boots a game. I'd rather combine our work than duplicate it: if you are about to open PRs, tell me which parts you cover and I'll adapt mine.
Imported from boykopovar/AnyPS5. Originally posted by ymatrix1 on 2026-10-05T23:36:06Z.
I'm currently helping other similar project that supports MacOS, but are still very early stage https://github.com/mattias800/prosper . Basically the idea is to work like Wine but for PS5, it doesn't need to rebuild the binaries to the platform.
Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-06T17:03:40Z.
@mugurc Have you tested libc exception runtime modified on windows or linux? I'm also interested in whether there is any dependency on Rosetta, and whether your version will work without emulation on macOS with x86-64 (it turns out there are some). I think you can open a pr to support exceptions first.
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-06T17:12:11Z.
@boykopovar Not yet: I only have this Mac, so it was tested on macOS only. Here is what the exception changes touch outside macOS:
__gcc_personality_v0is also exported to guest code now, because guest C built with-fexceptionsimports it, andCallPersonalityrecognizes that export. On Linux and Windows the host__gxx_personality_v0and__gcc_personality_v0are unchanged; they forward to the same code.exception_ptrmodel and thetype_infodeclarations are only compiled with libc++/libc++abi (_LIBCPP_VERSION,_LIBCPPABI_VERSION). The Linux and Windows builds use libstdc++, so they don't see them.__TEXT,__eh_frameand thedl_iterate_phdremulation over the guest program headers are__APPLE__only.The PR's CI will run
exception_runtimeandexception_c_cleanupon Linux. They areUNIX-only, so Windows only gets the build.Rosetta: the build is plain x86-64 macOS, and nothing checks for Rosetta at run time. The one Rosetta-specific step is in the relinker:
--macoslowers RDSEED to RDRAND, drops CLWB and turns RDPID into 0, because Rosetta lacks them. That output still runs on an Intel Mac, where it's just unnecessary, so I can put it behind its own flag and leave Intel output as it is. I have no Intel Mac, so I can't test there.I'll open the exceptions PR first, against current
main.Imported from boykopovar/AnyPS5. Originally posted by GeorgeHulpoi on 2026-10-06T17:39:06Z.
+1. It would be nice to have support for MacOS.
Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-08T10:36:22Z.
@mugurc would you push the whole port to a branch on your fork, even if it's rough? I'd like to try it on an M1 Pro with macOS 15.6. that's the oldest Apple Silicon generation on an older macOS than yours, so it should catch what MoltenVK and Rosetta do differently on less capable hardware
I'd also be happy to take a piece of it off your hands if there's something you haven't started, so we don't end up working on the same thing
Imported from boykopovar/AnyPS5. Originally posted by aksmith-git on 2026-10-08T10:53:38Z.
I believe that projects that require Rosetta would be moving to FEX instead: https://github.com/FEX-Emu/FEX
I think it’s been tested with crossover and even on iOS apps like: https://github.com/willfaust/madeira
Imported from boykopovar/AnyPS5. Originally posted by Vladislav-Kalinkin on 2026-10-08T11:52:45Z.
I'd like to believe it, but if I'm not mistaken, FEX is only on Linux. In addition, unfortunately, Apple did a mean thing by making 16k pages instead of 4k and removing the ability to use hardware TSO. I have a feeling that even if they were ported, the speed would be at best 2-5 times slower than the native or Rosetta 2. And for games, it's not an option at all. Of course, I'm not a professional and maybe I'm wrong (please correct) but I don't believe that Apple will forgive, projects will start trying to solve the Rosetta problem. It's easier, you don't need resources, there are few Mac users and why waste time on them at all. After all, besides, as someone wrote here, you can just 'roll back to the old version'. So in this regard I don't believe in the rainbow
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-08T12:10:48Z.
@Zheorgyan the port is on my fork: https://github.com/mugurc/AnyPS5/tree/macos-port. It is rebased on current
main(084aeeb6) and rough: 17 commits, not split into PRs yet. The exception runtime part (#927) is already merged.Build (x86-64 under Rosetta):
Without a Vulkan environment
ctestruns 431 tests on an M5 Max, macOS 26.5.1: 260 pass, 171 skip (the GPU ones), 0 fail.The GPU tests need the Vulkan SDK (1.4.363.0),
DYLD_LIBRARY_PATH=<sdk>/macOS/libandVK_DRIVER_FILESpointing at theMoltenVK_icd.jsonfile itself. Please run them in small batches with a timeout (ctest -j1 --timeout 30), not under a debugger, and leave outagc_driver_lds_atomics64and the flip/display tests, which open windows: a wedged GPU once took my Mac down with a WindowServer watchdog panic. Results from your M1 Pro on macOS 15.6 would be the most useful thing right now, since I only have the one machine.I will open the rest as PR-sized pieces, one topic each, starting with the relinker's
--macosoutput. I'll say here which piece I start before I do, so we don't overlap. If you want one of them, tell me which.Imported from boykopovar/AnyPS5. Originally posted by arvindfroi on 2026-10-08T12:40:38Z.
FEX does run on macOS (arm64, no Rosetta). Answering the "FEX is only on Linux" point with something testable:
ac555dd8, the last commit before that fork's own changes became GPL-3.0-or-later, so it is MIT like upstream FEX; it needs a 9-line patch (three iOS-only diagnostics).mach_vm_remap), through the fork'sDualMap::WriteOffsetand theFEXCore::Allocator::mmaphook.RAX = 229), and x86-64 calling a native arm64 function through amov r10, rcx; mov eax, id; syscall; retstub with a string and two integers (RAX = 1245). That stub is the shape an AnyPS5 NID import could take, with the prx libraries built natively.PS5_PAGE_SIZE = 0x4000). On TSO: FEX uses LRCPC/LRCPC2, which M-series chips have. I have not measured speed yet.Code and
build.sh(clones, patches, builds, runs both in under a minute): https://github.com/arvindfroi/AnyPS5/tree/apple-native/macos-native@mugurc @Zheorgyan I'd like to take this piece, replacing Rosetta with in-process FEXCore on top of the Darwin work in
macos-port, so we don't overlap. I can also run your branch on an M3 Pro and report the ctest results.Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-08T12:40:51Z.
thanks, built
macos-portatdcc8dc76with your cmake line on an M1 Pro, macOS 15.6.1, Apple clang 17 with libc++ 19, Vulkan SDK 1.4.363.0. GPU tests ran with MoltenVKit doesn't build on this toolchain as is. libc++ 19 only has
std::stop_tokenbehind-fexperimental-library, soShutdown.hppandProcess.cppfail. addingadd_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fexperimental-library>)andadd_link_options(-fexperimental-library)in theAPPLEbranch of the top CMakeLists fixes itwith that, 431 tests, 6 fail
agc_driver_sdwa_float_selectorsfails the same way as on your M5agc_driver_exec_host_lanesstops on "subgroup capability 61 is unsupported for shader stage 1". M1 reports subgroups for tessellation control, fragment and compute only, no vertex, and the test only skips the vertex draw for a small subgroup size. aSubgroupStages()getter onVulkanDeviceplus a skip fixes it, and it's the same on main for any device without vertex subgroupsagc_driver_vop1_float_unarygets 0 forexp_f32of -126. M1'sexp2comes out about 2 ULP low even on whole numbers, I checked in plain Metal, so 2^-126 lands just below the normal range and gets flushed. since x >= -126 can't give less than 2^-126, aUMax32with0x00800000in the FPExp2 specials fixes it and passes hereagc_driver_many_buffersneeds 124 storage buffers per stage, MoltenVK reports 31 on every Apple GPU, so I'd guess it fails on your M5 too since it came in on Oct 7. the update-after-bind limit is 1000000agc_driver_pixel_interlockdoesn't compile in MoltenVK because Metal rejectsraster_order_groupon an argument buffer field. without argument buffers it compiles but loses 2 of 64 updates, since raster order groups don't cover BDA accesshost_thread_localis flaky. libc++ makes an async future ready before the thread'sthread_localdestructors runI'd like to take the M1 GPU ones,
exec_host_lanesand theexpfix. if nobody has startedmany_buffersI'd look at the update-after-bind path for it tooImported from boykopovar/AnyPS5. Originally posted by Vladislav-Kalinkin on 2026-10-08T13:09:51Z.
Hmm. Thank you for explaining, sorry if I said something stupid. If it's really like that, then it's better yes... Don't need Rosetta 2 or my method (there is promotion, but I feel that I'll be doing it for a long time and it won't be soon before the first frame). FEX is better if it's true. I wish you good luck, sorry again, goodbye.
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-08T13:18:58Z.
@Zheorgyan thanks for testing, and for the
-fexperimental-libraryfix: it is onmacos-portnow (4d1e064c). I hadn't seen it because my toolchain's libc++ doesn't need the flag.The M1 GPU work is yours:
exec_host_lanes, theexpfix (I saw #1565 and #1571), andmany_bufferswith the update-after-bind path. I haven't started any of them, and I haven't runmany_buffers,pixel_interlockorexec_host_laneson the M5.sdwa_float_selectorsfails on the M5 as well; it is recorded indocs/dev/TechnicalDebt.mdon that branch (an f16 multiply that should give -0.0 gives +0.0), so it is not specific to the M1.On my side
guest_tcpis the flaky one: about 1 run in 5 back to back on the M5, because it expects EPIPE within 100 sends after the peer closes. I haven't looked athost_thread_local.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-08T13:21:57Z.
Starting the next piece now: the relinker's
--macosoutput (the flag, the Mach-O guest writer for executables and modules, and tests that can run on Linux CI). The Mach-O NID patcher and the Rosetta target of--to-intelwill be separate PRs after it, so nobody needs to wait on a big one. I'll link the PR here when it is open.Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-08T13:29:27Z.
thanks.
many_buffersis up as #1580. I'm takingsdwa_float_selectorsnext, the f16 multiply that gives +0.0 instead of -0.0 on Apple GPUsImported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-08T14:03:27Z.
The relinker
--macosPR is open: https://github.com/boykopovar/AnyPS5/pull/1597. It is the Mach-O writer and the flag only, with a test that reads the output back and runs in the Linux and Windows jobs. The Rosetta target of--to-inteland the Mach-O NID patcher are next, as separate PRs.Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-08T14:03:52Z.
@mugurc root cause of
agc_driver_sdwa_float_selectorson M1 for your TechnicalDebt entry: SPIRV-Cross's MSL backend computes precise multiplications asfma(l, r, 0), which turns a -0 product into +0. Fix submitted upstream in KhronosGroup/SPIRV-Cross#2704. It reaches us once MoltenVK picks up that SPIRV-Cross, nothing to change on our sideOther M1 GPU fixes from me: #1565, #1571, #1580
Imported from boykopovar/AnyPS5. Originally posted by Cloud-Multiplayer on 2026-10-08T15:14:12Z.
@mugurc I built your
macos-portbranch (4dc40455) and ran a commercial title through it, since your PRs say none was tested. Results below, plus some macOS pieces I have working that your branch does not have yet, in case they are useful.Setup: M3 Pro, macOS 27.0.1, Rosetta, AppleClang 17, MoltenVK 1.4.2. Title: a 2D title from the compatibility list, relinked with
relinker --macos --to-intel. All 115 libraries built without changes.One caveat about my setup: I have no x86-64 Vulkan loader installed, so I pointed
libvulkan.1.dylibat the MoltenVK dylib directly and skipped the unconditionalVK_KHR_portability_enumerationrequest, which MoltenVK itself rejects without the loader (VK_ERROR_EXTENSION_NOT_PRESENT). Requesting it only whenvkEnumerateInstanceExtensionPropertieslists it would make both setups work.1. Startup crash that depends on the ASLR slide
Most launches end with:
It happens exactly when the image is not loaded on a 16 KiB boundary. Six launches with
DYLD_PRINT_SEGMENTS=1:__ELF0load addressMy reading of the cause, from hitting the same message in my own loader before I aligned its base: the guest rounds an
mprotectrange to the console's 16 KiB pages, and with the image off a 16 KiB boundary the rounded range reaches into a gap between two segments thatGuestAllocationsRegisterMainImagenever registered. There the range was ELF offset 0x496000 to 0x49e000 and the hole 0x496000 to 0x498000, between the segment ending at 0x495380 and the one starting at 0x498000. I have not traced it inside your branch; the table is the evidence. The Mach-O layout itself is 16 KiB aligned (__ELF0at 0x140010000), so only the slide breaks it.2. With a lucky slide: boots, nothing drawn
The title reaches its main loop, the window and swapchain come up, and every sprite draw is skipped:
MoltenVK reports no vertex stage in
supportedStages. The iPad project (buberlo/madeira-anyps5) has a patch for this,0006-invariant-masked-shift, which folds the lane-query expressions so the vertex shader needs no subgroup operations. With that applied on my branch the draws go through. After it, the next stop on MoltenVK isPerVertexKHR decoration is not supported in MSL: MoltenVK 1.4.2 advertisesfragmentShaderBarycentric, but SPIRV-Cross cannot translate it. Their0007-validated-fixed-function-interpolationcovers the simple cases (this title), not all: a second title's shaders are rejected by it.What I have working that may save you time
I have the same title running at a 16.6 ms median flip interval on macOS, on a different container design (relinker's Linux ELF output, mapped by a small in-process loader), so the relinker side does not carry over. The library side does:
GuestWriteWatchhas no backend on macOS inmainor in your branch, so the driver reads render targets back from the GPU every frame; that held this title to about 20 FPS. I implemented it with page protection and a SIGBUS/SIGSEGV handler (first write to a page faults, the handler records it and restores the protection,Collectre-protects). Because the protection is real, it hooksGuestArena::HostWriteso system calls that write guest memory do not fail with EFAULT, routesmprotect/fixedmmapthrough it, and reports the guest's protection rather than the real one toGuestMemory. About 300 lines, self-contained.sceKernelGetdirentrieson APFS.d_seekoffis zero there, so resuming from the last entry's offset rewinds the directory and the guest lists it forever (a second title hangs at startup this way). I report the descriptor position after the read instead.sampleandlldbcould not walk the Rosetta process on my machine. It is what found the two performance problems.The code is on a local branch for now. I can push it to a fork if you want to look before deciding.
I am happy to open the write watch as its own PR against
mainif that fits your plan for the runtime pieces, or to hand it to you to fold intomacos-port; tell me which you prefer. I can also rerun this title, or a second one built with SDK 8.00, against your branch whenever that is useful.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by arvindfroi on 2026-10-08T15:30:49Z.
Native arm64 macOS, no Rosetta, through FEXCore: first results
Following up on my FEX note. On an M3 Pro (macOS 27), on top of mugurc's
macos-port:-DCMAKE_OSX_ARCHITECTURES=arm64).ctestruns 431 tests: 260 pass and 171 skip (the GPU tests; no Vulkan driver is installed). The arm64 changes:va_listis read by hand, as on Windows;long doubleis converted exactly in software (strtold,wcstold,%L);setjmpthrow until a runner provides them.aps5-fex, loads the relinker's Linux output and runs it in-process with FEXCore (willfaust/FEX at the MIT-licensedac555dd8). Imports call the arm64 libraries through x86 stubs. Ten guest programs pass, covering:doubleresults and variadicprintf/snprintf;qsortcomparator called from a library;thread_local;long doublereturns inst(0);relinker/tests/macos.@boykopovar you asked for x86-64. Would you take native arm64 in this shape? The libraries would build for arm64, the runner would be an optional part of the build (
-DAPS5_FEXCORE_DIR), and nothing would change on other platforms. If yes, I'd send it upstream as small PRs after mugurc's macOS ones, starting with the libc and libkernel changes.@mugurc it is in two PRs to your branch:
@loader_path, because dyld ignores$ORIGINand the executable's rpath hid this; andguest_module_fixtureis re-signed after NID patching.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-08T15:49:30Z.
Thanks all, I have read everything above and I'm on it. I may be able to come back with more tomorrow.
@Cloud-Multiplayer thank you for running a real title, and for the table. I reproduced the slide: on my M5 the image also loads in 4 KiB steps (
__ELF0at...C000,...D000,...7000over eight launches). My fixtures never round a range to 16 KiB, so they never saw it. WithMH_PIEcleared the executable loads at0x140010000every time, but the module dylibs still slide by 4 KiB, so it needs the runtime to tolerate the gap. I'm looking at that next.On your offers: please open the write watch as its own PR against
main; it is generic runtime code and it doesn't need to wait for the Mach-O ones. Please also push thesceKernelGetdirentrieschange and the profiler to your fork and link them here. The branch already handlesd_seekoff == 0forgetdents64, so I'd like to compare. RequestingVK_KHR_portability_enumerationonly when it is listed makes sense, I'll look at that too.@arvindfroi thank you for the arm64 and FEXCore work. I have not merged mugurc/AnyPS5#3 or #4: they are large and #3 changes code that x86-64 builds share, and whether native arm64 is wanted is for boykopovar to answer, as you asked. The
@loader_pathand re-signing parts matter for x86-64 as well, so I'll look at them for the macOS build PR.Imported from boykopovar/AnyPS5. Originally posted by morten-holm on 2026-10-08T15:55:44Z.
Hi @mugurc, @boykopovar, @Zheorgyan,
I have also been working on a macOS port (Mach-O output, TLS stubs, NID patcher, write watch for GPU-visible memory) on a private branch, and found yours late. It overlaps your work, so I will not send a Mach-O writer, TLS or NID patcher.
I ran a real PS5 title (not named here) on
mugurc:macos-portat4dc40455(macOS 27, Apple M2, x86-64 under Rosetta). The relinker handles the ELF with--macos --to-intel --skip-sce-module. The title ran only after these changes:0x144cae000), but the guest assumes 16 KB pages. Itsmprotect(R)then covers writable data and the title dies withSIGBUS KERN_PROTECTION_FAILURE. ClearingMH_PIE(load at0x140000000) fixes it. I would make the executable fixed-base with 16 KB borders by default.GuestAllocationsRegisterMainImageskips segments withinitprot == NONE. A no-access filler segment between two data segments is then missing from the registry, and the guest'smprotectacross it throws "guest protection or unmap range has a hole". Registering them (except__PAGEZERO) fixes it.maxprot == initprot == 0, so the samemprotectgets EACCES. Giving no-access guest segmentsmaxprotread+write fixes it.__PAGEZEROmust stay 0, or the kernel kills the process at exec.VK_KHR_portability_enumerationis requested unconditionally, sovkCreateInstancefails when MoltenVK is used directly instead of through the loader. Requesting it only when available fixes it. This one is minor.I opened three PRs against
mainfor problems that are independent of the Mach-O writer. All three were found with the same title:s_cselect_b64of two masks as a lane bit (vertex shaders without subgroups on Metal)PerVertexKHRis rejected)With 1 to 4 and those three, the title shows the same picture as on my own branch (screenshot difference 0.017, no skipped draws). A MoltenVK copy must report
depthClipControl; some do not, and the title then skips 8 draws.Questions for @mugurc: do you want 1 to 3 as PRs after #1597 lands, or will you fold them in? The write watch (mprotect plus a SIGBUS hook for pages the GPU reads) is also unpublished; I can send it as a PR once your libc changes are in.
I use AI assistance (Claude Code) and take responsibility for what I post.
Imported from boykopovar/AnyPS5. Originally posted by arvindfroi on 2026-10-08T16:03:28Z.
GPU tests on an M3 Pro, native arm64 (no Rosetta)
Setup:
molten-vk1.4.2 andvulkan-loader1.4.363.0, withDYLD_LIBRARY_PATH=/opt/homebrew/libandVK_DRIVER_FILES=/opt/homebrew/etc/vulkan/icd.d/MoltenVK_icd.json.--timeout 30, leaving outagc_driver_lds_atomics64.Results:
143 pass.
23 skip. 21 are for features this GPU lacks:
shaderFloat64: thef64_*tests, the division modifier tests andfloat16_dot;shaderBufferInt64Atomics: the 64-bit atomic tests,buffer_atomics,global_atomics_lanesandlook_back_scan;agc_write_trackingskips because macOS has no write watching.4 fail, the ones already discussed here:
exec_host_lanes: subgroup capability 61 for the vertex stage;many_buffers: shader descriptors exceed the per-stage limits;pixel_interlock:vkCreateGraphicsPipelinesreturns -3;sdwa_float_selectors: the f16 multiply that gives +0.0.Two test fixes came out of this, both in mugurc/AnyPS5#3:
global_atomic_csubfailed on arm64 only. Its 4 KiB guest block fromaligned_allocsits inside a 16 KiB host page, so it cannot be imported in place, and atomics need the memory itself. The tests with 4 KiB blocks that only load and store pass through the copies. With a whole host page it passes.oversized_descriptor_setsopenedlibvulkan.so.1, so it skipped on every Mac. It now loads the dylib and enumerates portability devices, as the other tests with their own instance do.Imported from boykopovar/AnyPS5. Originally posted by Cloud-Multiplayer on 2026-10-08T16:26:51Z.
@mugurc done:
main. It carries its own tests (native and through Rosetta) and lists what the macOS memory paths will need to call.29e533ac: https://github.com/Cloud-Multiplayer/AnyPS5/tree/macos-loader. It is the loader-based port I mentioned (relinker's Linux ELF output mapped in-process), shared for comparison rather than for merging.getdents64on APFS:Aps5MacGetdents64, called fromsceKernelGetdirentries. Every entry gets the descriptor position after the read asd_off, and no more host bytes are read than the guest buffer holds, so nothing read is left undelivered. Happy to drop mine if yours covers the same cases.Loader.cpp, started byAPS5_LOADER_PROFILE=<seconds>. A sampler thread signals each thread in turn and the handler records RIP, so blocking calls show up as well as computation. It only depends on the thread list, which the loader keeps from the pthread introspection hook.One more data point since my first comment: on that branch a second title needed two more MoltenVK accommodations, both in the snapshot. Vertex programs that use only ballots, their lane id and wave-mask branches are emitted for a single lane when
supportedStageshas no vertex bit, and the fixed-function interpolation check accepts independent instructions (image reads, scalar work, compares) between a P1 and its P2. I can split either out if useful.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by shanto462 on 2026-10-08T16:29:56Z.
Hi all, thank you for all the work here. I tested
macos-porton an M4 Pro (macOS 27.0.1, Rosetta, Apple clang 21, Vulkan SDK 1.4.363.0 with its MoltenVK), since I have not seen M4 results yet.macos-portat4dc40455, built with mugurc's cmake line (x86-64):ninja libs: OK, 116 libraries.ctestwithout Vulkan: 431 tests, 260 pass, 171 skip, 0 fail.ctest -j1 --timeout 30, withoutagc_driver_lds_atomics64and the flip/display tests): 170 run, 143 pass, 23 skip, 4 fail. The same 4 as on the other Macs:exec_host_lanes:subgroup capability 61 is unsupported for shader stage 1many_buffers:shader descriptors exceed per-stage limitssdwa_float_selectors: lane 2mul_f16gives0x00000000, expected0x00008000pixel_interlock:vkCreateGraphicsPipelinesreturns -3, after the Metal errortype 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'. This matches what @Zheorgyan found on M1 (raster_order_groupon an argument buffer field).run_macos_fixtures.pywith LLVM 23.1.3: 10 of 10 pass.ASLR slide: it happens on M4 too. With
MH_PIEset,__ELF0loads in 4 KiB steps (for example0x142632000and0x144807000, which are off a 16 KiB boundary). WithMH_PIEcleared it loads at0x140010000every run, and theimportandtlsfixtures still pass.I also cherry-picked #1640, #1653 and #1658 onto
macos-portlocally. It builds,ctestgives 434 tests, 263 pass, 171 skip, 0 fail, and the GPU results are the same 143 / 23 / 4. On that build, Breakout (withMH_PIEcleared, packaged withpackage_macos_app.py) ran for 10 s: 587 frames, about 59 FPS, 4 bricks broken.If nobody has started it, I would like to take
pixel_interlockon MoltenVK. @Zheorgyan you found the cause, so please tell me if you want it and I will pick something else. I will write here before I open a PR.Imported from boykopovar/AnyPS5. Originally posted by jamesst20 on 2026-10-08T22:08:54Z.
Tested your fork and it works very well on M4 Pro. Had to pass
APS5_FIXED_FUNCTION_INTERPOLATION=1to get video outputSince you forked AnyPS5, the
mainbranch changed quite a lot and introduces breaking change to your forkgithub.com/boykopovar/AnyPS5@dccfa08d-> VulkanDevice now hard-requires VK_EXT_robustness2 and robustness2.nullDescriptor == VK_TRUE and this is not supported https://github.com/KhronosGroup/MoltenVK/issues/2650
github.com/boykopovar/AnyPS5@3e47c30ed7->MoltenVK doesn't expose shaderStorageImageMultisample https://github.com/KhronosGroup/MoltenVK/pull/505
Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-09T07:41:02Z.
@shanto462 go ahead, it's yours. the cause is SPIRV-Cross putting
raster_order_groupon a field inside the argument buffer, happy to look at the PR when it's upImported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T08:44:35Z.
The 4 KiB slide is fixed on
macos-port(7b384b39). @Cloud-Multiplayer thank you for the table and @shanto462 for confirming it on the M4 Pro.DoMprotectnow trims an edge of the rounded range that no registered range covers, when that edge is smaller than a guest page. A hole inside the range is still an error.__ELFsegments. Before, the Mach-O header,__APS5DATAand__LINKEDITwere registered too, so a range rounded into them tried to give the read-only__LINKEDITwrite access andmprotectfailed withEACCES. That one only showed once the first fix was in.MH_PIEstays set, and modules need no special handling.mprotect-slide: two segments 12 KiB apart, protecting the page at the start of the second. The runner launches it 16 times. Without the change it fails with the "has a hole" message. With it, 150 launches covering all four slides (0,0x1000,0x2000,0x3000mod0x4000) had no failure, and the fullctestis 431 tests with 0 failures.@jamesst20 thank you for the two commits on
main. I'll check them when I re-stackmacos-portonmain; #2015 and #2016 look related.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T09:09:25Z.
macos-portis re-stacked on currentmain(6cc0503d) and is now atc3affc1c. It was a force-push, so @arvindfroi your mugurc/AnyPS5#3 and #4 need rebasing onto it, and anything cherry-picked on top (@shanto462) as well.ctestwithout Vulkan variables: 489 tests, 282 pass, 206 skip, 1 fails.What
mainadded since the last base that needed macOS changes:GuestMemory(PROCMAP_QUERY) andDynamicLoader(<link.h>), and two test targets that find the SPIR-V headers only in the Linux system path.INSTALL_RPATH $ORIGINon every prx replaced the@loader_pathmacOS needs, so a library loaded alone could not find the others (the newpatched_librariestest shows it; the same finding as in #3).__cxa_thread_atexitreturnsvoid, so its "result" is whatever is in the register. We treated it as an error and freed the context twice (guest_thread_callback_abi).guest_path_casecreatesSettings.iniandSETTINGS.INIside by side, which are one file on the default APFS; that part is skipped when the filesystem folds case.The one failure is
guest_ajm, the new multichannel AT9 test. On macOS the decoder reports 24 bytes used for the first synthetic 27-byte frame, so the second frame is parsed from the wrong offset (ERR_UNPACK_GRAD_START_UNIT_OOB). It is deterministic, the same at-O0 -fwrapvand with scribbled malloc, and it is not uninitialized memory. I have not found the cause. If someone who knows the AT9 path wants to look, that is where I stopped.The GPU side is not covered here: I have not run the GPU tests on this base, and I have not picked up fixes for the two
maincommits @jamesst20 pointed out (dccfa08d,3e47c30e); #2015 and #2016 are not merged yet.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T09:10:34Z.
Starting the next piece: the Rosetta target of the relinker, as its own flag,
--to-rosetta, as I said earlier on this issue. On top of what--to-intelconverts it lowers RDSEED to RDRAND, drops CLWB and makes RDPID return processor 0, because Rosetta has none of them.--macosand Intel output stay as they are. It is independent of #1597, so it will be its own PR againstmain.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T09:23:26Z.
The
--to-rosettaPR is open: https://github.com/boykopovar/AnyPS5/pull/2119. It is independent of #1597.Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-09T10:27:49Z.
@mugurc GPU tests on
c3affc1cwith #2015 and #2016, M1 Pro under Rosetta: same 11 failures as arvindfroi plusvop1_float_unaryfrom #1571.guest_ajmis LibAtrac9 writing pastBlock::Gradient[31]on the synthetic block, so the result depends on the compiler, fixed in #2163Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T12:34:53Z.
@Zheorgyan thank you, that explains
guest_ajm: I had ruled out the optimisation level and uninitialised memory and had not looked at the bounds of the gradient table. I'll take #2163 when I re-stackmacos-port, and thanks for running the GPU tests onc3affc1cwith #2015 and #2016.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T12:35:55Z.
Starting the next piece: the Mach-O NID patcher in
nid_patcher, which is what turns the_nid_postfixsymbols of a library built on macOS into NIDs, so thatninja libscan produce the prx files there. It is a separate PR from the build changes that need it.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T13:10:35Z.
The Mach-O NID patcher PR is open: https://github.com/boykopovar/AnyPS5/pull/2247. It is independent of #1597 and #2119.
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T18:18:00Z.
With PR intake limited to authors with 20 merged PRs, I can't open the remaining macOS pieces (the library build changes, packaging, recompiler fixes and the
mprotect-slidefixture). They are all onmacos-port. The three PRs that are already open (#1597, #2119, #2247) are independent and ready for review. @boykopovar how would you like the rest to come in: after these are reviewed, as part of a PR from someone who already meets the limit, or some other way? I'll hold the rest until you say.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T21:20:49Z.
@jermainee thank you, this is very useful.
macos-portis re-stacked onmain(73ba24aa) and now ate9db5ebf, with these of your commits taken as they are (author kept):67ae96deandd5e06abf:socketpairthrows forSOCK_SEQPACKET.c76a529c: x86-64 selected for the full build.cb6865be: the fixtures only in the full build.b1b07b8band5d64d07c: the Vulkan loader and portability drivers in the cache budget and descriptor set tests.d32c465a: theAtomicSharedPtrmutex fallback.fabd982b: standard C++ in the guest fixtures.sceKernelGetCurrentCpugoes throughGuestCpuFromHostnow, as you described. I left out the CI andBUILD.mdcommits: those are for @boykopovar to decide, and the macOS pieces are not inmainyet. The branch also has #2163 (theguest_ajmfix, one line) cherry-picked, with Zheorgyan as author, since it is approved and not merged yet.ctestwithout Vulkan variables on the M5 Max: 509 tests, 297 pass, 211 skip, 0 fail. @arvindfroi your #3 and #4 need another rebase.Thank you for the GPU list as well. It matches what @Zheorgyan and @shanto462 saw, and I'll keep it with the other results.
Imported from boykopovar/AnyPS5. Originally posted by jermainee on 2026-10-09T21:28:04Z.
Reposting my earlier comment, which I deleted; mugurc's reply above refers to it.
I merged
macos-port(c3affc1c) onto currentmain(8b393b6e) and built it on an M4 Pro (macOS 26, AppleClang 21, CMake 4.4): https://github.com/jermainee/AnyPS5/pull/1. Only two conflicts, both small. A few things I found also apply tomacos-portitself; the fixes are on my branch, so take whatever is useful.On
macos-portas it ismacos_fixturesis registered underif(APPLE), so the relinker-only build registers it too. That build has nocore/libs/libs, so the test fails there, and that is the build the macOS relinker CI job uses.if(APPLE AND NOT ANYPS5_RELINKER_ONLY)fixes it (cb6865be).-DCMAKE_SYSTEM_PROCESSOR=x86_64has no effect with CMake 4.4:project()setsCMAKE_SYSTEM_PROCESSORback toarm64. It is harmless today, since libjpeg-turbo builds withWITH_SIMD=OFF, but the value also goes into the shader cache key.CMAKE_APPLE_SILICON_PROCESSOR=x86_64set beforeproject()works. My branch defaults it andCMAKE_OSX_ARCHITECTURESto x86-64 for the full build on a Mac, so a plaincmake -S . -B build -G Ninjagives x86-64, and the relinker-only build stays native (c76a529c).OversizedDescriptorSets(and, frommainsince,StorageCacheBudgetandSampledCacheBudget) load onlylibvulkan.so.1outside Windows, and create their instance withoutVK_KHR_portability_enumeration. With the SDK loader they getVK_ERROR_INCOMPATIBLE_DRIVER. Loadinglibvulkan.1.dyliband enumerating portability drivers, asBdaDevicedoes, fixes them (b1b07b8b,5d64d07c). The three cache budget tests then pass, andoversized_descriptor_setsskips, since the M4 Pro binds fewer than 4097 storage buffers per stage.greet.cpp's__attribute__((constructor))is folded into.dataat-O1: LLVM evaluates it at compile time, so the module has no.init_arrayand themodulefixture never runs an initializer. A dynamic initializer that reads avolatilekeeps it. That change, plus volatile function pointers instead ofnoinlineand<ammintrin.h>instead ofvector_size, takes the Conventions check from 11 findings to 2: thecleanupattribute and the initial-exectls_model, which standard C++ can't express. The intel fixtures compile to the same bytes, and all 11 fixtures pass with LLVM 23.1.3 (fabd982b).AtomicSharedPtr's libc++ fallback can guard the pointer with a mutex instead of calling the deprecated free functions under#pragma clang diagnostic. libc++ serialises those through a mutex pool anyway, and the GPU results below are unchanged with it (d32c465a).From
mainsince6cc0503d(these will show up on the next re-stack)socketpair(8f316964): macOS has noAF_UNIXSOCK_SEQPACKETpair, soguest_socket_pairaborted. It now throws, as Windows does (67ae96de).sceKernelGetCurrentCpunow goes throughGuestCpuFromHost. Thepthread_cpu_number_npbranch setsindexand falls through to it (merge commit).CI
A
macosfull-build job onmacos-latest(arm64 runner, x86-64 under Rosetta). On a cold runnerpatched_librariestook over 120 s with the tests in parallel, and 0.2 s once Rosetta had translated the libraries, so the job loads both library sets once beforectest. Result: 503 of 505. The failures areguest_ajm(#2163) andhost_thread_local(#1604), the same flake Zheorgyan saw.GPU through MoltenVK on the M4 Pro (Vulkan SDK 1.4.363.0, one test at a time with
--timeout 30, withoutlds_atomics64and the flip and display tests)Current
mainrequiresnullDescriptor, so without #2015 every GPU test stops at device creation. With #2015, on the branch: 210 run, 169 pass, 26 skip, 15 fail.prepared_shaders*tests fail on MSAA storage images (#2016).exec_host_lanes,ngg_vertex_wave_infofma(l, r, 0)cause:sdwa_float_selectors,packed_alu,f32_denormal_flush,f32_output_modifiermany_bufferspixel_interlocklds_src2buffer_unaligned_baseandinterpolation_f16fail on the missingshaderBufferInt64Atomicsand Float64, where other tests skip.vop1_float_unarypasses on the M4 Pro.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Cloud-Multiplayer on 2026-10-10T01:13:37Z.
@mugurc #1686 (write watch) is rebased onto current
mainand mergeable again; its nine checks were green before the rebase. Thank you for the slide fix and themprotect-slidefixture.Since then I got a Unity IL2CPP title (Hollow Knight: Silksong, SDK 11.00) through start-up and into gameplay on my loader-based branch, with current
mainmerged in. That is a different container frommacos-port, but everything below is in code both share, and none of it is specific to the title. With PR intake limited I cannot send these as PRs, so here they are in case they save you the same search. Take whatever is useful.1. The shader disk cache is off on macOS without saying so.
ShaderCacheDirectory()(core/shader/recompiler/ShaderDiskCache.cpp) finds its directory withread_symlink("/proc/self/exe")outside Windows. On macOS that fails and the function returns an empty path, so the cache is disabled._NSGetExecutablePathin an__APPLE__branch fixes it;ANYPS5_SHADER_CACHE_DIRalso works as a workaround. Measured on a UE4 title with about 3,000 shaders: 2,930 hits and 40 misses on the second start once it is on.2. Guest C++ exceptions cannot unwind. The
__APPLE__branch ofsceKernelGetModuleInfoForUnwind(libkernel/Module/src/Module.cpp) setseh_frame_hdr_addrand leaveseh_frame_addrandeh_frame_sizeat zero. A title's own unwinder (the one in its bundledlibc.prx) asks for the frame it is in, gets no table, and__cxa_throwends interminate. Every managed exception in IL2CPP is a C++ throw, so a Unity title dies at the first one:Terminating due to uncaught exception of type Il2CppExceptionWrapper. Filling the two fields the way the Windows branch does (readeh_frame_ptrfrom the header, walk the records to the terminator), and reporting the whole image asseg0, fixes it. Two details: the relinker's executable output has noPT_GNU_EH_FRAME, though the table is still at the start of its read-only segment (01 1b 03 3b); andsceSysmoduleGetModuleInfoForUnwindshould return an error for an address it does not know rather than throw, because the guest calls it for every frame it steps over and checks the result.3.
sceSysmoduleGetModuleInfoForUnwindreads/proc/self/mapsoutside Windows. There is none on macOS. If you emulate the file, note that this function is hot: a Unity title calls it thousands of times per second during gameplay (everylongjmpand every throw walks frames through it), and rendering the address space for each call took about three quarters of the main thread. Onemach_vm_regioncall for the address does the same job.4.
nullDescriptor.mainnow requiresrobustness2.nullDescriptorat device creation (VulkanDevice.cpp, "shader runtime requires nullDescriptor"). MoltenVK 1.4.2 hasVK_EXT_robustness2but reports the feature as false, so the device is refused on every Mac. I got past it by not enabling the feature and telling the shader profile null descriptors work, on the assumption that MoltenVK binds nothing for a null handle; rendering looks right in two titles, but I have not tested that assumption directly, so treat it as a workaround and not a finding.5.
sceKernelRaiseExceptionis Windows-only. Outside Windows it reachesNotImplemented. The Boehm collector in IL2CPP uses it to stop the world, so a Unity title ends insideil2cpp_init. I deliver it with a host signal (SIGUSR2,SA_NODEFER, handler on the target thread's own stack, registers copied into the guest context and back).std::thread::native_handle()is gone once a thread is detached, so thepthread_thas to be kept separately.6. Two costs that only show with many shaders.
Structurizer::computeDominatorTreeandcomputePostDominatorsintersect sorted vectors until nothing changes, and the analyses are recomputed after each structurizing step. On the UE4 title that was most of a six-minute start; the same fixed point on bit rows brought it to under three minutes, with identical results on 8,000 random graphs andagc_structurizer_testspassing. Separately,PrepareRegisteredbuilds and structurizes a graph for each registered shader and does not use it, so the work is repeated even when the artifact comes from the disk cache.One more observation, not a fix:
mainnow ends the process on any draw it cannot execute. On MoltenVK that includes host gaps (thePerVertexKHRcase, depth bounds, array-slice colour views), so a title that used to run with one effect missing no longer starts. I keep the skip-and-report behaviour behind a switch on my branch. That is a policy question for @boykopovar, but it decides whether anything is playable on a Mac for now.I can put any of these on a branch in my fork as separate commits if that is easier to read than prose.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by morten-holm on 2026-10-10T07:59:29Z.
@mugurc a finding from running
macos-port(e9db5ebf) that may save you some debugging.Symptom: on my runs, roughly half of the launches under Rosetta 2 died early with a SIGBUS (
KERN_PROTECTION_FAILURE), and the other half ran normally.Cause:
MacOsImage.cppwritesMH_PIEfor executables, but the image is linked at a fixed base (__PAGEZEROup to0x140000000) and the guest assumes 16 KB pages. With the flag set, dyld slides the image by a multiple of 4 KB, and some of those slides break that assumption. Themprotect-slidework covers the pages that end up off a 16 KB boundary. Not setting the flag avoids the slide altogether.Fix: drop
MhPiefrom the header flags inMacOsImage.cpp:I checked it by clearing the bit in the relinked binary, and the random SIGBUS stopped. I also tested a version of this change against main's relinker, with a check in
test_macos_output.pythatMH_PIEis clear. It fails without the change and passes with it.I can't open a PR because intake is paused, so this is a comment. Take it however suits you. Whether the slide handling should stay as a safeguard is your call.
Separately: with #1686 (write watch) on top of
macos-portI measure about 27 fps steady state, compared with about 12–15 before it. That is from MoltenVK's frame counter only, and I haven't checked the picture on that run.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-10T09:33:11Z.
Thank you all, this is exactly what the branch needed. #1597 (
relinker --macos) and #2247 (the Mach-O NID patcher) are merged, #2119 (--to-rosetta) is rebuilt on the newmain.macos-portis now at92d7098f; the last two changes on it come from your reports.@morten-holm you were right, and the slide fix I wrote was not enough. It only trimmed the part of a rounded range that no page backs. The guest rounds on the absolute address, so with a slide that is not a multiple of 16 KiB the end of a RELRO region, rounded up, reached into the writable data behind it in the same segment, made it read-only, and the first store there faulted. I reproduced it with a fixture (a 32 KiB data segment whose first page is made read-only, then a store into the second): it exits with SIGBUS on
e9db5ebf.40cabefdcounts the guest's pages from where the ELF address 0 of the image containing the range ended up, as the console does, so it also covers the modules, which dyld slides as well. 150 launches over all four slides give the right result.MH_PIEstays set for now; clearing it would only help the executable.@Cloud-Multiplayer thank you for the list.
92d7098f:sceKernelGetModuleInfoForUnwindfillseh_frame_addrandeh_frame_sizefrom theeh_frame_hdrthe image keeps in its program headers (a fixture with one CIE exits with 16, and with 0 before), andsceSysmoduleGetModuleInfoForUnwindanswers frommach_vm_regionanddladdrinstead of opening/proc/self/maps. I left the throw for an address it does not know as it is: that behaviour is shared with Linux and Windows.macos-port(_NSGetExecutablePath) but not onmain.sceKernelRaiseExceptionis stillNotImplementedoutside Windows onmacos-port. I have not looked at it yet.@mrzacarias thank you for running Balatro. I'll look at your packager commits (the
app0link and the saves in Application Support) and take them if they apply.These fixes cannot be PRs from me for now: I have three merged PRs and the limit is 20. They stay on
macos-portuntil @boykopovar says how they should come in.Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-10T11:19:58Z.
M2 (8 GB, macOS 26.7.1 25G313, Rosetta, Apple clang 21.0.0, CMake 4.2.3, Vulkan SDK 1.4.363.0 / MoltenVK 1.4.2),
macos-portat92d7098f.Branch as is
libs: clean. ctest without a loader: 509 tests, 296 pass, 211 skip, 2 not passed.patched_librariestimes out at 120 s under--parallel 8; alone it passes in 66 s.guest_tcpaborts in 21 of 80 runs. Every abort is the check after the peer closes. The loop always ends with -1 after 19 to 32 sends, never 100, but errno is 54 (ECONNRESET) instead of 32 (EPIPE).shader runtime requires nullDescriptor(needs #2015).With #2015 on top (cherry-picked; four one-hunk conflicts: the test list in
libSceAgcDriver/CMakeLists.txt, thebufferInt64Atomicslines inVulkanDevice.cppandContext.hppthat the branch does not have, andTechnicalDebt.md)-j1 --timeout 30, withoutlds_atomics64andguest_video_out_wqhd_detection: 209 run, 166 pass, 27 skip, 16 fail.vop1_float_unary, which fails on the M2 on every run (4 of 4):lane 6 exp_f32 v4 is 0x00000000, expected near 0x00800000.DOOM PPSA99666 v1.1.1 (catalog ZIP, sha256 checked,
eboot.binandsce_module/libc.prxunwrapped from their SELF containers)package_macos_app.pyand the relinker disagree on the guest module path. The executable loads@executable_path/app0/sce_module/libc.prx.guest.prx; the packager putsebootinContents/MacOSandapp0inContents/Resources/game. dyld stops at launch withLibrary not loaded. A symlinkContents/MacOS/app0 -> ../Resources/game/app0gets past it. Any title with a bundled module is affected.--macostoo:GuestModuleBuildertakes the non-Windows path. A/B with the same libraries, only the relinker differing:[notification]lines,/app0/test.cfgopened with a garbage mode,doom1.wadnever opened, exit 0 after 7 s;GuestModuleBuilder.cppchange (applies cleanly): debug text is printed,doom1.wadopens, the device and swapchain are created, and the shareware demo loop runs at 23 to 28 FPS (window title counter, 996 frames).gpu: frame 1 never completed, thenvideo: GPU presentation failed, switching to the CPU scaler. Second launch with the cache warm: neither line./download0does not exist in the bundle's game folder:cannot write /download0/doom.log (errno 2).AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Bruggi-ch on 2026-10-10T19:16:47Z.
Short report from a base Apple M5 (MacBook Air) on current
main. Most results above are onmacos-port; this one covers only what is already inmain.Setup
softwareupdate --install-rosetta)mainat1476f769Relinker-only build (
-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON, native arm64)ctest: 91 of 91 passedWrite watch and register context (as described in BUILD.md,
-DCMAKE_OSX_ARCHITECTURES=x86_64, run under Rosetta;fileconfirms an x86_64 Mach-O binary)write_watch_tests: 5 of 5 passed.write_watch_threadstook 3.75 s (relevant to #2846 and the 30 s CI limit).register_context_tests: 3 of 3 passed. The build prints two-Wreturn-type-c-linkagewarnings fromlibc/include/General.hpp(ResolvePath_nid_no_patch,WrittenPaths_nid_no_patch). They do not affect the result.Not tested:
macos-port, the full build,libs, GPU tests with MoltenVK, or any title. This only covers the macOS parts that are already inmain.I can run
macos-port(92d7098f) next on this machine if a macOS 27 / M5 data point is useful. Tell me if a specific test or configuration is more helpful.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Bruggi-ch on 2026-10-10T19:43:16Z.
Follow-up from the same base Apple M5 (MacBook Air, 32 GB, macOS 27.0.1), now on
macos-portat2861c1a, x86-64 under Rosetta, Apple clang 21.0.0, CMake 4.4.4, Vulkan SDK 1.4.363.0 (MoltenVK 1.4.2, from the LunarG installer).Build and tests without a Vulkan loader
ninjaandninja libs: no errors, 2 min 40 s.ctest -j4 --timeout 180: 510 tests, 299 passed, 211 skipped, 0 failed, 56 s.patched_librariestook 30 s, the slowest.Flaky tests, 50 sequential runs each
guest_tcp: 47 passed, 3 aborted.host_thread_local: 49 passed, 1 aborted.GPU tests through MoltenVK, with #2015 on top
I cherry-picked b288aa84 (#2015) onto
macos-port. It conflicted inlibSceAgcDriver/CMakeLists.txt,VulkanDevice.cpp,Context.hppandTechnicalDebt.md, as DavidSamir described. I kept only the placeholder-image parts and dropped thebufferInt64Atomicslines, which this branch does not have.ctest -j1 --timeout 30, withoutlds_atomics64andguest_video_out_wqhd_detection: 509 tests, 469 passed, 25 skipped, 15 failed.Failures, with the first message each test printed:
-0.0becomes+0.0:f32_denormal_flush,f32_output_modifier,packed_alu,sdwa_float_selectors.buffer_unaligned_base:64-bit buffer atomics need shaderBufferInt64Atomics. I did not check whether my conflict resolution affects this.prepared_shaders,_indirect,_uncached,_debug:storage image multisampling is unavailable on the target device.lds_src2: Metal compute pipeline compile failed (VK_ERROR_INITIALIZATION_FAILED).pixel_interlock: Metal shader compile error,type 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'.exec_host_lanes,interpolation_f16,many_buffers,ngg_vertex_wave_info: failed (causes in the update below).vop1_float_unarypassed here. Zheorgyan and DavidSamir report it failing on M1 Pro and M2.Not tested: any title, and the two excluded GPU tests.
AI-assisted: yes (Claude Code)
Update (10 Oct): the four failures listed above as "not analysed", now with the first message each prints:
agc_driver_ngg_vertex_wave_info:AGC graphics: subgroup capability 61 is unsupported for shader stage 1. This is the same cause asexec_host_lanes. #1565 fixed that test, butNggVertexWaveInfo.cppon currentmainhas no matching skip. I applied the same check there (SubgroupStages()has no vertex bit, skip) on top of #1565's getter, and on the M5 the test then skips instead of failing. I only ran this one test, not the whole suite. I found no open PR for it.agc_driver_interpolation_f16:ShaderRecompiler::Recompile: 64-bit float instructions need the Float64 capability, which the device lacks. The other tests that needshaderFloat64skip on Apple GPUs, but this one fails instead. I have not checked why it needs 64-bit floats, so I do not know whether a skip is the right fix. I found no open PR for it.exec_host_lanesandmany_buffersfail onmacos-portonly because it does not have #1565 and #1580 yet.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-11T10:39:41Z.
The open-PR rule changed this morning, so I can send the rest of the port as PRs now.
mainhas no macOS full build or guest start yet, so I will start with the foundation, one topic each: (1) the macOS build, (2) Mach-O guest TLS, image registration and starting the guest on the main thread, (3) memory protection andVirtualQuery, then unwind information, the write-watch consumers, the MoltenVK shader/driver changes, and last the fixtures and the app packager. I will comment here before each one. @boykopovar if you would rather have a different grouping or fewer PRs at once, tell me.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-11T10:53:37Z.
@boykopovar a question before I send the macOS runtime as PRs. The libraries (not the relinker) are built on macOS by no job, and
maingains code that only compiles on Linux every few hours. In the last 12 hours alone:feof_unlockedandgetc_unlockedcalled as::name(they are macros on macOS),ppollandPOLLRDHUP,ucontextregister names insceKernelRaiseException, aconstexpr int SIGUSR1, and assembly that names C symbols without the Mach-O underscore. A macOS PR is therefore broken again before it is reviewed, and the next one after it.Would you accept a
macosjob inbuild.ymlnext tolinuxandwindows, with the same triggers (push tomainand manual dispatch):macos-15-intel, configure,cmake --build build,cmake --build build --target libs? It would only build, with no tests at first, and PRs would not wait for it. The first PR would add the job together with the code it needs to build today. That is about 95 files and 1.6k lines, mostly#ifdef __APPLE__branches, because libkernel's thread code references the Mach-O TLS and main-thread files; I cannot split it further without leaving the build broken in between. The runtime fixes (memory protection, unwind information, write watch, MoltenVK) would follow as small PRs that the job keeps honest.If you would rather not have a macOS build in CI, I will keep the port on my fork and send only what the existing jobs cover.
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-11T11:00:28Z.
Update from a local Apple M2 (16 GB) test on macOS 27.2. The x86-64 guest runs under Rosetta 2 and uses Vulkan through MoltenVK 1.4.2. I tested my legally owned Vampire Survivors PS5 build, v1.16.107 (64958772R), using a local macOS worktree based on
197ffac97203d715a258a28b432fa2eedbf8be6f.The game opens a black loading screen with a chest icon in the lower-right and responds to keyboard input, but it has not reached the menu or gameplay. A passive runtime probe found the
SystemPlatforminstance present while its account pointer remained null andCurrentPlatformremained zero for 80 seconds. The observed game initialization path assigns those fields only afterPS5Accountconstruction returns. This points to incomplete account/platform initialization as the preloader gate; the exact constructor call or failure is not yet known, and this does not establish that PSN or offline account emulation is the cause.I also traced a shutdown crash to queued audio output relocking a mutex during teardown. A local AudioOut shutdown fix and regression test pass on this Mac; the regression fails against the old implementation, and closing the game window then exited normally. This change has not been submitted upstream.
These are local results from the cited worktree base, not a claim about current
main. The game is not playable yet.Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-11T11:12:23Z.
Follow-up to the loading observation: I ran a read-only x86-64 Mach thread-state sampler under Rosetta for 120 seconds. It resolved the loaded IL2CPP image at the same base used by the account-state observer and successfully read 93,075 thread states across 1,200 sampling ticks. The account remained null and
CurrentPlatformremained zero throughout. No sampled instruction pointer landed in the selectedSystemPlatform.Initialize,PS5Accountconstructor /InitNpSystem, preloader account-wait, orPlatformIntegrationmethod ranges.This is a non-detection at 10 Hz, not proof those methods never ran; brief calls can fall between samples, and execution in a native callee would be outside these managed ranges. The exact stall/cause remains unidentified. The probe only reads thread state and does not suspend or modify guest memory.
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-11T11:49:34Z.
Further startup trace from the same local M2 worktree (based on
197ffac97203d715a258a28b432fa2eedbf8be6f); no game files or dump artifacts are attached.I followed account creation into
PSNAccount's synchronousUnity.PSN.PS5.Main.Initializecall. Before it startsUserSystemor publishes the account,Main.Initializecalls the dynamically resolvedPSN_PrxInitializeentry and checks its result; the nonzero-result path throws. It then callsPrxIsSystemEventQueueInitialized; a false result registers the system-service event handler and continues. The remaining initialization starts user and other PSN services. This gives us a narrower startup boundary than the previous account-null observation, but the dump does not identify the final native targets of those two resolved calls or prove that either is blocking/failing at runtime.A fresh bounded run still did not reach the game menu or gameplay. The exact runtime stall remains open; I have not changed account readiness or bypassed this initialization path.
Imported from boykopovar/AnyPS5. Originally posted by jeank93 on 2026-10-11T13:46:24Z.
I found this fork for macOS
https://github.com/RINNECODER/AnyPS5
Imported from boykopovar/AnyPS5. Originally posted by mrzacarias on 2026-10-11T22:30:10Z.
Edit: found the cause, fix in #4465. Earlier versions of this comment chased wrong leads (write watch, vertex format 47); rewritten below.
@krishalivaibhav possibly related to your Vampire Survivors loading screen: Vampire Crawlers PS5 showed the same symptom here (black screen, loading icon in the lower-right). Setup: M1 Pro, native arm64 through the FEXCore runner,
mainata11c8f7f7plus #3703.Cause: every frame the game clears its 1080p UI canvas HTILE with a variant of the 16-byte fill kernel. This variant loads its pattern with
s_buffer_load_dwordx4through the V# ins[4:7]instead of taking it from the user SGPRs:matchesFillKernelonly knows the user-SGPR form, so the kernel ran as a shader and the depth surface never saw the fast clear. Every UI draw (reverse-Z,GEQUAL) then failed against depth left over from earlier frames. The 3D scene rendered fine into its 800x600 target the whole time; only the canvas that composites it stayed empty.Fix (#4465): recognize the variant and read the pattern from the buffer, so the existing HTILE/DCC-key fill handling applies. With it, the game renders and plays. Side note for anyone debugging something similar:
APS5_IGNORE_DEPTH_TESTonly affects draws without a depth target, so it doesn't rule depth out for draws that have one.Unrelated gap: nothing outside the tests calls
GuestWriteWatchProtectionChanged, so a guestmprotecton watched memory leaves the macOS watch with stale state.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-11T23:50:53Z.
@mrzacarias on your last point: the
macos-portbranch (https://github.com/mugurc/AnyPS5/tree/macos-port) callsGuestWriteWatchProtectionChangedfromDoMprotectinDirectMemory.cpp, so a guestmprotecton watched memory updates the macOS watch there. Onmainit is still only called from tests, as you saw; it goes in with the memory-protection PR.Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T07:24:54Z.
macOS/M2 compatibility investigation update: Vampire Survivors (PPSA21703) now reaches gameplay in our local experimental AnyPS5 build. The tester reports working controls, with enemy sprite corruption and character afterimage trails still present. This is not a stock-main compatibility claim: the local branch includes multiple macOS runtime fixes and the shader prototype described below (base
197ffac).Hardware/runtime: Apple M2, 16 GB unified memory, x86_64 guest/runtime under Rosetta 2, MoltenVK 1.4.2. Geometry shaders are unavailable; tessellation is available. We retained the MoltenVK native-barycentric guard from #1653.
The reproducible graphics blocker was
Barycentric geometry SPIR-V: geometry shaders are unavailable. The failing draw was a direct indexed triangle list, 12 indices, two per-vertex parameters. A local TCS/TES fallback uses three-control-point patches at tessellation level 1 to preserve triangle corners, generate barycentric weights, and forward per-vertex parameters. It is restricted to direct triangle lists without restart, complete triples, and first provoking vertex; geometry-capable devices retain the existing path.Rendered tests on M2 passed perspective and linear barycentrics (932 reference pixels each), raw per-vertex values, indexed vertex reuse, and culling compared with the ordinary triangle pipeline. That comparison caught reversed winding; the prototype was corrected before integration. A bounded retail probe then ran for 90 seconds with 2,964 fallback draw records and no previous unavailable-geometry presentation abort. The subsequent human gameplay report is separate from those automated tests.
For the rendering artifacts, a single-variable comparison with
APS5_NO_RECORDED_CLEAR=1improved both enemy glitches and trails according to the tester. DCC/upload traces show repeated clear recognition on an 810x456 render target, so completely missing clear detection is not established. Inspection of the recorded fast-clear upload path found transfer-to-general destination access masks covering shader accesses but omitting color-attachment reads/writes needed by LOAD/blending. We have a local candidate adding attachment and transfer-read access scopes; it compiles, but its visual comparison and focused regression are still pending. This is a synchronization hypothesis, not a confirmed complete fix.No game assets or dumps are attached. We will share a focused patch/test once verified; remaining work includes clear/load/blend regression, broader textured/clipped fallback coverage, and checking overlap with current upstream changes.
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T07:56:53Z.
Gameplay follow-up: the tester reports normal enemy sprites and expected character trails after the local barrier candidate with asynchronous clears. The human validation run exited normally (177 seconds), and the focused GPU clear/LOAD/blend fixture passed 12 iterations on M2.
A subsequent longer/manual recording run exposed a separate blocker:
AGC graphics: subgroup capability 61 is unsupported for shader stage 1(GroupNonUniform in the vertex stage). The process aborted after approximately 64 seconds. This means gameplay is demonstrated, but sustained-session compatibility is not yet established. There is no evidence that screen recording caused the failure. We are investigating whether the shader has live subgroup operations or unnecessary declarations; we will not bypass the device capability check.The uploaded-code PR covers only clear synchronization. The local game build additionally includes experimental macOS runtime and barycentric fallback changes. A gameplay recording has been captured locally and will be attached separately.
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T10:34:36Z.
Further M2 gameplay debugging: we captured a valid vertex SPIR-V module that requests subgroup ballot support. The relevant IR ballots a predicate and then extracts that same invocation’s bit; a narrowly matched identity can replace this with the original predicate. A separate conservative uniform-branch proof also needed to recognize logical negation. A local Vertex-only candidate passed the full shader-memory regression fixture, with negative tests for foreign lanes, changed chunks, intervening EXEC changes, cross-block uses and other stages. No device capability checks were bypassed. This shader candidate is not yet published or established as a complete stability fix.
The next human gameplay run reached death without the previous subgroup rejection, but crashed with SIGSEGV instead. Offline crash analysis points to guest allocator free-list removal with an invalid previous-node pointer (-1), yielding address 0x17. The origin of that corruption remains unknown; runtime writes, earlier graphics writes and lifetime/race problems are hypotheses, not diagnoses. We are preserving the crash evidence and planning a first-writer investigation. This is separate from the recorded-clear synchronization code in #4362.
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-12T12:33:38Z.
The macOS build I described above will not go in as one pull request. Main changes faster than a 1,600-line change can be reviewed (49 of the 135 files it touches changed on main in the last day), and a pull request is one topic. It goes in as single-topic pull requests, at most six open at a time, each announced here as it opens. All of it is already on https://github.com/mugurc/AnyPS5/tree/macos-port (that branch is the integrated state: the full build,
ninja libsandctestrun on macOS 26 under Rosetta).Order:
build(macos)configure for x86-64,fix(libc)host-facing code,fix(libs)Mach-O assembly symbols,fix(libs)libc++ differences, then the libkernel host APIs: direct memory, files and directories, process/thread/clock queries, UDP sockets and DNS,sceKernelRaiseException, kqueue/kevent, module and unwind information.sceKernelVirtualQuery. The relinker that is already in main emits calls toAps5GuestTls*andAps5StartGuest; nothing incore/libsprovides them yet, so a relinked macOS executable cannot run on main today.Left out because others have them open: the lookup of the executable path (#4014, #4019). #3891 carries most of these changes as a draft; as they land its diff shrinks, and a hunk that is already in main drops out on its next rebase.
The question about a compile-only macOS job in
build.ymlstays open; it would be the last pull request of the series.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-12T17:04:05Z.
Opened: #4626, #4627, #4628, #4629 and #4630 (after #4628).
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-12T17:04:06Z.
Correction to the list above: kqueue/kevent is not part of the series. #3764 implements kqueue, kevent and file events for every host, and a macOS-only passthrough would collide with it. Once #3764 is in, I will check what macOS still needs for the file events and send only that.
Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-12T17:59:44Z.
macOS build and test report — Apple M4 (Mac mini), x86-64 runtime under Rosetta 2.
Environment
mugurc/macos-portatde3ef5d53("fix(macos): build and test the code main added since the last merge").Full build (
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON): 2971/2971 targets.core/libs/libsholds 124.prx, eachMach-O 64-bit x86_64.Relinker-only build (
-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON): 116/116 tests pass.ctest --test-dir build --output-on-failure: 897 registered, 555 pass, 0 fail, 342 skipped. Every skip is Vulkan- or display-dependent, all with a single reason:skipped, no usable Vulkan device: AGC graphics: cannot load Vulkan.video_out_flip_*andguest_video_out_*:skipped, no display or Vulkan device.No x86-64 Vulkan loader or MoltenVK is installed here, so the GPU tests skip by design; installing the LunarG Vulkan SDK (x86-64 or universal loader plus MoltenVK) would enable them.
Result: the integrated port builds and its non-GPU test set passes on an independent machine (macOS 26.6.2 / AppleClang 21 / CMake 4.4.4). GPU coverage was not exercised on this run.
Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-12T18:31:13Z.
Follow-up — GPU tests on the same machine.
Installed the LunarG Vulkan SDK 1.4.363.0 (universal) and ran the AGC tests with MoltenVK under Rosetta (device: Apple M4, subgroup 32).
Environment note: Rosetta drops
DYLD_*when a native arm64 process starts an x86-64 one, but ctest (arm64) forwards its environment to the x86-64 test children, soexport DYLD_LIBRARY_PATH=<sdk>/macOS/lib VK_DRIVER_FILES=<sdk>/macOS/share/vulkan/icd.d/MoltenVK_icd.json && ctest ...works.ctest -R "^agc" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64" -j1 --timeout 30(window-opening tests left out): 415 selected, 349 pass, 22 fail, 44 skip. All 22 fail again on a re-run.The 22 failures:
Missing device capability (MoltenVK):
agc_driver_f32_dot2_rounding:64-bit float instructions need the Float64 capability, which the device lacks.agc_driver_ngg_vertex_wave_info:subgroup capability 61 is unsupported for shader stage 1.agc_driver_pixel_interlock:[mvk-error] VK_ERROR_INITIALIZATION_FAILED: Fragment shader function could not be compiled→vkCreateGraphicsPipelines: Vulkan result -3.Float rounding / denormal flush:
agc_driver_f32_denormal_flush,agc_driver_f32_constant_factor_tininess,agc_driver_f32_output_modifier,agc_driver_float16_rounding,agc_driver_float16_fma_rounding,agc_driver_dpp16_operands,agc_driver_packed_alu,agc_driver_sdwa_float_selectors. Example:f32 denormal flush: lane 0 no float mode v_mul_f32 ... is 0x00000000, expected 0x80000000.Blend into a render target:
agc_driver_alpha_to_coverage,agc_driver_dual_source_blend,agc_driver_packed_unorm_color_target,agc_driver_srgb8_color_target,agc_driver_swap_alt_blend.Texture / storage:
agc_driver_array_layer_target,agc_driver_dcc_keys_first_write,agc_driver_depth_compare_copy,agc_driver_storage_one_slice_alias.Other:
agc_unchanged_cpu_stamps(write watch),agc_driver_prepared_shaders_registered_workgroup_sync(expected preparation failure).These are failures, not device-limit skips:
tools/check_skips.pyonly accepts a skip when the test reports the limitation it needs, so this coverage is lost silently on macOS. The first group matches the MoltenVK gaps already listed here; the float, blend and texture groups may be the same kind of backend divergence or a real difference worth a closer look.Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-12T19:32:30Z.
Video-out tests: the three
guest_video_out_*tests still skip on macOS:skipped, no display or Vulkan device: DisplayWindow: NSWindow should only be instantiated on the main thread!The video-out window is created on the presenter thread through
OnMainThread→Aps5RunOnMainThread_nid_no_patch, which runs the call in place while the main loop is not running (MainThreadMacOs.cpp). These tests callsceVideoOutOpenfrommain()and never callAps5StartGuest, so SDL creates the NSWindow off the main thread.libSceVideoOut/tests/Flip.cppalready avoids this by running its body insideAps5StartGuest_nid_no_patch. Wrapping the three tests the same way would let them run. The flip and display tests were left out of this run (they open windows).Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T19:51:18Z.
https://github.com/user-attachments/assets/72689cdd-fa61-4565-97ec-69dbc7f69168
M2, 16 GB RAM, modified local AnyPS5 build. Gameplay works; a later vertex-subgroup crash remains under investigation.
(quality degraded due to compression).
;-;
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T23:19:35Z.
Coordination note for the macOS series (#4626/#4627): we diagnosed and fixed a shutdown hang in our unpublished local macOS guest-startup shim while testing Balatro on an M2. This is not evidence that the same defect is present in current main or those PRs.
Our old startup adapter cleared the incoming loader-cleanup register (RSI on x86-64, X1 on ARM64). The guest entry unconditionally registered that null callback with
atexit, then registered its executable finalizer. LLDB captured the second registration reusing the still-linked callback-zero slot; linking it to the existing head would create a self-link. Normal exit subsequently looped through that finalizer node.The local fix supplies a valid callable loader-cleanup adapter instead. Darwin retains ownership of native Mach-O image lifecycle; this does not claim general handling of converted ELF
DT_FINIarrays or replace guest finalization with forced termination.Validation:
Sharing this as a startup-ABI integration detail for the macOS series. We can isolate the synthetic regression and adapter change if useful; no Sony game code or assets would be included. Long-session stability and other graphics failures remain separate work.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by itar3 on 2026-10-13T00:30:12Z.
could you do a step by step guide how did you make run please?
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-13T04:44:22Z.
@itar3 Yes — here is the procedure behind that recording, with the current reproducibility limit stated up front.
The video is Vampire Survivors (PPSA21703) on an Apple M2 with 16 GB, using a modified local AnyPS5 build. The complete recording build is not a published branch yet. Cloning current
main, applying only #4362, or using the native Metal fork will not reproduce this particular run. Below I distinguish the steps we actually performed from commands that require that integrated source first. Gameplay was observed; stable long sessions and 60 FPS have not been established, and a later vertex-stage subgroup failure remains under investigation.1. Use the same execution path
Our run uses the AnyPS5 relinker to produce an x86-64 Mach-O executable and converted guest modules. Rosetta 2 runs that CPU code on Apple silicon. AnyPS5's replacement libraries implement the guest system interfaces; graphics go through Vulkan/MoltenVK to the Apple GPU. The recording did not use the separate ARM64/native-Metal runner.
Host: macOS 27.2, Apple Command Line Tools / Apple clang 21; local build: CMake, Ninja, Release, x86-64. SDL and the shader dependencies are built from the repository's submodules. The recorded GPU runtime was MoltenVK 1.4.2. The loaded MoltenVK library must contain an x86-64 slice; an ARM64-only Homebrew dylib cannot be loaded into this x86-64 process. Check the actual file you intend to use:
Use Rosetta and the macOS compiler tools installed on the machine. Our GPU log identifies Apple M2, rather than a software Vulkan device.
2. Obtain a complete, decrypted game directory
The input needs the executable, guest modules,
sce_sysmetadata and game assets from your own dump. An encrypted package, justeboot.bin, or a PC edition is not the input we tested. Keep the original directory unchanged and create a separate converted runtime directory.3. Obtain the matching integrated source before building
The recording came from local source based on
197ffac97203d715a258a28b432fa2eedbf8be6f, with additional uncommitted integration fixes. That SHA alone is not the recording build.The stack includes macOS guest startup/TLS and module loading, unwind/module information, Darwin executable-path and descriptor handling, shader fixes, a tessellation fallback for unavailable fragment barycentric operations, and window/audio teardown work. Some stages are now represented by upstream changes, but this entire combination is not available as one verified public checkout. The public macOS series begins with #4626/#4627; its author explains that the series must be taken together. Those two PRs alone do not supply every game-specific blocker we passed.
Our recorded-clear change #4362 has merged. Its final scope is alignment of clear-path access masks; the recording is not proof that those two lines alone make the game boot or that a live barrier race was reproduced. The non-discriminating fixture was removed before merging.
This source/conversion packaging is the remaining prerequisite for an exact public reproduction. I am documenting it rather than suggesting that an arbitrary set of open PRs is a tested installation recipe.
4. Build that source as x86-64 Release
Once the matching integration source and submodules are available, the equivalent build configuration is:
We limit build parallelism to two on this 16 GB Mac and do not run a game during a heavy build. Use the NID-patched runtime packages from
build-macos/core/libs/libs, not theunpatchedintermediate libraries. Preserve the source SHA, local patches and submodule revisions alongside the build.5. Relink the executable and every needed guest plugin
This is more than converting the executable. Our saved conversion used a local helper to construct a coherent dependency graph for the game's PSN plugin, SaveData plugin, CommonDialog plugin and
lib_burst_generatedmodule, together with separate Mach-O module-writer/runtime changes that forward module-start arguments. Those dependencies must be represented consistently in the converted modules; copying the original ELF plugins into a Mach-O run directory does not perform that conversion.The helper is not yet packaged as a public replay recipe. I cannot honestly give a single stock CLI command as an equivalent to that conversion. The relinker's
--helpdescribes the public macOS conversion options, but the helper/dependency staging also needs to be published before another person can reproduce this step exactly.6. Assemble the converted run directory
Our layout is conceptually:
Keep the guest module paths expected by the game. The converted executable searches
@executable_path/libs. Run fromrun/so relative asset lookups resolve correctly. Do not mix libraries from different integration builds.7. Select the x86-64 MoltenVK library explicitly
We used a
libvulkan.1.dylibalias pointing to the actual MoltenVK dylib. With that alias and the complete run directory in place, the essential launch environment is:Our local launcher additionally stages the converted plugins and selected freshly built libraries, restoring them afterward, and inserts a loader-error observer for diagnosis. That observer collects loader errors; it does not translate game code. This shell command describes the final launch environment after the unpublished conversion/integration steps, not a turnkey command for stock
main.8. Verify the environment before interpreting a black screen
Check the log for the selected Apple GPU, missing imports, module-loading errors and shader failures. For GPU tests, pass the same loader environment and inspect whether CTest passed, failed or skipped; a successful CTest exit with GPU fixtures skipped is not graphics validation. First boot and first shader compilation can be slower than subsequent runs.
9. Test gameplay and keep the evidence scoped
Focus the window, wait through loading, start a run and verify input and visible rendering. Our human tests reached gameplay and reported the corrected player trails/enemy sprites in the tested run. Longer runs also exposed crashes, including vertex-stage subgroup handling; we have not marked the game fully compatible or performance-complete.
When reporting another run, include the exact source/patch set, game version, macOS version, GPU, MoltenVK version, launch command, elapsed time and log/crash report. A gameplay video is useful evidence of that session, but does not replace those details.
10. What is available now
You can follow the public macOS work in this issue and the linked PRs. The exact local integration and plugin-conversion helper still need to be made reviewable and reproducible before I can offer a tested clone/build/run guide. The recording should be read as progress on that modified stack, not a claim that every Mac or the current default branch already runs this title.
AI-assisted: yes. The procedure and limitations were checked against our saved launcher, build configuration and run records.
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-13T07:26:20Z.
A scoped update on the three games we have been testing on Apple M2 / 16 GB. These results are from a modified local x86-64 AnyPS5 runtime under Rosetta with MoltenVK, not a clean-main compatibility claim.
Vampire Survivors (PPSA21703): human-verified gameplay and the recording above. The complete path includes macOS startup/TLS and module loading, coherent conversion of dynamically loaded plugins and forwarding their startup arguments, unwind/descriptor/path handling, shader compatibility work, and a restricted tessellation fallback for unavailable fragment barycentric operations. Longer sessions have exposed a vertex-stage subgroup failure. The step-by-step account, commands and unpublished prerequisites are here: https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6138415359 . We have not established stable completion or 60 FPS.
Balatro: human-verified menu/tutorial gameplay, with low FPS and stuttering still reported. We isolated bounded direct-index reads and submitted #4824; it contains that generic packet/index-fetch fix and a protected-page GPU regression, not the whole local Mac integration. It remains a draft while Linux/Windows CI is requested. We also reproduced a separate macOS startup/exit bug: a null loader-finalizer callback could lead the guest CRT's callback list to self-link. A callable no-op loader finalizer fixes the local regression, and the user subsequently confirmed Command-Q closes promptly; details and limitations were reported here: https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6134481555 . An intermittent command-buffer failure and sustained performance remain unresolved.
Don’t Starve Together (PPSA02070): the latest local candidate reached a menu that the user could interact with, beyond the previous logo/viewport rejection. It is still laggy. This run later aborted after 126 seconds with
mutex lock failed: Invalid argument; the crash report points to path resolution on a guest thread, and teardown/lifetime investigation is pending. No world/gameplay or stable-session claim yet.For the depth blocker, captured draws had an outside-legal-range
0..2viewport, D32 depth writes, ALWAYS comparison, and a fragment shader with early tests/discard. We are evaluating the construction related to #4650 in the generated final barycentric TES: transform final position depth affinely, emit clip distances from the original position to preserve the original near/far planes, use native depth clamp with a legal0..1viewport, and retain the original fragment shader. This is one draw, so it avoids doubling fragment work or query counts. Admission is restricted to proven guest clamp bounds, supported device features and the tested state; unsupported configurations retain explicit rejection.Private synthetic M2 GPU evidence checks real depth/color readbacks, unequal homogeneous W, both source clip conventions, discarded-pixel depth writes, subsequent LESS draws, and precise occlusion counts. Ordinary viewport normalization, per-vertex saturation, late-depth discard and missing clip planes are discriminating controls. The final aligned clipping fixture passes at the original tolerance; an earlier non-grid clipped fixture missed a tight numerical tolerance even in its reference and remains saved as a limitation. This is useful semantic evidence, not broad game validation.
What our existing PRs contain: #4362 is merged and contains the recorded-clear access-mask alignment only; its non-discriminating fixture and fixed-race claim were removed. #3533 contains legacy AudioOut shutdown draining; another contributor reports Windows combined-build tests passing, which we do not treat as standalone approval. #4785 contains the net memory-pool diagnostic used while investigating missing imports. None of these individually contains or reproduces the entire gameplay stack.
Shared performance work: profiles and source review found generated barycentric TCS/TES bypassing the validation memo; we are testing reuse while keeping first-miss validation and completing the capability/state key. Generated stages also currently prevent a separate resource-cache path; that requires a deeper resource/key/revalidation audit before enabling it. Rendering-wait packets are charged to the NOP bucket and preparation timings include backpressure, so those aggregate wall times must not be mistaken for CPU translation cost. No measured FPS improvement is claimed yet, and we are not removing correctness checks or forcing a higher frame counter.
We are separating generic fixes and their regressions into reviewable contributions, and coordinating depth work with the existing proposal rather than treating the video as a complete code submission. The full pinned integration/conversion package is still a missing public reproducibility prerequisite. The macOS series and our local experimental additions should remain distinct when assessing what
maincurrently supports.AI-assisted: yes. User observations, independently reported platform tests, local regression/GPU evidence, and unresolved limitations are distinguished above.
Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-13T09:28:13Z.
lds_src2on Metal is already fixed onmainby7144bb57e, which spills oversized compute LDS to a storage buffer, it passes on the M1 Pro withmacos-portatb7eb6b6b. I closed #5043Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-13T10:36:11Z.
the blend, color target and storage failures 011010 listed on the M4 come from the macOS write watch. on the M1 Pro with
macos-portatb7eb6b6b,APS5_NO_WRITE_WATCH=1makessrgb8_color_target,packed_unorm_color_target,swap_alt_blend,alpha_to_coverage,dual_source_blend,array_layer_target,storage_one_slice_aliasanddcc_keys_first_writepass,depth_compare_copyneeds the watch.srgb8_color_targetpassed onc3affc1c, before the watch was in. the GPU result never reaches the watched guest memory,APS5_WRITE_WATCH_IMPORTSdoes not change it. I am looking for whereImported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-13T11:41:01Z.
found it, #5101. Metal keeps the protection a page had when it was imported, so a GPU store into an import made over write-watched pages is dropped, and the import probe only looked at the watch, not the data. with the probe checking the fill and the watch removed before such an import, the M1 Pro goes from 23 to 13 failing
agctests onmacos-port. @mugurc it is againstmain, the same change applies tomacos-portwith its olderImportWatchedImported from boykopovar/AnyPS5. Originally posted by itar3 on 2026-10-13T16:46:33Z.
in most of the games (all of them actually except of doom i get the same error - this one) i'm on a current macos-port
Imported from boykopovar/AnyPS5. Originally posted by Bruggi-ch on 2026-10-13T19:00:21Z.
GPU test results from a base Apple M5 (MacBook Air, 32 GB), to add a third Apple GPU next to the M1 Pro and M4 reports above.
Setup
macos-portatb7eb6b6b(the same commit @Zheorgyan used), x86-64 under RosettaDYLD_LIBRARY_PATHandVK_DRIVER_FILESexported beforectestninja libs: no work leftTests
ctest -E 'agc|flip|display|vulkan|gpu': 495 of 495 passed, 5 skipped, 51 sctest -R agc -E 'flip|display|lds_atomics64' -j1 --timeout 30: 434 selected, 326 pass, 22 fail, 86 skip. A second run gives the same 22.Compared with the M4 list from @011010 (also 22): 21 are the same. Two differ:
agc_driver_relative_ancillaryfails on the M5:SPIR-V requires unsupported device capability 2agc_driver_prepared_shaders_registered_workgroup_syncpasses on the M5 (it fails on the M4)The 21 shared failures are the MoltenVK gaps, the float rounding group and the blend/texture group.
ngg_vertex_wave_infostill sayssubgroup capability 61 is unsupported for shader stage 1,pixel_interlockstill fails to compile the Metal fragment function (type 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer').Write watch (relates to #5101)
I could not test #5101 itself: its commit conflicts with
macos-portinImportWatchedandGuestBufferMemory.cpp(the branch hasimportsStampPages), and I did not want to hand-port it. Instead I ran the same suite withAPS5_NO_WRITE_WATCH=1, as @Zheorgyan did: 22 → 14 failures. Fixed:srgb8_color_target,packed_unorm_color_target,swap_alt_blend,alpha_to_coverage,dual_source_blend,array_layer_target,storage_one_slice_alias,dcc_keys_first_write, plusunchanged_cpu_stamps(expected, the watch is off). That matches the M1 Pro result.Two side effects with the watch off:
depth_compare_copynow fails withthe guest block is not write-watched, andpixel_fixed_point_position, which passes normally, fails withAGC graphics: cannot allocate the color target.The Mac stayed stable through all runs. Logs are available if useful.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-13T20:20:13Z.
@Bruggi-ch for
macos-portatb7eb6b6bthe change is only this, inImportWatchedinGuestMemory.cpp, it applies without conflicts:on the M1 Pro it takes the same 10 off,
dcc_keys_first_writestays because that branch has no import window compare yetImported from boykopovar/AnyPS5. Originally posted by yripper on 2026-10-14T01:25:20Z.
Hi @mugurc, I've been running a parallel macOS port (Rosetta 2 +
--macos --to-rosetta+ MoltenVK) on https://github.com/yripper/AnyPS5/tree/feat/macos-runtime. God of War: Sons of Sparta (PPSA28997) is playable on an M1 Pro, at about 40–45 FPS in gameplay at 1080p. Most of my build and libkernel work overlaps your series, so I'd rather feed into it than open competing PRs. These are the pieces I haven't seen on your branches:shm_open(bus error), so the JIT backing is an unlinkedmkostempfile.EVFILT_VNODEbackend for the file-event code that uses inotify on Linux.mach_vm_regionreports watched pages as read-only, so the driver refused writable guest memory. It now asks the write watch for the logical protection.VK_KHR_portability_enumerationis present before enabling it, which may be worth adding to your MoltenVK device branch.NoContractionop as a call to a[[clang::optnone]]helper (spvFAdd/spvFMul). DroppingNoContractionin pixel programs onVK_DRIVER_ID_MOLTENVKtook the title screen's GPU time from 35.8 to 14.5 ms a frame.Happy to rebase these onto your PRs and mark them
Depends on:. How would you like them split?Imported from boykopovar/AnyPS5. Originally posted by Bruggi-ch on 2026-10-14T03:37:44Z.
@Zheorgyan thanks, that applies cleanly on
macos-portatb7eb6b6band I rebuilt with it (Apple M5, macOS 27.0.1, x86-64 under Rosetta, Vulkan SDK 1.4.363.0).ctest -R agc -E 'flip|display|lds_atomics64' -j1 --timeout 30: 22 → 13 failures (434 selected, same run as above).Fixed by the change (9):
unchanged_cpu_stamps,alpha_to_coverage,array_layer_target,depth_compare_copy,dual_source_blend,packed_unorm_color_target,srgb8_color_target,storage_one_slice_alias,swap_alt_blend.cross_workgroup_flagalready passed on the M5 before.Still failing (13):
dcc_keys_first_write(as you said),ngg_vertex_wave_info,pixel_interlock,relative_ancillary, and the float group (f32_constant_factor_tininess,f32_denormal_flush,f32_dot2_rounding,f32_output_modifier,float16_fma_rounding,float16_rounding,dpp16_operands,packed_alu,sdwa_float_selectors).Unlike
APS5_NO_WRITE_WATCH=1, this keeps the write watch on, sopixel_fixed_point_positionstill passes anddepth_compare_copyis fixed.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-14T05:14:29Z.
Follow-up to the MoltenVK
NoContractionperformance report above: I tested a strict alternative on Apple M2, without changing AnyPS5 or removing its SPIR-V decorations. This is a standalone MSL experiment, not a title fix.The comparison is
[[clang::optnone]]arithmetic helpers versus ordinary optimizable helpers, under#pragma clang fp contract(off)andMTLCompileOptions.fastMathEnabled = NOfor both:fmaoutputs as raw bits.0x6a09e667, raw-bit random values plus cancellation, signed zero, NaN/Inf, normal/subnormal and overflow cases), all four channels had zero bit mismatches, including NaN payload bits.a=b=1+2^-23,c=-(1+2^-22): both MAD outputs are zero; explicit FMA remains0x28800000(2^-46) in both kernels. Thus this sample did not silently turn MAD into FMA.abits0x3f000000 + (rng & 0x007fffff),bbits0x3f7ff000 + (rng & 0xfff),cbits0x35800000 + (rng & 0x007fffff)). Three interleaved command-buffer GPU timestamp samples per kernel, excluding compilation: helper baseline 1.536 / 1.562 / 1.531 ms; strict optimized 0.02846 / 0.02887 / 0.02813 ms. Output bits match. The ratio is about 54x for this deliberately arithmetic-heavy microkernel only.This supports investigating a translator-side replacement for the unoptimized helpers while retaining non-contraction semantics. It does not establish full SPIR-V equivalence, the behavior of texture/derivative/float-control operations, a speedup in Balatro or any other title, or 60 FPS. Our separate Balatro measurements locate most time in draw passes, but do not yet attribute that cost to these helpers.
Before a production change, I would test representative generated fragment MSL and the existing rounding-sensitive shader fixtures, preserving explicit FMA, then do a controlled title A/B. No new PR or production policy change from this experiment.
AI-assisted: yes (Codex); parent and low-reasoning agent checked the recorded method/results.
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-14T08:34:23Z.
@yripper thanks for the offer and the God of War report. The base is split into small PRs: #4627, #4629 and #4630 are open, #4626 and #4628 are merged. The next ones (direct memory, files, process/clock, sockets) wait for first reviews of those.
I have not started a kqueue backend for
FileEvent.cpp(the only host-specific file in the merged kqueue code), so you are welcome to open it. Please say so here first, so we do not duplicate.For the guest arena and the JIT shared memory: they touch the memory code I have staged (direct memory, memory protection), so could you describe the arena design in a short comment first? I will order my branches around it. The
VK_KHR_portability_enumerationcheck and the write-watch protection query are welcome as separate small PRs, each withDepends on:.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-14T08:38:00Z.
Opened #5735,
fix(libSceFiber): map fiber host stacks on hosts without MAP_STACK: a five-line fix inAllocateHostStack. @thuanquang found on #4628 that the macOS SDK has noMAP_STACK, solibSceFiber/Export.cppstopped compiling on macOS after #4265.Status of the series: #4626 and #4628 are merged; #4627, #4629, #4630 and #5735 are open.
Imported from boykopovar/AnyPS5. Originally posted by OleksandrS23 on 2026-10-14T09:04:40Z.
I'd like to take the kqueue backend for
FileEvent.cpp(nativeEVFILT_VNODE+EVFILT_USERstop, under__APPLE__). I'll test it withguest_kqueueon an M4 Pro, macOS 27.0.1, x86-64 under Rosetta. AI-assisted (Claude Code).Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-14T10:42:30Z.
@krishalivaibhav @yripper if those helpers get changed in SPIRV-Cross, note KhronosGroup/SPIRV-Cross#2704 touches the same
spvFMul:fma(l, r, 0)loses the sign of a -0 product, so it adds -0.0 instead. A replacement should keep thatImported from boykopovar/AnyPS5. Originally posted by Cipriamn on 2026-10-14T12:16:49Z.
macOS build and test report: Apple M3 Max, to add an M3-family GPU next to the M1 Pro, M2, M4 and M5 reports.
Setup
macos-portatb7eb6b6b, x86-64 under RosettaDYLD_LIBRARY_PATHandVK_DRIVER_FILESexported beforectest. x86-64vulkaninforeportsApple M3 Max, API 1.4.357..prx, eachMach-O 64-bit x86_64Tests without GPU (
ctest -E 'agc|flip|display|vulkan|gpu' -j8): 495 selected, 490 pass, 5 skip.patched_librariestimed out in the parallel run at the 60 s limit and passes alone in 35 s. Skips:guest_amm_placement(guest arena is Linux/Windows only),video_out_frame_dump_queue(SDL offscreen driver has no Vulkan), and the threeguest_video_out_*tests below.GPU (
ctest -R agc -E 'flip|display|lds_atomics64' -j1 --timeout 30): 434 selected, 368 pass, 22 fail, 44 skip.The 22 are the same 22 as on the M5.
relative_ancillaryfails as on the M5 (SPIR-V requires unsupported device capability 2), andprepared_shaders_registered_workgroup_syncpasses as on the M5.With @Zheorgyan's
ImportWatchedchange applied locally: 22 → 13, the same 13 as on the M5 and M1 Pro:ngg_vertex_wave_info:subgroup capability 61 is unsupported for shader stage 1pixel_interlock: MoltenVK MSL compile error,type 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'relative_ancillary: capability 2f32_dot2_rounding: needs Float64f32_constant_factor_tininess,f32_denormal_flush,f32_output_modifier,float16_fma_rounding,float16_rounding,dpp16_operands,packed_alu,sdwa_float_selectorsdcc_keys_first_write, as expected, since the branch has no import-window compare yetSkip reasons: no
shaderBufferInt64Atomics, noshaderFloat64, no graphics pipeline libraries.guest_video_out_*: with a Vulkan loader present,guest_video_out_wqhd_detection,guest_video_out_resolution_statusandguest_video_out_output_modeskip withDisplayWindow: NSWindow should only be instantiated on the main thread!, as @011010 reported on the M4. Without the loader they skip earlier, atFailed to load Vulkan Portability library.@mugurc I'd like to take the fix @011010 described: run those three tests inside
Aps5StartGuest_nid_no_patch, aslibSceVideoOut/tests/Flip.cppdoes. Do you want it as a commit formacos-port, or as a PR tomainafter the main-thread runtime is in?AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T15:19:42Z.
macOS build and test report: Apple M2 Max, to add an M2 Max next to the M1 Pro, M2, M3 Max, M4 and M5 reports.
Setup
macos-portatb7eb6b6b, x86-64 under Rosettacmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON, thenninja -C buildandninja -C build libsninja libs: no work left. 124.prx, eachMach-O 64-bit x86_64-fexperimental-libraryfix from4d1e064ccovers this toolchain.Tests without GPU (
ctest -E 'agc|flip|display|vulkan|gpu' -j8): 495 selected, 490 pass, 5 skip, 0 fail, 54 s.patched_librariespassed in 53 s in this run, under the 60 s limit. Skips are the same five as on the M3 Max:guest_amm_placement:the guest arena is Linux and Windows onlyvideo_out_frame_dump_queue: SDL offscreen driver has no Vulkanguest_video_out_wqhd_detection,guest_video_out_resolution_status,guest_video_out_output_mode:Failed to load Vulkan Portability library(no loader installed)Whole suite without a Vulkan loader (
ctest -j4 --timeout 30): 940 tests, 583 pass, 357 skip, 0 fail, 81 s.Flaky tests reported above:
guest_tcpandhost_thread_localpassed 30 of 30 runs each (ctest -R '^(guest_tcp|host_thread_local)$' --repeat until-fail:30 --timeout 30).GPU (
ctest -R agc -E 'flip|display|lds_atomics64' -j1 --timeout 30): LunarG Vulkan SDK 1.4.363.0,DYLD_LIBRARY_PATHandVK_DRIVER_FILESexported beforectest. x86-64vulkaninforeportsApple M2 Max, MoltenVK 1.4.2, API 1.4.357. 434 selected, 368 pass, 22 fail, 44 skip, 210 s, no hang.The 22 are the same 22 as on the M3 Max and M5, with no failure specific to the M2 Max.
prepared_shaders_registered_workgroup_syncpasses.With
APS5_NO_WRITE_WATCH=1the count goes from 22 to 14, as on the M1 Pro and M3 Max:unchanged_cpu_stamps,alpha_to_coverage,array_layer_target,dcc_keys_first_write,dual_source_blend,packed_unorm_color_target,srgb8_color_target,storage_one_slice_alias,swap_alt_blend.pixel_fixed_point_positionfails withAGC graphics: cannot allocate the color target, in 10 of 10 runs; with the watch on it passes 10 of 10.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-14T16:42:23Z.
M4 result for the write-watch import change, closing the loop on my report above.
macos-portatb7eb6b6bwith @Zheorgyan'sImportWatchedchange from #5101 applied verbatim.DYLD_LIBRARY_PATHandVK_DRIVER_FILESexported beforectest. Device: Apple M4, subgroup 32..prx, eachMach-O 64-bit x86_64.ctest -R "^agc" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64" -j1 --timeout 30: 433 selected, 13 fail, 44 skip (it was 22 in my report above).The 13:
dcc_keys_first_write,dpp16_operands,f32_constant_factor_tininess,f32_denormal_flush,f32_dot2_rounding,f32_output_modifier,float16_fma_rounding,float16_rounding,ngg_vertex_wave_info,packed_alu,pixel_interlock,relative_ancillary,sdwa_float_selectors.So the M4 now matches the M1 Pro, M3 Max, M5 and M2 Max: 22 → 13 with the change.
relative_ancillaryfails here too (device capability 2, as on the M5/M3 Max/M2 Max). Thanks @Zheorgyan — the write-watch import fix accounted for the blend, color-target and storage failures I had listed.Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-14T16:43:45Z.
I'd like to take the
VK_KHR_portability_enumerationavailability check @yripper suggested. On__APPLE__the instance currently pushes the extension and setsVK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHRwithout checking that the extension is advertised, so a loader or driver that does not expose it failsvkCreateInstance; the fix mirrors the availability test already done for the window extensions.The block is not on
mainyet, so this belongs with the MoltenVK device piece: I can open it as a small PR withDepends on:that one, or leave it for you to fold in — your call. I will follow the order you set for the series.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T17:18:29Z.
M2 Max result for @Zheorgyan's
ImportWatchedchange. My report above only hadAPS5_NO_WRITE_WATCH=1(22 → 14); this is the change itself.DYLD_LIBRARY_PATHandVK_DRIVER_FILESexported beforectest.macos-portatb7eb6b6bplus the snippet from this comment, applied as it is. This is the full diff:ctest -R "^agc" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64" -j1 --timeout 30: 433 selected, 376 pass, 13 fail, 44 skip, 192 s, no timeouts.The 13 failures are the same as @011010's M4 list:
dcc_keys_first_write,dpp16_operands,f32_constant_factor_tininess,f32_denormal_flush,f32_dot2_rounding,f32_output_modifier,float16_fma_rounding,float16_rounding,ngg_vertex_wave_info,packed_alu,pixel_interlock,relative_ancillary,sdwa_float_selectors.Compared with the unpatched baseline on the same build tree (22 failures), the change fixes these 9:
unchanged_cpu_stamps,alpha_to_coverage,array_layer_target,depth_compare_copy,dual_source_blend,packed_unorm_color_target,srgb8_color_target,storage_one_slice_alias,swap_alt_blend. It causes no new failures. Because the write watch stays on,pixel_fixed_point_positionpasses, while withAPS5_NO_WRITE_WATCH=1it fails.dcc_keys_first_writestill fails, as expected.I also tried merging current
main(f3b5daaf) intob7eb6b6bbefore adding the change. I wanted to see whether the fixes merged since the branch was cut (#4470/#5081, #4528, #4842/#5097, #3874) remove any of the 13. The merge conflicts in 24 files, among themVulkanDevice.cpp,GuestBufferMemory.cpp,ShaderDiskCache.cpp, five SPIR-V backend files (SpirvAluEmitterMath.cpp,SpirvEmitter.cpp,SpirvFlowEmitter.cpp,SpirvMemoryInstructions.cpp,SpirvSubgroup.cpp) and several libkernel and test files. I did not resolve them by hand, so I have no result on currentmain.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T17:21:56Z.
I'd like to take a measurement on the float signed-zero group: build MoltenVK from source with a SPIRV-Cross that includes KhronosGroup/SPIRV-Cross#2704 (x86-64 slice, for Rosetta), and run the 13 remaining failures on
macos-port+ theImportWatchedchange against it, next to the LunarG 1.4.363.0 MoltenVK.The aim is to split the group into the tests #2704 explains (
sdwa_float_selectorsis confirmed, andagc_driver_mad_f32from #5782 fails the same way) and the ones that are something else (f32_*,float16_*,dpp16_operands,packed_alu). This is measurement only: no change to the helpers @yripper and @krishalivaibhav are working on, and the -0 handling @Zheorgyan asked to keep is what is being tested. I'll post the results here.Written with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-14T17:24:18Z.
I'd like to take
agc_driver_relative_ancillary, one of the 13 that has been grouped with the device-capability limits. It looks fixable rather than a Metal limit.The shader reads the
Layerstage input, and the recompiler then emitsCapabilityGeometry(SpirvModuleSetup.cpp), which Metal does not have, soValidateShadersrefuses it withunsupported device capability 2. SPIR-V 1.5 lets the same read useCapabilityShaderLayerinstead, without a geometry shader, and MoltenVK advertisesshaderOutputLayer = true.I tried it on the M4 against
macos-portatb7eb6b6bwith the #5101 change: with the module emittingCapabilityShaderLayerand SPIR-V 1.5 for that input when the device has no geometry shaders, the validator acceptingCapabilityShaderLayer, and the validator's SPIR-V ceiling raised to 1.5,agc_driver_relative_ancillarypasses. The real change would gate all of that on the device feature — useShaderLayeronly whenshaderOutputLayeris present and geometry is not — so NVIDIA and lavapipe keep the geometry path.I can send it as a small PR touching
SpirvModuleSetup.cpp,ShaderValidation.cppand the device capability list. Tell me if the place in the series is wrong.Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-14T17:37:44Z.
Update on
agc_driver_relative_ancillary, with a simpler route than the one I first described.VK_EXT_shader_viewport_index_layeris already handled onmain: the device pushesCapabilityShaderViewportIndexLayerEXTand the validator accepts it, and its extension, under the same flag. MoltenVK advertises the extension. So theLayerread can be lowered through that instead ofCapabilityGeometry, with no SPIR-V version change: when aLayerstage input is present and the device has no geometry shaders but does haveCapabilityShaderViewportIndexLayerEXT, the module emitsSPV_EXT_shader_viewport_index_layerand that capability instead ofCapabilityGeometry.I tested that on the M4 (
macos-portatb7eb6b6bwith the #5101 change):agc_driver_relative_ancillarypasses. It stays a single file (SpirvModuleSetup.cpp), and it keepsCapabilityGeometrywhenever the device has geometry shaders, so NVIDIA and lavapipe are unchanged.So this is a one-file PR rather than the three-file one I described. I'll send it once you tell me where it belongs in the series.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T18:01:48Z.
M2 Max result for the SPIRV-Cross piece: which of the 13 MoltenVK failures KhronosGroup/SPIRV-Cross#2704 ("MSL: Preserve negative zero in precise multiplication",
spvFMulusedfma(l, r, T(0)), nowT(-0.0)) accounts for.Setup:
VK_DRIVER_FILESpointing at an ICD json with an absolutelibrary_path.DYLD_LIBRARY_PATHpoints at a directory with onlylibvulkan*: with the SDK'slib/there, dyld loads the SDK'slibMoltenVK.dylibwhatever the ICD says. I checked the loaded driver for every run withVK_LOADER_DEBUG=driver../fetchDependencies --macos && make macos(universal,lipo -archs=x86_64 arm64), changing onlyExternalRevisions/SPIRV-Cross_repo_revision:main@5189f8dewith SPIRV-Crossaa217aeb(the revisionmainpins, and the parent of300681bb).300681bb(#2704; it changes only the fourfmaaddends inspirv_msl.cpp).v1.4.2(db66022, the one in the SDK) with the same two SPIRV-Cross revisions and got identical results. With v1.4.2 those revisions print a[MVK-BUILD-ERROR] Cereal serialization ... CompilerMSL::Optionswarning, so I reportmain.macos-portatb7eb6b6bplus theImportWatchedchange from my previous comment.Suite:
ctest -R "^agc" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64" -j1 --timeout 30, 433 selected, no timeouts.agc_driver_mad_f32: #5782's diff (withoutdocs/) on the same tree, with theRequireinCheckchanged to print every mismatch.dpp16_operandsf32_output_modifierfloat16_fma_roundingfloat16_roundingpacked_alusdwa_float_selectorsf32_denormal_flushlane 8 no float mode v_fma_f32 v14, v4, v5, v6 is 0x00000000, expected 0x00800000(B:lane 0 ... v_mul_f32 v25, |v4|, -v5 is 0x00000000, expected 0x80000000)f32_constant_factor_tininesslane 2 no float mode v_mul_f32 0x3f7ffffe is 0x00000000, expected 0x00800000f32_dot2_rounding64-bit float instructions need the Float64 capability, which the device lacksdcc_keys_first_writean unchanged pending image was uploaded againngg_vertex_wave_infosubgroup capability 61 is unsupported for shader stage 1pixel_interlocktype 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'relative_ancillarySPIR-V requires unsupported device capability 2mad_f32(#5782) mismatches0x3f7ffffe * 0x00800001gives0mad_f32mismatches. Nothing here comes from MoltenVK version differences.mad_f32mismatches that go away are exactly the ones expecting0x80000000(10 per float mode). No new failures or mismatches appear.f32_denormal_flushstill fails, but on the tininess case: its signed-zero failure is gone.dcc_keys_first_write.So on this machine, an SDK/MoltenVK release built with SPIRV-Cross at or after
300681bbshould take the list from 13 to 7, andmad_f32from #5782 down to the tininess mismatches only. I have not tested any released SDK that contains it.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-14T18:12:32Z.
One row of the remaining 7 in the table above is the one I described a few comments earlier:
relative_ancillaryfails onSPIR-V requires unsupported device capability 2because the shader reads theLayerinput and the recompiler asks forCapabilityGeometry, which Metal cannot use. With the one-file change from that comment (emitSPV_EXT_shader_viewport_index_layerandCapabilityShaderViewportIndexLayerEXTwhen the device has no geometry shaders),agc_driver_relative_ancillarypasses on the M4.So against your #2704 build the list would be 6, not 7. I have a unit test for the emit that forces
supportedCapabilities, so it also runs on the Linux CI, and the change is ready to send as a PR once the place in the series is settled.Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-14T19:23:14Z.
@Zheorgyan thanks for flagging KhronosGroup/SPIRV-Cross#2704. I reproduced the signed-zero issue on our Apple M2 using a native Metal compute test, fast math disabled, with an independent integer-bit oracle for all 16 ordered pairs from {+0, -0, +1, -1}.
fma(a, b, +0)loses the negative-zero sign in 6/16 cases for both float and half.fma(a, b, -0.0)passes 16/16 for float and half; the float helper also passes after removingoptnonewith contraction disabled. The half check does not separately establish optimized-helper equivalence.This is narrowly scoped validation: the scalar oracle covers zero/one signs, and the fragment uses synthetic resources/varyings. It does not prove arbitrary rounding, matrix behavior, denormal/NaN handling, complete game correctness, or an FPS gain. The production runtime is unchanged. We will preserve the upstream negative-zero correction in any optimization proposal.
AI-assisted: yes. Independently reviewed scalar test results; captured-fragment follow-up is local evidence.
Additional Vulkan checks on our M2
Using the existing MoltenVK 1.4.2 driver and our modified local Mac runtime (not a pristine-main or
macos-portsuite), six focused tests changed from 1 pass / 5 failures to 5 passes / 1 failure when applying only the four upstream helper-source edits through a private Metal source-compilation hook.optnoneand compile options are preserved. Both synchronous/asynchronous compilation hooks were installed and replacement counters confirmed the four helper patterns were encountered.agc_driver_f32_output_modifier,agc_driver_float16_fma_rounding,agc_driver_packed_alu,agc_driver_sdwa_float_selectors.agc_driver_float16_roundingalready passed without the hook.agc_driver_dpp16_operandsstill fails identically:row_shr_pk_fmac_f16actual0x2e660000, expected0x2e668000. This differs from the M2 Max report; we have not isolated whether the cause is the runtime/test revisions or another difference.f32_output_modifierandfloat16_fma_roundingfail again; re-enabling it makes both pass again.This is not a rebuilt MoltenVK or installed SDK update: this machine currently has Command Line Tools but no full Xcode/Metal command-line compiler. The temporary hook tests the source correction on exercised Vulkan paths only; no game run, full-suite claim, runtime optimization, or FPS gain follows. Four scoped recoveries and the unchanged failure were independently reviewed.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T21:07:28Z.
@mugurc a run of the open part of the series on current
main, in case it helps the reviews.Machine: Apple M2 Max, macOS 27.2, Xcode 27.0 (Apple clang 21.0.0), x86-64 full build under Rosetta as #4626 configures it (
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON, thenninja -k 0andninja -k 0 libs). Base:main41cc655b8. The PRs were merged cumulatively withgit merge --no-ff --no-commitat heads #4627dba6a02b7, #4629facc03ae9, #4630 cc064ec78 and #573514e62d45d.mainEach PR removes the errors its description names and adds none.
libc.dylibstill does not link at the end, so no prx library and no guest test is produced, and none of the series' tests could run yet.What is left in libc after the four:
libc/src/GuestAllocations.cpp:26:'link.h' file not found. This was already in your base2a5eca11c, so I assume a later PR of the series covers it (macos-porthas the__APPLE__branch).libc/src/Threads.cpp:248: new onmainsince your base, from #5037 (_Cnd_timedwait).system_clock::time_point(seconds + nanoseconds)does not compile with libc++, whosesystem_clockcounts microseconds; it needs aduration_cast/time_point_cast.Other code that
maingained after2a5eca11c, which no open PR covers and whichmacos-portpredates:libkernel_sys/Export.cpp:543,569::rmdir,::unlinkundeclared:<unistd.h>is under#ifdef __linux__, the code under#elselibSceLibcInternal/PathStatistics.cpp:103O_PATHundeclaredlibkernel/DirectMemory/Jit.cpp:143MFD_CLOEXECundeclaredtests/GuestGenericCategory.cpp:56reinterpret_castfromconst void *to a function pointer casts away qualifiersThe rest are the libkernel host APIs you listed as next:
link.hinDynamicLoader,ModuleInfoandRtld.st_atim,MFD_CLOEXECinSharedMemory, andsys/vfs.h.windows.hinDirectMemory.cpp.pthread_getattr_np,ppollandsched_getcpu.Resolver.cppgethostbyname_r, andThreadPriority.cppRLIMIT_RTTIME.libguest_module_fixture.dylibfails withld: unknown options: --no-as-needed(libkernel/CMakeLists.txt:178hasNOT WIN32,macos-porthasNOT WIN32 AND NOT APPLE).Written with AI assistance (Claude Code). I ran the builds above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-14T21:10:15Z.
@jotitadev @Zheorgyan I isolated why
agc_driver_dpp16_operandsstill failed on our M2 after the four #2704 helper edits. This appears to be a separate subgroup-participation problem, rather than another multiplication signed-zero case.Setup: Apple M2, existing MoltenVK 1.4.2, x86-64 local modified AnyPS5 runtime tests. Metal compile metadata has
fastMathEnabled=false. This is not yourmacos-portrevision or a full rebuilt MoltenVK comparison.lane-in-row >= 1with aspvSubgroupBallot(true)membership check using short-circuit&&.0x2e660000instead of0x2e668000; lane 17/result 5 is0xb8004a3dinstead of0x49fd4a3d.&&with eager boolean&. All 512 words then match. Repeated with the original captured kernel without debug writes/signature changes: baseline still has those two mismatches, eager variant has zero.agc_driver_dpp16_operands: it passes (2.71 s). Logs confirm four guard replacements. The signed-zero-only Vulkan control still fails as above. A second agent independently reviewed the output comparisons and Vulkan pass.This is not a proposed generic rewrite of logical AND, nor a production-ready fix: the experiment recognizes this test's exact generated expression, preserves
optnone/compile options, and does not change the installed SDK or game runtime. A proper fix should preserve the original subgroup operation's participation/convergence when MSL expressions are inlined/short-circuited. No full-suite or game/FPS improvement is claimed. Reporting the reproducer to help avoid treating this particular remaining failure as scalar floating-point arithmetic.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T21:21:04Z.
@mugurc on the code
maingained after your base (my previous comment), I can send small PRs so you don't have to carry them in the series, unless you'd rather fold them in:libc/src/Threads.cpp:248(#5037): the wait deadline is built from nanoseconds, which libc++'ssystem_clock(microseconds) rejects. I have a one-line fix ready, rounding up withceil<system_clock::duration>so the deadline never comes before the requested time; libstdc++ is unchanged. Checked on Apple clang 21 with-fsyntax-onlyon the ninja command line.libkernel_sys/Export.cpprmdir/unlink(#4870),PathStatistics.cppO_PATH(#4653),Jit.cppMFD_CLOEXEC(#3787) and theGuestGenericCategory.cppcast (#5102).Tell me which ones you want me to take, if any. I'll leave the libkernel host APIs and the
--no-as-neededfixture to the series.Written with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T21:30:24Z.
@krishalivaibhav thanks for the detailed isolation. Here is what the same test does on my side, for comparison. Your tree differs from mine, so this does not contradict your result.
Setup: M2 Max, macOS 27.2, x86-64 under Rosetta,
macos-port@b7eb6b6b+ ImportWatched (notmain). Driver checked withVK_LOADER_DEBUG=driverand MSL captured withMVK_CONFIG_SHADER_DUMP_DIR.Requirewas turned into a print to list every mismatch.agc_driver_dpp16_operands0x2e660000vs0x2e668000, lane 110x0000402bvs0x8000402b-0.0helper edits.0xb8004a3dvs0x49fd4a3d).&&. It is a separate statement in uniform control flow, and the guard only tests a bit of its result: So short-circuiting cannot skip the ballot for lanes 0/16 here. That guard text is identical with all three drivers. If your MSL hasspvSubgroupBallotinside the&&operand, your SPIR-V (from a different recompiler revision) is probably what differs. Comparing the two.spvwould settle it.driverVersion+pipelineCacheUUID, and MoltenVK's UUID does not change with the SPIRV-Cross revision. Running the test binary directly withoutANYPS5_NO_SHADER_CACHE=1(ctest sets it for this test), a rebuilt MoltenVK loaded the old cache and converted no shaders. The #2704 build then reproduced the aa217aeb mismatches. Your hook logs show the replacements ran, so this probably isn't your case. It is worth ruling out for the "signed-zero-only control", though.Written with AI assistance (Claude Code). I ran the tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-14T21:33:22Z.
@jotitadev thanks — that distinction matters. I agree your result does not establish a ballot problem in your macos-port revision, and our local result should not be generalized to it.
I reran our signed-zero-only control with ANYPS5_NO_SHADER_CACHE=1 explicitly set. The hook again logged all four helper replacements, so Metal source compilation occurred; lane 1 still fails with 0x2e660000 versus 0x2e668000. This is our older modified local Mac tree, not your macos-port revision or pristine main.
Our captured test SPIR-V is 33,000 bytes, SHA-256 c4bc23963f015767164ccf380e6f4cf61947aa6c10f6deda2bf6280476d0ec85. I agree comparing the modules is the next upstream relevance check; I do not have your module yet.
Separately, I reduced the forwarding behavior to a standalone 183-word SPIR-V compute module: an unconditional subgroup ballot is consumed by a lane-dependent logical AND. SPIRV-Cross aa217aeb forwards it into the short-circuit operand. Native M2 execution gives two incorrect lane results; materializing the ballot result at its original instruction yields all 32 expected values. The candidate also passes OR and nonconstant-predicate variants, and a structural check retains a conditional ballot within its original branch. This is isolated compiler evidence, not an installed-driver/game fix or an FPS claim. The candidate still needs upstream regression review.
I will keep the compiler reproducer separate from claims about current AnyPS5/macOS failures. No new AnyPS5 PR is being proposed from this result alone.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by yripper on 2026-10-14T22:00:46Z.
@mugurc thanks. The kqueue part is covered: @OleksandrS23's #5749 is merged, and I've dropped my backend in favour of it.
The guest arena on macOS, as it is on my branch:
Arenaclass and constants as on Linux. Only two host primitives differ:mach_vm_regionwalk fromArenaStarttoApplicationAreaEnd, in place of/proc/self/maps.mach_vm_mapwithVM_FLAGS_FIXED,VM_PROT_NONEand max protectionVM_PROT_ALL, in the same 1 GiB chunks.KERN_NO_SPACEmaps toEEXIST, so the loop that skips occupied chunks is unchanged.PlaceAt,GuestArenaSetProtection) are the Linux POSIX ones, enabled for__APPLE__as well.docs/dev/debt/libc.md.mach_vm_map, andVirtualQueryanswers frommach_vm_region.shm_openobject (bus error), so on macOS the JIT backing is an unlinkedmkostempfile in the temp directory, where Linux usesmemfd_create.guest_arenatest, which passes as x86-64 under Rosetta and as arm64.Two orders would work:
mainthat touches onlyGuestArena.cpp, its test and the debt entry, with your direct memory on top.I'd suggest the first, since it is self-contained, but I'll follow whichever fits your series.
@011010 please take the
VK_KHR_portability_enumerationcheck, thanks. I'll open the write-watch protection query for the AGC page query after #5619, to keep one open PR at a time.Imported from boykopovar/AnyPS5. Originally posted by yripper on 2026-10-14T22:00:47Z.
@Zheorgyan @krishalivaibhav thanks, good catch on the -0.
To be clear about what my branch does: it doesn't change the helpers. On
VK_DRIVER_ID_MOLTENVKit dropsNoContractionfrom pixel-stage arithmetic, so SPIRV-Cross emits plain operations and Metal is free to contract them into FMA. That is where the title-screen gain comes from (35.8 → 14.5 ms of GPU time a frame), but it trades precision, so it isn't an equivalent transform. I'm keeping it as a local patch, not a PR.A strict helper on the translator side, as you describe, is the right fix for upstream. When you have a candidate, I can A/B it on PPSA28997 against the build without
NoContraction, with GPU time per frame from the same scenes. @jotitadev's table above makes a good correctness baseline for the same run.Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-14T22:26:56Z.
Thanks @yripper, I will take it. One thing to settle first: the
#ifdef __APPLE__portability block only exists onmacos-port, not onmain, so it belongs with the device piece @mugurc is landing. I will send it as a small PR withDepends on:that one, or hold until it is up — whichever the series prefers. I have the fix ready (advertise the extension and the instance flag only whenvkEnumerateInstanceExtensionPropertieslists it, like the window extensions already do) and can check it on the M4.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-14T22:37:22Z.
Status: #4626, #4628 and #4629 are merged; #4627, #4630 and #5735 are open. I rebased #4630 onto current
main: it conflicted with #5756 inGuestRaiseException.cpp, and I resolved it the way @jotitadev described, including the two new uses.@jotitadev thank you for the cumulative run and the two reviews; the table is what I needed to order the next PRs. Yes please, take the small ones as separate PRs:
Threads.cpp(#5037),libkernel_sys/Export.cpprmdir/unlink(#4870),PathStatistics.cppO_PATH(#4653),Jit.cppMFD_CLOEXEC(#3787) and theGuestGenericCategory.cppcast (#5102). I will not carry them. The libkernel host APIs and the--no-as-neededfixture stay in my series.@yripper thanks for the arena description, and good that #5749 covers the kqueue part. I would take your first order: the arena as a small PR against
main(GuestArena.cpp, its test, the debt entry). My direct-memory branch is not open yet; I will rebase it onto your PR once it is up, so please say here when it is open. The JIT backing can follow as its own PR.@011010 the portability block lives in the MoltenVK device branch, which comes late in my order. You can send the fix as a PR with
Depends on:once that branch is up, and I will say so here when it is.Imported from boykopovar/AnyPS5. Originally posted by yripper on 2026-10-14T22:51:01Z.
@mugurc the arena PR is open: #6124 (
GuestArena.cpp, the standaloneguest_arenatest and the debt entry, against currentmain). The JIT backing will follow as its own PR once this one is in.Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-14T22:58:40Z.
@mugurc the
relative_ancillaryfix I described above is separate from the MoltenVK device branch: the module it changes (SpirvModuleSetup.cpp, the emit of theLayerinput's capability) already lives onmain, and the validator there already acceptsCapabilityShaderViewportIndexLayerEXTwhen the device advertisesVK_EXT_shader_viewport_index_layer, so nothing changes on NVIDIA or lavapipe. It also carries a unit test that forcessupportedCapabilities, so it runs on Linux CI.Should it go against
mainnow, or do you want it after the series too?Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T23:26:03Z.
@mugurc thanks, I'll take those five. Four already have branches on my fork, and I'm preparing
Jit.cpp(MFD_CLOEXEC) now:Threads.cpp(#5037):jotitadev:fix/libc-cnd-timedwait-libcxxlibkernel_sys/Export.cpprmdir/unlink(#4870):jotitadev:fix/macos-libkernel-sys-unistdPathStatistics.cppO_PATH(#4653):jotitadev:fix/macos-path-statistics-o-pathGuestGenericCategory.cppcast (#5102):jotitadev:fix/macos-generic-category-test-castOne constraint: I have no merged PR yet, so CONTRIBUTING limits me to one open PR, and that slot is #5903 (docs). I'll open these one at a time in the order above, and all of them once #5903 is merged or closed.
Written with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-14T23:30:23Z.
@011010 against
mainnow, please: it only touchesSpirvModuleSetup.cpp, which none of my branches change, so it does not need to wait for the series.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T00:17:32Z.
@yripper @mugurc about
Jit.cpp(#3787): the macOS backing I prepared for theMFD_CLOEXECcompile error is the one @yripper described above, an unlinkedmkostempfile in the temporary directory, becauseshm_openpages cannot be made executable. It is onjotitadev:fix/macos-jit-mfd-cloexec(one#ifdef __APPLE__inCreateBacking; Linux and Windows unchanged).@yripper you said the JIT backing would follow #6124 as your own PR, so I don't want to duplicate it. If you'd rather send it, I'll drop my branch; otherwise I'll open it and credit your finding in the description.
One data point for the macOS
DoMapShared, from a standalone program on macOS 27.2 (M2 Max), as arm64 and as x86-64 under Rosetta:mmapwithPROT_EXECof this file, or of any regular file, returnsEPERM, while mapping itPROT_READand thenmprotectto read-execute works and runs code written through a shared read-write view. With an anonymousshm_openobject thatmprotectfails withEACCES.Written with AI assistance (Claude Code). I ran the checks above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by yripper on 2026-10-15T02:11:19Z.
@jotitadev go ahead and open it, I'll drop the JIT item from my queue. I can't open a second PR until #6124 merges anyway, so yours lands sooner. My backing is the same as yours (
mkostempwithO_CLOEXEC, thenunlink), so I'll review yours rather than send a duplicate.Thanks for the
DoMapShareddata point. It matches what I see inDirectMemory.cpp: on macOS the non-Windows path callsmmapwith the full protection, so a guest shared mapping that asks for execute would fail with EPERM. GoW doesn't take that path, which is why I never hit it. Mapping read-only (or read-write) first and then callingmprotectup to the requested protection, as you measured, looks like the fix. That could go in the same PR or a follow-up, whichever is easier for you.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T02:25:17Z.
@yripper thanks, I'll take it. I can only have one open PR until my first one (#5903) merges, so the JIT backing goes up as soon as that slot frees; I'll ping you for the review. The
DoMapSharedchange (map withoutPROT_EXEC, thenmprotectup to the requested protection) I'll send as a separate follow-up, since it touchesDirectMemory.cppand the guest mapping path rather than the JIT backing.Written with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-15T06:47:33Z.
@jotitadev @yripper one more data point for the
DoMapSharedfollow-up, from a standalone program on macOS 26.5.1 (M5 Max), as x86-64 under Rosetta and as arm64. The two kinds of host object behave in opposite ways:shm_openobjects on macOS):mmapwithPROT_EXECfails withEPERM; mapping without it and then callingmprotectup to read-execute works.mprotectup to read-write-execute also works under Rosetta, but fails withEACCESas native arm64.shm_openobject:mmapwithPROT_EXECworks, but anmprotectthat adds execute fails withEACCES, even on a mapping that started read-write-execute and was lowered to read-write.So mapping first and then calling
mprotectis right for guest shared memory objects. My direct-memory branch backs direct memory withshm_open, so there a guestmprotectthat makes direct memory executable fails; I'll fix that in that branch.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-15T07:05:13Z.
@jotitadev @yripper two more results from the same kind of program, as x86-64 under Rosetta. The first corrects my comment above:
shm_openobject,mmapwithPROT_EXECsucceeds, but calling code in that mapping ends withSIGBUS, soshm_opencannot back guest code at all. My direct-memory branch now uses a named Mach memory entry instead (mach_make_memory_entry_64withMAP_MEM_NAMED_CREATE): its mappings can be aliased, made executable withmprotect, and the code in them runs.sys_icache_invalidateon the executable view does not help. Changing the executable view to read-only and back to read-execute withmprotectdoes, and code written at an offset that has not run yet is picked up without it. A memory entry behaves the same way. ForsceKernelJitCreateSharedMemoryand its alias this means that a title rewriting code it has already run may run the old version under Rosetta, unless execute is dropped and restored on the executable view after such a write.Next from me:
sceSystemServiceLoadExecon macOS (the running executable from_NSGetExecutablePath, the process replaced withposix_spawnandPOSIX_SPAWN_SETEXEC). It toucheslibSceSystemServiceandGuestSystemExit.cpp, next to #6237 and #5699.Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-16T03:51:30Z.
@mugurc @yripper, a title for the direct-memory step that #6124 prepares: ccleste (PPSA59322, catalog release 1.00, sha256 checked) needs address-less direct mappings to land in the guest arena on macOS.
macOS 26.7.1, Apple M2, x86-64 under Rosetta, MoltenVK from the LunarG SDK 1.4.363. A local tree of
maince991f1ecwith #4627, #4630, #6124, the four macOS relinker PRs and mugurc'slibkernel-files,sockets,process-clock,module-info,direct-memory,macos-main-thread,macho-tls,agc-macos-*andaudio-macos-single-sdlbranches merged; run from a directory withlibs/beside the executable.No device with Vulkan support foundand exits with a segfault 4 s in. Its RADV (mihawk-99/PS5_Mesadc82d010,src/amd/vulkan/winsys/ps5/radv_ps5_platform.c) maps its 16 MiB ring withsceKernelMapDirectMemoryand no address, and requires the result to lie in the window 0x200000000 to 0x300000000 (radv_ps5_window_contains); otherwise queue creation fails and the device is not reported. On macOS the mapping came back at 0x150800000, fromMapPlaced's plainmmap(nullptr, ...): the arena paths inDirectMemory.cpp(ArenaAvailable/ArenaCommit/ArenaForget, and theGuestArenaAllocateFromHintandGuestArenaAllocatebranches ofMapPlaced) are__linux__only.__linux__ || __APPLE__(on top of #6124's arena), ccleste gets past device creation, runs its shaders and submits GPU work for 25 s, then stops onAGC graphics: rect-list requires finite nondegenerate axis-aligned positions with equal positive W, which I'll look at separately.I haven't opened a PR for the placement since it is the step agreed here; mugurc, if it helps, the three guards above are all it took in this tree.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Cloud-Multiplayer on 2026-10-16T04:59:09Z.
@DavidSamir the
rect-list requires finite nondegenerate axis-aligned positions with equal positive Wstop: I hit the same one after merging currentmaininto my loader-based branch (MoltenVK 1.4.2, Apple M3 Pro, x86-64 under Rosetta), on every full-screen clear drawn as a rect list. Here is what I found, in case it saves you the search.Cause. Since #3878 (
9db923e90, "clip primitives with an all-zero clip position") every vertex and tessellation-evaluation program that exports a position also writesgl_ClipDistance(DefineOutputsinSpirvMemory/SpirvEmitterHelpers.cpp,zeroPositionClipIndex). A rect-list draw runs the generated tessellation control stage fromRectListShaders.cppafter the guest vertex program. With the extra clip distance in the vertex outputs, MoltenVK hands that control stage zero positions: I wrote the threegl_in[i].gl_Positionvalues into the spare words of the fault record, and every rejected draw had(0, 0, 0, 0)for all three. The vertex SPIR-V itself is correct (the position store is there, guarded by an exec mask that is true).Check. On the same build, with the pipeline cache and shader cache cleared before each run:
Workaround I am using. Skip the zero-position clip on
__APPLE__(an#ifdefaround thezeroPositionClipIndexblock inDefineOutputs, with a switch to turn it back on). It gives up the all-zero-position clipping that #3878 added, so it is a workaround and not a fix.I also tried declaring
gl_ClipDistancein the control stage'sgl_inblock, so that both sides of the interface match. That run used a stalevk-pipelines-*.bin, so its result does not count either way; I have not repeated it. Two things that cost me time: the MoltenVK pipeline cache survives a recompiler change, so deleteshader_cache/vk-pipelines-*.binalong with the shader cache when you test this (@jotitadev noted the same for a rebuilt MoltenVK); and the generated control stage only gets pastShaderValidation.cppwithClipDistanceallowed as a tessellation-control input.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-16T07:54:36Z.
KhronosGroup/SPIRV-Cross#2704 is merged as 300681bb. MoltenVK still pins SPIRV-Cross aa217aeb from 09-27, so it needs a MoltenVK revision bump and an SDK release before it reaches us
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-16T09:51:31Z.
@mugurc another title for the arena step, and an address range macOS never hands out. Same setup as my ccleste comment above (Apple M2, macOS 26.7.1, x86-64 under Rosetta; the range check also ran natively on arm64).
Link's Awakening for PS5 (PPSA99670, catalog v0.1.0, sha256 checked). With #6211 for
telldir, it starts, then printsre-exec: Operation not supportedand exits with status 1 within 14 s. Its runtime (runtime/main.c,reserve_guest_space) reserves0x7000000000+0x320000000withsceKernelReserveVirtualRangeas a hint (flags 0). It requires the result at exactly that address; otherwise it re-execs itself. WithAPS5_TRACE_MEMORY=1, three runs:0x10000000000.MapAtOrAbovesearches above the hint, and the arena's reservation of the application area covers it, so the search ends past0xFC00000000.__APPLE__: the title's first hinted reservation (0x2000000000+0x400000000) is placed at0x7000000000, so the second one lands at0x7400000000. The title still re-execs.The cause of the second run: in every process here, x86-64 under Rosetta and native arm64 alike,
0x1000000000–0x7000000000(64 to 448 GiB) is one region with maximum protection none. It's present at launch in a two-line test program.mmap(MAP_FIXED)inside it fails withEACCES. That still happens aftermach_vm_deallocateof the region reports success, andmach_vm_map(VM_FLAGS_FIXED)then returnsKERN_NO_SPACE. So on macOS the guest's application area can't hold anything between 64 and 448 GiB, and a title that places memory there by address can't run as-is. That's this one at0x2000000000, and0x7000000000is only free because that region ends there.I don't see a fix inside libkernel for titles that require those exact addresses, and the native arm64 route (#3891) would meet the same region. Do you know whether a process can opt out of that reservation?
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by xsyetopz on 2026-10-16T22:56:10Z.
I have a 2015 MBP 15.2" (A1398, i7-4820HQ/R9 M370X with macOS Monterey v12) and 2021 MBP 16" (A2485, M1 Max with macOS Golden Gate v27)--which means I have the ability to test both
darwin_amd64anddarwin_arm64.If anyone has the necessary tester builds, send it to me, and I'll report back with information you need, alright?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T23:47:40Z.
Thanks for offering both machines. PR #6124 is a concrete macOS test target: its author reports the new four-mode
guest_arenatest passing on macOS 26 on an M1 Pro under both Rosetta x86-64 and native arm64. An Intel Mac running Monterey would add the most distinct host/OS coverage; the M1 Max could repeat the native-arm64 path. If you can run a PR-branch build, please coordinate with @yripper for the exact build and test commands. I do not have a tester artifact to send. AI-assisted: yes.Imported from boykopovar/AnyPS5. Originally posted by Alexius0815 on 2026-10-17T07:49:33Z.
@krishalivaibhav on 12.10 you described a local TCS/TES fallback for barycentric emulation on MoltenVK (3-control-point patches at tessellation level 1, M2). Are you planning to publish it?
The same gap now stops two catalog titles on an Apple M4 (macOS 27.2, MoltenVK 1.4.2) once the earlier steps are in (#6124, #6235, #6767 and @billythemenace2's mesh compute fallback from #6528):
SPIR-V requires unsupported device capability 2, the generated barycentric geometry stage;a pixel shader that reads barycentrics without VK_KHR_fragment_shader_barycentric needs a vertex shader before it, at a mesh-path draw, which becomes an indexed triangle list behind the fallback.If you are not going to publish it, I would start a tessellation-based version (triangle-list draws only,
gl_TessCoordas the weights, per-vertex parameters from the three control points) and can test it with both titles. If you are, I would rather test yours than build a second one.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Alexius0815 on 2026-10-17T11:50:47Z.
For anyone who wants a free test title on the macOS port: I published a small native PS5 homebrew tech demo, https://github.com/Alexius0815/ps5-raymarch-techdemo (GPL-3.0, built from source with the open payload SDK, no commercial data).
It exercises CPU worker threads, VideoOut flips, AudioOut (synthesized music) and DualSense input including motion and rumble. The overlay shows which host it detects. It runs on an M4 with Rosetta 2 and MoltenVK. It is not tested on real hardware yet.
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-17T14:08:31Z.
@DavidSamir thanks for both titles. The three arena guards belong in my direct-memory branch, which waits for #6124. When that is merged I'll rebase the branch, widen them to macOS and check the placement against ccleste's window. #6853 covers the same
strto*case as a branch of mine, so I won't open that one.On 0x1000000000 to 0x7000000000: I see the same on an Apple M5 Max with macOS 26.5.1, as x86-64 under Rosetta and as arm64. It is one 384 GiB entry with protection and maximum protection none, present at launch. I don't know of a way to opt out. The executable's own load commands don't claim it either: a test executable with a zero-fill segment at 0x2000000000 (
-segaddr) is killed with SIGKILL beforemainon both architectures, while the same segment at 0x7100000000 loads, slid by ASLR.Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-17T21:14:52Z.
@krishalivaibhav following up on @Alexius0815's question about the TCS/TES barycentric fallback for MoltenVK. Are you planning to open a PR for it? If not, I'll start one from this M2 (MoltenVK 1.4.2), aimed at vkQuake (PPSA99010), and credit your approach. If you are, tell me and I'll test your branch on the M2 instead.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-17T21:18:05Z.
@Alexius0815 I only saw afterwards that you offered the same thing, so to avoid two versions: unless you've already started, I'll write it (triangle lists,
gl_TessCoordas the weights, per-vertex values from the three control points, as you describe). My setup doesn't reach that draw in vkQuake yet, so I'd check it with the barycentric draw tests on this M2, and it would help a lot if you ran your branch of both titles against it. If you've already started, say so and I'll test yours on the M2 instead.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Alexius0815 on 2026-10-17T21:24:51Z.
@DavidSamir thanks, and yes, I've already done it. It is written and tested on an M4: triangle lists without restart as 3-vertex patches, gl_TessCoord as the smooth/linear weights, per-vertex values from the three control points, and the vertex program's gl_ClipDistance forwarded and blended (it builds on #7124 for that). agc_driver_pixel_barycentric_emulation passes through the tessellation path, and vkQuake gets past its first barycentric draw to the first frame. It then hits a separate GPU stall.
I'll push the branch to my fork tomorrow so you can run it on the M2 and your 13 titles before I open the PR on Monday. I'll post the link here.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-17T22:32:03Z.
@Alexius0815 @krishalivaibhav the tessellation fallback is up as #7308 (it builds on #7124). On an M2 it passes the barycentric draw test through tessellation, and EVO Player, Nuvio, Jelly5, Twispero and Emby5 now run past the old
geometry shaders are unavailablestop. vkQuake doesn't reach that draw on my setup yet, so a run with your stack would help. Seven other catalog titles next stop at the last provoking vertex (noVK_EXT_provoking_vertexon Apple). I'll try that next, in the generated stages, the way #7251 does it for rect lists.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Alexius0815 on 2026-10-18T06:12:52Z.
@DavidSamir thanks for #7308, and for carrying the
lastVertexControlfix for #7124. Here is the M4 run you asked for. Apple M4, macOS 27.2, MoltenVK, x86-64 under Rosetta, with #7308's commits on the community macOS stack (mugurc's series + #6528 prototype):agc_driver_pixel_barycentric_emulation,agc_fragment_barycentric,agc_driver_meshandagc_rect_list_position_invariantpass. The barycentric emulation test goes through the tessellation route.geometry shaders are unavailable/SPIR-V requires unsupported device capability 2stop. On screen it is unchanged, though: it shows one frame (the id logo), exactly as with our earlier local tessellation fallback. About 14 s in, a compute batch never finishes (recorded batch still running on the GPU). On macOS that freezes the whole display, so we stop the title on the first stall line. That stall is unrelated to the barycentric path, and because it comes first I can't confirm visually that the emulated draws render correctly in vkQuake.a pixel shader that reads barycentrics without VK_KHR_fragment_shader_barycentric needs a vertex shader before it). The readback draws of the fallback don't go through the new tessellation route yet. That's the small follow-up on top of #6528 I mentioned there; we'll port it to #7308's interface.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-18T13:59:49Z.
Next from me, two small fixes for tests that
mainnow fails on macOS, each in its own pull request:fix(libc): keep the app0.zar state through exit handlers. The app0.zar state from #5835 is a function-local static, destroyed during exit before the handlers registered ahead of its first use run. A path resolved in such a handler locks a destroyed mutex, which macOS fails withEINVAL(guest_path_lifetime).fix(libkernel): recognize listening sockets on macOS hosts. macOS has nogetsockopt(SO_ACCEPTCONN), soguest_socket_options, #6950'sguest_socket_connect_listeningand #7140'sguest_socket_eventsfail;proc_pidfdinforeports the flag.#7332 makes both changes too, among its other fixes; these are the two on their own.
precise_waitfails on macOS too. #6620 already moves its clock toCLOCK_MONOTONIC_RAW, which fixes the early return; the numbers for the bound that still fails are on #6620.The branches of my series are rebased onto
main385ed71f2on my fork, andci/macos-series-2there ismainwith all of them.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-18T14:43:20Z.
Four tests that
maingained since yesterday fail on macOS, and #7332 already fixes each of them:guest_ssl_transport_kernelandguest_ssl_transport_net(#6828): libSceSsl points the allocator of Mbed TLS at its context pools and keeps its Mbed TLS private on Linux and MinGW with--exclude-libs,ALL. On macOS it exported it, so the test's loopback server bound to that copy andmbedtls_ssl_setupgot no memory. #7332 hides it (a5c41edb8).guest_hmd2(#7323), andapplication_heap_lazybefore it, give the test program process parameters by rewriting its own headers, which had no macOS path. #7332 fills the__APS5DATA,__metasection that the emulateddl_iterate_phdrreads (c6504f5ff).guest_kqueue(#7092): on macOSFIONREADon a datagram socket also counts each datagram's sender address (17 for a 1-byte datagram on anAF_UNIXpair), whereSO_NREADgives the first datagram's length as Linux'sFIONREADdoes. #7332 readsSO_NREAD.I got to the same changes for the first two today, before I saw them in #7332; with them
guest_ssl_transport_kernel,guest_ssl_transport_net,guest_hmd2andapplication_heap_lazypass on an M5 Max, macOS 26.5.1. Yours came first, so I will not send mine.@ycarogabriel-lgtm, these three and the other macOS fixes in #7332 (poll, socket pairs, JIT shared memory,
acosf, standard streams, the guest's terminate handler) would each make a small pull request. Do you plan to open them? If you would like me to take some, crediting #7332, tell me which, so that we do not both send the same one. Until the fixture change lands, my fork'sfeat/libc-macho-image-registration, where macOS reads the process parameters, carries the same change so that its tests pass.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-18T15:57:01Z.
Two Apple GPU notes for anyone comparing
macos-portGPU baselines. Setup: M2 Max, macOS 27.2 (26B5112a), x86-64 under Rosetta,macos-port@b7eb6b6b+ ImportWatched (notmain), SDK MoltenVK 1.4.2 unless noted,ANYPS5_NO_SHADER_CACHE=1.agc_driver_cross_workgroup_flagis intermittent on Apple. Before today's macOS update (26B5091g → 26B5112a) it passed in 36 of my 37 suite runs; the one failure was on a tree with another PR's test applied. After the update it fails in streaks: several back-to-back runs fail, then several pass. MoltenVK 1.4.2 and current MoltenVK main behave the same.atomic_load_explicitand the GLC store is a plain store. I made the coherent dword store anOpAtomicStoreat device scope and ran it A/B against the plain store, alternating in the same binary: both pass about half the time, following the streak.agc_driver_pixel_interlockhas a second blocker after the argument-buffer one. WithMVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=0theraster_order_groupcompile error goes away. The three plain draws in each wave size then count 64/64. The BDA-fault draw still loses updates:pixel 1 counted 60 of 64(61 and 63 in other runs).raster_order_groupon descriptor-bound buffers, so the fault shader's MSL has noraster_order_groupat all, and Metal doesn't order its read-modify-writes.raster_order_group(0)and passes.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-18T19:30:28Z.
macOS data point on the "no Vulkan physical device" / "Couldn't create Vulkan surface" stop that ten radv-based catalog titles hit on Apple Silicon (vkQuake PPSA99010, RommPS PPSA76677, Mario 64 PPSA99310, SoH PPSA99320 / PPSA99620, 2Ship PPSA99621, Wind Waker PPSA99641, Twilight Princess PPSA99640, Porpoise PPSA99764, PSSwanStation PPSA99248).
Setup: Apple M2, MoltenVK 1.4.x (Vulkan SDK 1.4.363), x86-64 under Rosetta 2, @mugurc's macOS series (
ci/macos-series-2) onmain13e48ed29.Cause. The title's first GPU mapping is an unhinted
sceKernelMapDirectMemory(16 MiB, prot 0x33, 2 MiB aligned). On Windows (APS5_TRACE_MEMORY=1, RTX 3070) it lands at0x200200000and the title creates its device. On macOS, the unhinted path in the series'MapPlacedends inmmap(nullptr, ...), which puts it at0x151000000, below the 8 GiB user-area base that the guest arena gives on Linux and Windows. The title unmaps it straight away and later reports no device. Its Vulkan driver makes that decision from libc/libkernel answers alone: on Windows, nothing in the AGC or VideoOut libraries is called beforesceAgcInit.Check. A local, env-gated change (not proposed) sends the unhinted macOS case to
MapAtOrAbove(0x200000000, ...). The map then lands at0x200000000, and seven of the ten titles select the Apple M2 device. 25 s runs, before → after:path=1)subgroup capability 61 is unsupported for shader stage 128(mesh)output of type float4 is not compatible with a MTLPixelFormatR8Uint color attachmentSo for these titles the macOS direct-memory placement has to start at the user-area base. #7332 enables the guest arena on Apple, which should give that, and so would placing unhinted maps at or above
0x200000000in the series. The next stops are already covered elsewhere: mesh-path draws without mesh shaders (#6528 and @billythemenace2's fallback), barycentrics on that route (#6941, and @Alexius0815's routing through the #7308 tessellation stages), and integer color exports (#6235).AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-18T20:48:34Z.
@DavidSamir thanks, that is the placement #7631 changes. Until today the series took the arena paths of
MapPlacedonly on Linux, so on macOS a mapping without an address fell through tommap(nullptr, ...). #7631 sends the address-less and the hinted cases to the guest arena on macOS too (#6124 reserves it there), so they start at 0x2_0000_0000 as on Linux.ci/macos-series-2has had it since 18:13Z (e64c3fe9c). The heads before it (fa6d8ae0b and earlier) still have the Linux-only paths. In my runs a 16 MiBsceKernelMapDirectMemorywithout an address landed at 0x2_0000_0000 in five of six launches and at 0x2_00CB_0000 in the other.The series is on
main218aa8f00. On amainthat has #6160 (c34e9d855),libSceAgcDriverdoes not compile on macOS (MAP_FIXED_NOREPLACEinMapDriverMemory); #7332 has a macOS case for it, which I applied locally.If you rerun the ten titles and Mortalfin (#7651) on e64c3fe9c, the results would help #7631's review.
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-18T22:09:34Z.
Follow-up:
ci/macos-series-2is now onmainff2fc5715(91e4eccaf, a fast-forward from e64c3fe9c, which stays reachable). For theMapDriverMemorycompile error since #6160 it carries #7332's macOS case in one commit, until a fix lands onmain. As before, a full macOS build also needs the open fixes #6667, #6668 and #7524 and #6928's change (the JIT shared memory backing, which #7332 also has). With those it builds here, and the library tests show no new failures.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T01:29:08Z.
@mugurc a data point from building your
ci/macos-series-2(91e4eccaf) on top of currentmain(a373e85e5), plus #6667, #6668, #6969, #7524 and theJit.cpp/GuestMemoryLifetimeSupport.hppparts of #7332: the full x86-64 tree builds and links on macOS with 0 errors (Apple M2 Max, Rosetta 2).^agcwith-j1: 40 failures out of 727 on the SDK's MoltenVK 1.4.2, 26 on MoltenVK main + SPIRV-Cross #2704.Two shader workarounds from your earlier port are not in
ci/macos-series-2(they only come with #7332), and they account for 8 of those failures:47bf3675a(v_ldexp_f16sign,EmitConvergentResult):ldexp_f16×5 anddpp16_operands.58fe1ed16(barrier between image store and image atomic):image_cache_bitsandimage_texel_status. With just those 3 lines applied, both pass.One more macOS gap outside the series:
ReadProcessPrivateBytesinPerformanceOverlay.cppreads/proc/self/statuson every non-Windows host, soagc_performance_overlay_statisticsfails on macOS ("the process's private memory cannot be read").task_info(TASK_VM_INFO).phys_footprintworks there: a probe under Rosetta reports +64 MiB after touching a 64 MiB block. Happy to send that as a small PR if you'd rather not carry it in the series.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T03:55:15Z.
@mugurc another piece in the same area as your
20ee39de9a(Vulkan loader in AGC test fixtures): on currentmain, 9 more fixtures loadlibvulkan.so.1directly withoutVK_KHR_portability_enumeration, so 11 ctest entries skip on macOS: PresentationPass, PerformanceOverlay, DepthPlaneGuestLayers, DepthStorage, DepthSurfaceLastWriter, NativeMultisampleDepth, PartiallyResidentSnapshot, PooledBufferRange, SparseBufferHoles.I have them on a branch with your pattern (
jotitadev:fix/agc-tests-vulkan-loader-macos, 9 files, test-only). On the macOS tree from my previous comment, 9 of the 11 then pass. Two run and fail for pre-existing reasons:agc_performance_overlay(the/proc/self/statusread I mentioned) andagc_driver_pooled_buffer_range, where MoltenVK reportsrobustBufferAccessbut an out-of-range read returns stale bytes (0xabababab) instead of zero. Same with SDK 1.4.2 and MoltenVK main.Should I open it as a separate PR, or would you rather take it into your series?
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-19T07:10:03Z.
@jotitadev thanks for both runs.
feat/agc-moltenvk-devicechanges, and it does not need the series, so it can go tomainon its own.ReadProcessPrivateBytes, and thev_ldexp_f16sign and image store/atomic barrier workarounds: #7332 has all three (phys_footprintthroughTASK_VM_INFOinPerformanceOverlay.cpp, and the two shader changes). I am leaving #7332's parts to @ycarogabriel-lgtm, and my question about splitting it (https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6251231314) has no answer yet, so a small PR for one of them is best agreed with them first.ci/macos-series-2is now onmainc1ca83479(0d43cff93, a fast-forward from 91e4eccaf). Thatmainneeded these changes on macOS:Stdio.cppconflicted with #6234 insceKernelWritevandsceKernelPwritev, andGuestShmOpen.cppwith #6542; the merges keep both sides.DirectMemory.cppcalls the Linux-onlyMapUnmappedPagesfrom #6443 and compiles the Windows file mapping code of #6542 on every host but Linux. #7631 is updated: the stack retry stays Linux-only, as macOS maps the whole stack of a thread, and macOS keeps refusing file-backed mappings.guest_kernel_stack_protect(/proc/self/exe,fork) stay Linux-only.agc_shader_table_snapshot_reusefailed: a protection set through the guest arena did not reach the write watch, whose protection the macOS page query uses. It does now.Like
MapDriverMemory, the libc++ case of the pending image snapshot inTexture.cppcomes from #7332 in one commit. With the open fixes, 1535 tests ran here: 930 passed and 19 failed. Two failures are new:guest_math_exact, new onmain, andguest_shm_open, which now maps a shared memory object and needs file-backed mappings, not implemented on macOS yet.Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-19T12:35:03Z.
Updated twice: after #7332 moved to
cac5b49c0(sections 1 and 2 are on that head, section 2 points ata243f0c93, section 3 was added), and with an alternated gameplay measurement of section 3 ond0fdf30ed.Three macOS performance results from Planet of Lana (PPSA19450): Apple M4 Pro (24 GB), macOS 27.0.1, MoltenVK 1.4.2 from Vulkan SDK 1.4.363.0, x86-64
Releaseunder Rosetta 2, #7332 atcac5b49c0with the title relinked by that head'stools/macos/setup-game.sh,run-profile.shandprofile_summary.pyover 10 s windows.1. Page states on macOS: every AGC
verifyasks the kernel@mugurc, this is in
feat/agc-macos-guest-pages(845ab8c34), which I think is not open yet; @ycarogabriel-lgtm, #7332 carries the same code atcac5b49c0.Instruments' Time Profiler, attached with
xctrace record --template 'Time Profiler' --attach <pid>, shows the x86 frames under Rosetta (sampleonly seesRosetta JIT). In the menu, the queue worker (Driver::run) spent 24.3% of its samples inmach_vm_regionand 2.8% inGuestWriteWatchProtection; the draw pipeline thread spent 13.6% inmach_vm_region. The callers areCheckRangefromGuestShaderFieldsandGuestMemory::Read,CompareMappedfromvalidateCaptured, andAccessiblefromMovedReadOnlyBuffers. The call costs about 0.5 us, natively and under Rosetta alike (493 ns x86-64, 559 ns arm64 in a loop).The cause: the macOS branch of
describePagesnever records what it finds in the page-state table, so every check of the same pages queries the kernel again. The Linux and Windows branches record it. The change below records it as the Linux branch does. The allocation generation and the access serial are read beforemach_vm_region, andrecordforgets the run if either moved. The value recorded is the protection afterGuestWriteWatchProtection, so the write watch arming and disarming pages does not change it. Guestmmap,munmapandmprotectchange it throughGuestAllocations::Mutationand the arena's access observer, which already callForgetPagesandForgetInaccessiblePageson macOS, becausePageStates::initializeregisters them whenever the arena exists.cac5b49c0key/lookup/validatedecodeprecheckmach_vm_regionshare of all samplesThe menu is held by the GPU, so the fps gain is small there. Gameplay, played by hand from the same save along the same route, one run each:
cac5b49c0decodekey/lookup/validateprecheckmach_vm_regionshare of all samplesOn
54845a456the same change gave the same picture (two runs with it, 21.0 and 20.9 fps over the same 8 windows, against 16.9 without).Tests on the same build, without and with the change:
ctest -R '^agc' -j8has the same 12 failures out of 787 (the 11 listed in my last comment on #7332 andagc_driver_pooled_buffer_range), andctest -E '^agc|video_?out|flip|display' -j4passes 798 of 798.The change (on top of
cac5b49c0; the macOS branch is the same in 845ab8c34)2. @yripper @krishalivaibhav: the strict replacement for the
NoContractionhelpers is in #7332On 10-14 you suggested a strict helper on the translator side, and @yripper offered an A/B on PPSA28997. #7332 now carries one as
a243f0c93(thanks, @ycarogabriel-lgtm): on MoltenVK,EmitFPMul32,EmitFPAdd32andEmitFPSub32emitFma(a, b, -0.0),Fma(1.0, a, b)andFma(-1.0, b, a)without the decoration. Each rounds once, so it gives the plain operation's result, and the-0.0addend keeps a -0 product, the point @Zheorgyan raised with SPIRV-Cross #2704. It needs no MoltenVK update. On Lana it took the menu from 22.1 to 40.6 fps and gameplay GPU time from 56-57 to 27 ms per frame, with 8 more^agctests passing (https://github.com/boykopovar/AnyPS5/pull/7332#issuecomment-6266153970).@yripper, would you run the A/B you offered on PPSA28997: GPU time per frame on
cac5b49c0against your build withoutNoContraction, same scenes? @krishalivaibhav, Balatro too, if you still have it set up.3. Small allocations under Rosetta:
MallocNanoZone=1With the change from section 1, the queue worker spends 31% of its gameplay samples in
mallocandfree(tiny_malloc_should_clear,szone_malloc_should_clear,free_tiny), and the draw pipeline thread 18%. The allocations are spread over many sites (bindings, snapshots, results), and many blocks are freed on the other thread. A translated process does not use the nano allocator unlessMallocNanoZone=1is set at launch; with it, the samples move tonanov2_*. In a loop, x86-64 under Rosetta:MallocNanoZone=1free+malloc, 32 to 128 bytesfree+malloc, 256 bytesLana with section 1's change, without and with
MallocNanoZone=1. The gameplay rows come from one fixed spot: the save is restored before each run,tools/pad_input.pypresses PLAY, the slot and RESUME, and Lana then stands still in the village with no input. 8 windows of 10 s per run, the two arms alternated (without, with, without, with):d0fdf30ed, fpscac5b49c0, two traced runs: queue worker in the allocatorOn
cac5b49c0,ctest -R '^agc'andctest -E '^agc|video_?out|flip|display'give the same results with it as without (12 failures out of 787, and 798 of 798). Since libmalloc reads the variable once at process start, the simplest place istools/macos/run.sh(export MallocNanoZone=1, whichrun-profile.shinherits) and a line indocs/user/MACOS.md. I do not know why nano is off by default for translated processes; nothing here broke with it on, but if anyone knows a reason, it would change this.Not checked: Linux and Windows (section 1 only moves the Linux branch's
recordRunabove the#ifdef, and section 3 is a macOS launch setting; I did not build either there); titles other than Lana; more than one gameplay run per arm for section 1 oncac5b49c0;MallocNanoZone=1while moving through the level (only the fixed spot); ranges outside the arena, such as the guest images, which are still queried every time as on Linux (they no longer show in Lana's profile); whether Metal's compiler rewritesfma(a, b, -0.0)into a multiply it could then contract (no exactness test regressed, but I have not read the AIR).AI-assisted: yes (Claude Code). I ran all of the above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-19T17:42:08Z.
Taking the
pixel_interlockcase on MoltenVK — announcing before the PR.@Zheorgyan found the cause of the argument-buffer compile error on 2026-10-08, @shanto462 offered to take it and no PR came of it, and @jotitadev measured the second blocker on 2026-10-18. I am picking the whole
agc_driver_pixel_interlockcase up and will open a PR tomain; this is the announcement, per the practice in this thread.Environment
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LAYER_PATHset so the layer is really inserted (the loader silently ignores a missing layer otherwise).mugurc/ci/macos-series-2ata0a9e8398, plus theJit.cppandGuestMemoryLifetimeSupport.hppparts of #7332, as @jotitadev did on 2026-10-19: the series does not build on macOS without them (MFD_CLOEXECis Linux-only inlibkernel/DirectMemory/Jit.cpp).What I measure with
ctest --test-dir build -R agc_driver_pixel_interlock -Von the port treeAGC graphics: vkCreateGraphicsPipelines: Vulkan result -3, after MoltenVK reportstype 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'with
field with illegal attribute 'raster_order_group' declared here— the error @Zheorgyan and @shanto462 reported. 0VUID-errors from the validation layer.skipped, the device does not support atomics on buffer device addresses. 0VUID-errors and no new validation output, so the change adds no validation error to either log.What the change is. A global (flat) atomic reaches its target through a Vulkan buffer device address (
OpConvertUToPtrover aPhysicalStorageBufferpointer), so the read-modify-write is atomic only where the driver guarantees atomics on such an address. Metal has no atomic on a device pointer, so on MoltenVK the update is a load and a store and concurrent updates to one address are lost. The change excludesVK_DRIVER_ID_MOLTENVKin aBdaAtomicsUsablehelper, the same shape asRobustBufferAccess2UsableandFragmentShaderBarycentricUsable, andagc_driver_pixel_interlockskips there instead of failing. The technical-debt entry records the limitation.Why no other test catches it.
agc_driver_global_atomicsgives every lane its own address (op * OpStride + tid * 8u), so it checks the value of an uncontended read-modify-write and cannot tell an atomic from a load and a store.agc_driver_pixel_interlockis the only test that counts overlapping updates to one address, and it is the one that skips on MoltenVK. So the contended case is not covered on macOS, and a title that counts or locks through a flat atomic on macOS sees lost updates. I have no title to measure that with, and I am not putting a number on it.What I am not doing. I am not fixing the argument-buffer compile error: the
raster_order_groupis added by MoltenVK's own SPIRV-Cross, and making the atomic resolve to a descriptor-bound buffer instead of a device address would change the BDA table ABI (BdaAbi::Rangecarries a flat device address). That is a separate piece of work, and I would rather it were a separate PR.I will open the PR with the
mainand the change measurements side by side.Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-19T20:55:57Z.
@imellag thank you for the profile and the change.
feat/agc-macos-guest-pagesnow records the macOS page runs in the page-state table as you proposed (b73bddb1a, with you as co-author).ci/macos-series-2has it (b84909f34, a fast-forward from a0a9e8398) and is now onmain9127ea36d.On an M5 Max, macOS 26.5.1, under Rosetta, the library tests without a Vulkan loader show no new failure from the series. That run skips most AGC tests, and I did not run the GPU suite or a title with the change, so your
^agcand Lana runs are the evidence for it.For anyone building the series on today's
main:QueuedIndexReadOrder.cppdoes not compile on macOS. It appliesreinterpret_cast<std::uint64_t>to astd::uintptr_t, which are different types there (unsigned longandunsigned long long).static_castcompiles;ci/macos-series-2carries that as its own commit (b84909f34) untilmainhas a fix.mainadded or changed today fail on macOS. I have not looked into them yet:guest_floating_point(#6985): "flag updates preserve exception masks".guest_time_conversion(#6916): times out.unwind_callback_abi_backtraceandunwind_callback_abi_forced_unwind(#6851): "_Unwind_Backtracestops when the callback asks" and "_Unwind_ForcedUnwindcalls the stop function once".guest_bad_optional_access(#7872): the exception reachesterminate.Imported from boykopovar/AnyPS5. Originally posted by Cloud-Multiplayer on 2026-10-20T01:43:13Z.
A write watch finding for anyone running a title under Rosetta: guest threads can end up with
SIGSEGVandSIGBUSblocked on the host, and from then on Rosetta never delivers write-watch faults from those threads. Setup: Apple M3 Pro, x86-64 under Rosetta 2, MoltenVK 1.4.2, my loader-based branch with currentmainmerged (the libkernel and write watch code involved is the same as onmain).Symptom. A title stopped after about 30 submits with no frame. Its render thread sat on one store into guest memory (a
memcpyinto its constant ring, another timeAgc::Command::PatchIndirectCount).com.apple.rosetta.exceptionserverwas at 100% CPU the whole time, and the write watch's handler was never entered for that store: its fault counter did not move. The page was armed (kernel protection read-only, the watch's logical protection read/write).Cause.
scePthreadCreateblocks every signal aroundpthread_create(sigfillset,SIG_BLOCK, thenSIG_SETMASKback to the creator's mask), and the new thread restores the creator's mask inRunThread. In my runs the title's main thread ended up with all signals blocked (0xfffefeff), and every thread it created afterwards inherited that mask throughcreatorMask: the render thread, and the AGC driver thread thatDriver::enqueuestarts from it. I have not pinned down the exact step that leaves the main thread blocked; my guess is a write fault inside the window, delivered by Rosetta once the mask is put back, whose handler's return restores the blocked mask, but I have not confirmed that.With the fault signals blocked, a store to an armed page goes one of two ways under Rosetta:
SIGBUS, notSIGSEGV.)Both happen in the same run.
Fix I am using. Leave the synchronous fault signals deliverable in the window, and unblock them when a guest thread starts (the guest's own mask is emulated in libkernel, so this does not change what the guest sees):
Result. Same title, same build otherwise: about 30 submits and no frame before, about 770 submits and flips in the first 60 s after. The same-value store into an armed page now delivers its fault and the watch records it. The title then stops at a separate GPU hang in one pixel shader, which I am still looking at; its inputs on the GPU side are correct with the fix.
Not checked. Linux and Windows (the change is Apple-only); the other titles in this thread; whether it explains other stalls reported here where a recorded batch never finishes. If you run the write watch on macOS and see a thread parked on a store with the Rosetta exception server busy,
pthread_sigmask(SIG_SETMASK, nullptr, &mask)on that thread is the quick check.AI-assisted: yes (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-20T17:53:21Z.
@Alexius0815 @DavidSamir thanks for following up, implementing the tessellation fallback, and sharing your M2/M4 results. I was away from my device for several days and am back working on the macOS side now.
I see #7308 and #7124 have merged. It is completely fine that you moved ahead; I will compare our local fallback against the merged implementation and test that rather than open a duplicate PR.
Our last local M2/Rosetta/MoltenVK runs reached gameplay in Balatro and Vampire Survivors, and a responsive menu in Don’t Starve Together. These were combined local Mac builds, not clean current-main validation or claims of complete compatibility. Balatro’s menu was around 45–51 FPS, but entering the tutorial dropped it to 25–26 FPS. The captured trace shows GPU busy time rising from roughly 19–21 ms to 38–39 ms per frame; that gameplay performance work remains unresolved.
I am checking the current macOS series against our saved local changes before updating the runtime. I also need to pick up the rebase handoff on #6747 and refresh its validation. I will share exact revisions and focused results as that work is completed.
AI-assisted: yes; I am responsible for the reported local observations.
Imported from boykopovar/AnyPS5. Originally posted by Mauro42K on 2026-10-20T19:08:48Z.
Hi everyone,
I'd like to contribute to the AnyPS5 macOS / Apple Silicon effort.
I have a MacBook Pro with an M1 chip and can dedicate time to testing, investigating issues, and helping with development using OpenAI Codex.
I'm particularly interested in:
I understand that several contributors are already working on macOS support, and I'd prefer to coordinate with the existing effort rather than duplicate work.
I'll follow the project's contribution guidelines, verify any AI-assisted changes, and provide reproducible test results with logs and environment details.
Are there any specific open issues or pull requests where testing on an M1 Mac would be especially useful? I'm happy to start with a small, well-defined task.
Thanks for the work you're doing on this project!
Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-20T19:31:46Z.
@Mauro42K welcome. One well-defined task where an M1 would add something nobody has measured yet: two open MoltenVK shader PRs I have only run on an M4 Pro, which depend on how the Apple GPU and the Metal compiler behave.
hardware (0 of 5472 probe results differ from the emulated flush).fmaon MoltenVK instead of SPIRV-Cross'soptnonehelper calls. The newagc_driver_f32_separate_roundingfails if Metal fuses a multiply into the add after it.maindoes not build the libraries on macOS yet, so the branchimellag:test/m1-probe-fmahas both on top of mugurc'sci/macos-series-2plus #7937 (needed for libkernel) and #8477, as three commits to test in turn:2bfbc2fcfa4a16a6f842c3fd09aSteps (Vulkan SDK from LunarG installed under
~/VulkanSDK):guest_math_testsdoes not compile on macOS (libc++ has nostd::cyl_bessel_j); that one build failure is expected. SetDYLD_LIBRARY_PATHin front of the command as above, not throughenv, which macOS strips it from.What would help, posted on #8578 and #8612:
ctest-<commit>.log);[float-controls]lines inlasttest-a4a16a6f8.log(grep float-controls);agc_driver_f32_separate_rounding,agc_driver_f32_arithmetic_nanandagc_driver_f32_denormal_flushpass at42c3fd09a, with the first failing line if not.For comparison, on the M4 Pro (macOS 27.0.1, MoltenVK 1.4.2): 46 failures at the base (807 tests), the same 46 with #8578 (808), 32 with #8612 as well (809; 14 fixed, none new). The probe logs
hardware (0 of 5472 ...)at both later commits. At the last commitf32_separate_roundingandf32_arithmetic_nanpass andf32_denormal_flushstops at lane 8 (v_fma_f32), a case neither PR touches.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Alexius0815 on 2026-10-20T20:59:39Z.
A data point for anyone whose title seems frozen on its first start on Apple Silicon: one compute shader can keep MoltenVK busy in the Metal compiler for over a minute.
vkQuake (PPSA99010) on an M4, macOS 27.2, MoltenVK 1.4.2, x86-64 under Rosetta, community macOS stack.
sampleon the guest during the "frozen" first start shows the AGC driver thread invkCreateComputePipelines→MVKMetalCompiler::compilefor the same compute shader at 8, 16, 30 and 50 s, first building the library, then specializing the function.I extracted that module from the shader disk cache (about 413k SPIR-V words), translated it with current SPIRV-Cross (
--msl --msl-version 30100) and timed the system Metal compiler directly throughMTLDevice(the sameMTLCompilerServiceMoltenVK uses, no Xcode needed):newLibraryWithSourcenewFunctionWithName:constantValues:newComputePipelineStateWithFunctionOn later starts macOS's own Metal cache makes this fast, so it looks like a one-time freeze. Two consequences: a smoke test with a short time limit (ours used 20–25 s) can mistake the first start for a hang, and a cold cache shifts any timing-related symptoms. The translated MSL is about 2.4 MB for that one kernel.
I haven't looked at which part of the generated SPIR-V makes the back end that slow; the module has about 2600 selections, 114 loops, 144 subgroup shuffles and 200–330 ballots.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Mauro42K on 2026-10-21T00:34:44Z.
@imellag Thanks for suggesting these M1 tests!
I've completed the three-commit comparison on my Apple M1 (macOS 27.0.1, MoltenVK 1.4.2) and posted the detailed results directly in the PRs as requested:
The float-controls probe reported 0 differences across 5,472 results. With #8612, 14 previously failing tests passed with no new failures in the reference suite. The key f32 results also match your M4 Pro findings.
Thanks again for coordinating this. Happy to help with further M1 testing if useful!
Imported from boykopovar/AnyPS5. Originally posted by tkcm01 on 2026-10-21T06:14:02Z.
M4 data point and one split-out fix.
Apple M4, macOS 27.0.1, Apple clang 21, x86-64 under Rosetta 2, no Vulkan loader.
ci/macos-series-2at 53db0badb with #7524, the code commits of #7937 and the libSceSsl change from #7332:ctest -j4gives 1648 tests, 1017 passed, 16 failed. Stable failures (15):guest_math,guest_math_exact,guest_standard_streams,agc_write_tracking,agc_performance_overlay_statistics,guest_sce_net,guest_memory_lifetime,guest_filesystem,guest_host_standard_error,guest_itimer,guest_shm_open,guest_poll,guest_socket_pair,guest_kernel_app_archive_mmap,guest_flexible_memory_declared. Flaky:precise_waitandguest_refused_connect(pass alone). All of these are on the list in #7631;guest_jit_shared_memory,guest_socket_read_writeandguest_kqueuefrom that list pass here.guest_standard_streamsis fixed by #8920 (the macOSfflushguard, split out of #7201). I'm not taking any of the others without asking here first.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-21T07:57:35Z.
M2 progress update: I have posted a focused comparison of #8612 on the published macOS integration branch, including validation-layer checks and the remaining denormal failure: https://github.com/boykopovar/AnyPS5/pull/8612#issuecomment-6311017152
Balatro (PPSA21402) reaches about 49–50 FPS in the menu and roughly 30 FPS in active tutorial play with the candidate, while some tutorial sections remain around 18–20 FPS. The matching baseline was around 15–20 FPS in gameplay. Trace intervals support that direction, but these were manual runs with different progression timings and separately warming caches, so this is preliminary evidence, not a controlled speedup or a 60 FPS claim. A brief startup hitch remains.
Separate rounding and NaN tests pass on the M2; the candidate gets past the baseline signed-zero multiply failure but still fails the known fused lane-8 denormal case. No VUID errors were logged in the focused validation runs. Full results and limitations are in the linked comment.
I am continuing with warm same-scene measurements and profiling the slower tutorial sections, using the shared shader work rather than opening a duplicate implementation. The other two titles have no new verified result in this pass.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-21T08:22:04Z.
Further Balatro (PPSA21402) M2 progress, following the #8612 comparison above.
A local validation-cache experiment now keys zero-variant compiled stages by their content/pipeline identity instead of forcing validation to rescan them on every draw. This is additional local work, not part of #8612 or merged main. The profile previously showed over 36,000 uncacheable draws in one 10-second interval, with about 5.3 s in the broad validation phase. With the experiment, validation memo hits rise into the tens of thousands. A focused barycentric-rendering test passes; the existing separate-rounding/NaN results and known fused lane-8 denormal failure are unchanged.
The first faster package aborted with
null or misaligned index base. A diagnostic run captured a nonemptyDRAW_INDEX_2(count=max_size=6) at misaligned base0x2c4eb7c6a, so this is not evidence for the bounded-zero-tail behavior proposed in closed #4824. The comparison integration had omitted the command-allocation synchronization change from #6747. After restoring it, its regression test passes on M2 with validation actually loaded and no VUID lines (the recorder fixture also needed to enable advertisedVK_KHR_portability_subset). This makes command-memory reuse a hypothesis for that abort, not a proven root cause.In the subsequent human run: boot/main menu around 60 FPS, setup about 30, active play around 40–45 with occasional brief dips near 20. The trace records 1,382 presentations across a 30.066-second active-play window (~45.97/sec), GPU busy about 21 ms/present. At 175 seconds the process was still alive past the previous failure point, with no index-failure line.
Limits: one bounded manual run, local macOS integration plus the common tessellation memo, arithmetic work, new cache experiment and restored command guard. No claim of stable game completion, sustained 60 FPS gameplay, or a controlled speedup ratio. The cache experiment still needs dedicated identity/invalidation regression coverage, current-main applicability/overlap review and matched baseline validation before any PR. I am keeping the earlier tested package available.
Next bottleneck is the remaining ~21 ms GPU budget and scene-dependent dips. AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by Gonic0 on 2026-10-21T17:08:30Z.
Hi all, first time posting here. I'm on an Apple M5 Pro, macOS 27.2, x86-64 under Rosetta 2, MoltenVK from Vulkan SDK 1.4.363.0.
@tkcm01 your M4 run lists
guest_sce_netas a stable failure. I hit the same thing and traced it to two spots where XNU behaves differently from FreeBSD:inet_ptonaccepts"01.2.3.4", while FreeBSD refuses a leading zero.socket(AF_INET, SOCK_STREAM, IPPROTO_UDP)fails withEPROTOTYPEon XNU instead ofEPROTONOSUPPORT.#9231 fixes both behind
#ifdef __APPLE__. Hereguest_sce_netpasses 5 runs out of 5 with it, and without each commit it fails atGuestSceNet.cpp:786and:151. The same two hunks are also part of #8658; this PR just takes them on their own so they can go in separately.If anyone has a few minutes on a different chip (@Mauro42K, you mentioned testing focused PRs on your M1), running
ctest -R '^guest_sce_net$'with #9231 on top of your macOS tree would be a really useful second data point. Happy to return the favour and run other PRs on the M5 Pro.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Mauro42K on 2026-10-21T19:38:03Z.
Hi @Gonic0 — thanks for suggesting this M1 check!
I ran
guest_sce_netfive times on my Apple M1 MacBook Pro (8 GB RAM, macOS 27.0.1), using a Release x86_64 build under Rosetta 2 with Apple clang 21.Results: 5/5 PASS, no failures or timeouts.
e0a3ccec02434abbd104a3c7a6141cece68b1533from #8658.This commit already includes both
libSceNetfixes from #9231. I did not run an isolated #9231 build or pre-fix controls, so this confirms the combined macOS branch passes on M1 rather than independently attributing the result to #9231.The original checkout remains unchanged. Happy to help with further focused M1 testing!
Imported from boykopovar/AnyPS5. Originally posted by Alexius0815 on 2026-10-21T20:51:59Z.
A correction to my Metal compile-time note above, and what it means for vkQuake (PPSA99010) on Apple Silicon.
Correction: I wrote that macOS's own Metal cache makes later starts fast. That is wrong for the expensive part. On the same M4 (macOS 27.2, MoltenVK, x86-64 under Rosetta, community macOS stack),
newComputePipelineStateWithFunctionfor that kernel took 64.5 s even in a run where the library came from the OS cache in 0.0 s, and 63.6 s again today. WithMTLLibraryOptimizationLevelSizeit takes 66.2 s. In a guarded title run with warm AnyPS5 shader and pipeline caches (16 of 17 shaders hit),sampleat 15 s still shows the AGC driver thread inVulkanDevice::createComputePipeline→ MoltenVK → Metal. So it is not a one-time freeze. It happens on every start.Why vkQuake quits: vkQuake brings its own radv and logs to
app0/trace.txt. In all 16 logged runs that got past start-up, it boots normally (Host_Init,quake.rc,default.cfg, lightmap compute surface), and then radv reportsthe GPU has not reached submission 18 (at 17) in 10 s. The four runs that were not stopped earlier (by our watchdog or by hand) go on tovkWaitForFencesreturning-4(device lost). The game then showsQuake Error: vkWaitForFences failed with code -4and exits with status 1. The host process itself can end with status 0, which hides this unless you readtrace.txt.So the chain is: a compute pipeline that needs more than 60 s to build on the AGC thread → the guest's 10 s fence timeout → device lost → Quake error exit. The picture stays on the first frame until then. I checked that with per-frame hashes of a window recording. On this stack, the "recorded batch still running on the GPU" stall that some of us saw with vkQuake only appears afterwards, during shutdown.
The lever therefore seems to be the shape of the recompiled kernel rather than Metal settings. I'll try to narrow down which construct makes the Metal back end that slow (the module has about 2600 selections, 114 loops, 144 subgroup shuffles and 200–330 ballots) and report back.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-21T23:53:08Z.
Taking
guest_pollon macOS — announcing before the PR.@tkcm01's list of stable failures includes
guest_poll, and @mugurc's five are down to two on the current series. This is the announcement for the first one I can close.What I measure on the series head
53db0badbplus theJit.cpppart of #7937 (the series still does not build on macOS without it), Apple M4, macOS 27.0.1, x86-64 under Rosetta:guest_floating_point,guest_time_conversionandguest_bad_optional_access. The remaining two areguest_itimerandguest_poll.guest_pollfails at its out-of-band case: a peer sends one byte withMSG_OOB, the guest polls forPOLLPRI, and the poll returns 0 with no events. The same test passes on Linux with lavapipe.guest_itimerfails with an explicit message,delivering SIGALRM to a guest handler is not implemented, which is a different and larger piece of work; I am not taking that one here.The cause, measured on the host. XNU's
pollnever reportsPOLLPRIfor out-of-band data: with a byte pending,poll(POLLPRI)returns 0 andreventsstays 0, whileselect's exception set reports the socket once the segment has arrived.SIOCATMARKis not usable for this on macOS: it returned 0 before, during and after the urgent byte, where Linux returns 1 while it is pending.The change. On macOS only,
POLLPRIcomes fromselect's exception set, and a wait that asks for it is polled in 10 ms slices so it wakes when the byte arrives instead of sleeping to its timeout. Every other flag and error still comes frompoll, and Linux and Windows are untouched.Verified
Jit.cpp+ this change:guest_pollpasses, and the other fifteen socket, TCP, UDP and poll tests pass.guest_socket_pairfails with and without the change, which is the pre-existingSOCK_SEQPACKETgap the technical-debt entry already records.guest_pollpasses before and after; the change is under__APPLE__.python3 tools/check_conventions.py --base origin/main: all conventions checks passed.The pull request will follow with the
mainand the change measurements side by side. It overlapspoll_nid_postfixtextually with #7605 (kqueue polling, which restructures the same wait) and #8483 (a Windowscollectchange), so the order is the maintainers' call and I will rebase on whichever lands first.Imported from boykopovar/AnyPS5. Originally posted by Gonic0 on 2026-10-21T23:54:39Z.
Thanks a lot @Mauro42K, that's really helpful, and good point that this doesn't isolate #9231 yet.
If you have a couple more minutes, a quick negative control on the same tree would pin it down: revert just the two
#ifdef __APPLE__blocks incore/libs/prx/libSceNet/Export.cpp(the leading-zero check insceNetInetPtonand theEPROTOTYPEmapping insceNetSocket) and runguest_sce_netagain. On my M5 Pro it aborts atGuestSceNet.cpp:786without the first and at:151without the second. No worries if not, the 5/5 already helps.And the offer stands: if you need something run on an M5 Pro, just ping me.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-22T04:41:36Z.
M5 data point, one fix, and what the next few stable failures stop on.
Setup: MacBook Pro M5, macOS 26.2, Apple clang 21, x86-64 under Rosetta 2.
ci/macos-series-2at53db0badbwith #7524, the code of #7937 and the libSceSsl change of #7332, as in @tkcm01's run. With a Vulkan driver this time: a universal (x86_64 + arm64) MoltenVK build loaded through an x86_64 Vulkan loader, viaVK_DRIVER_FILES.ctest -j6: 1648 tests, 87 failed, 93 skipped. The non-GPU failures are @tkcm01's list plusguest_interfaces,guest_getrlimit,guest_jit_shared_memoryandguest_standard_streams(#8920).guest_interfaces: fixed in #9619. macOS'sgetifaddrsreturns IPv4 netmasks cut down routing-socket style (sa_len5 to 8, sometimes family 0), and libc picked the netmask's layout from its own family. Taking it from the address's family and copying onlysa_lenbytes makes the test pass.Where the others stop, found with lldb (it debugs x86_64 processes under Rosetta here):
guest_math: therand_r(nullptr)case atGuestMath.cpp:1031throws through libc, and the test binary has only compact unwind, so it ends interminate. With @mugurc'sconfigure_macos_unwind(#8311) applied toguest_math_testsit gets past that and then fails atCheckAcosfErrno: Apple's libm givesacosf(0.5f)=0x3f860a91, one ulp below the0x3f860a92the test expects. @mugurc, would you rather extend #8311 to the test executables (for example inadd_test_executableon Apple), or should that be a follow-up once #8311 is in?guest_getrlimit:RequireDescriptorsEndAt(GuestGetrlimit.cpp:76), thepipeloop does not end withEMFILE.guest_socket_pair:GuestSocketPair.cpp:238, aftershutdown(SHUT_WR)fstatdoes not report mode0140444.guest_host_standard_error: thewaitpidatGuestHostStandardError.cpp:80does not return the child.guest_shm_open: the sharedmmapatGuestShmOpen.cpp:43, the file-backed mapping @mugurc already pointed out in #7631.guest_math_exact,guest_interfaces(before #9619),guest_getrlimit,guest_shm_openandguest_socket_pairfail at their own checks with or withoutconfigure_macos_unwind, so the unwind tables only matter forguest_mathandguest_host_standard_error.Taking
guest_getrlimitandguest_socket_pairnext, announcing before the PRs. Nobody has claimed them here that I can see; say so if you have one in progress.Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-22T04:53:26Z.
Follow-up to my note above:
guest_socket_pairis fixed in #9625. On a connectedAF_UNIXpair, XNU'ssoshutdownlock_finalanswersENOTCONNfor a direction that is already shut, where FreeBSD'ssoshutdownreturns 0, soshutdown(SHUT_RD)after the peer'sSHUT_WRfailed. #8658 and #7201 carry the same change inside their ports; #9625 is that piece on its own.guest_getrlimit: I'm dropping my claim, it isn't what I thought. On this machine thepipeloop stops withENFILE, notEMFILE, because the system-wide table runs out first:kern.maxfilesis 122880 with about 70000 already open, and libkernel raises the guest's limit tokern.maxfilesperproc(61440).ENFILEis the right answer from the host there, so this looks like the test depending on a quiet machine rather than a libkernel bug. If @tkcm01's M4 fails it the same way,sysctl kern.num_filesduring the run would show it.Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-22T06:23:53Z.
Two more, and a correction:
guest_host_standard_erroris #9654, a test-only change. Its last check looks for libstdc++'swhat(): report kept, and on macOS libc++abi words the same reportlibc++abi: terminating due to uncaught exception of type std::runtime_error: report kept. The report does reach the host's stderr. Correction to my note above: the unwind tables don't matter for this one. Thewaitpidfailure I saw wasEINTRfrom running it under lldb; outside the debugger it only ever failed at the wording.guest_math_exactpasses here when the test is built at-O0and fails at the optimised build, with the same libc. Every check in it compares 80-bitlong doublebits (signalling NaN pass-through,errno), so I suspect Rosetta's x87 emulation rather than libc. I'm not taking it; if someone has an Intel Mac, a run there would settle it.Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-22T06:30:54Z.
Balatro (PPSA21402) on a fanless M2: what limited it to ~40 FPS, and 60 FPS with two changes. Update to my 13 October note above. Setup: MacBook Air M2 (no fan), 16 GB, macOS 27.2, MoltenVK 1.4.2, x86-64 under Rosetta 2, 1920x1080, the macOS series plus local changes (not
main, which does not build on macOS).Symptoms. 60 FPS on the menu at first, falling to ~40 after 1.5–3 minutes, and 11–22 FPS on the shop and booster-pack screens. powermetrics showed the drop is thermal: the GPU was ~95% busy at full clock, then the Air lowered its GPU clock (1365 → 840 MHz) with the same work per frame. So the fix had to be less GPU work per frame, not a higher frame cap.
Cause 1 — barycentric emulation on sprite draws (shop and pack screens). The title's sprite/text pixel shader keeps I/J live after its
v_interppairs, only as the value lanes outside the export mask keep. That sends every such draw through the generated tessellation stages, and on MoltenVK each one restarts the Metal render encoder (a full 1080p tile store and load). The pack screen issues ~730 of these per frame. A 1x1 scissor on them changed nothing; skipping only their draw call took the screen from ~11 to ~34 FPS. #9193 (imellag) fixes this by reading I/J fromBaryCoordKHRon MoltenVK. On the same untouched pack scene with warm caches: 45.4 → 60.0 FPS, frame p99 25.4 → 18.4 ms, GPU busy 21.3 → 12.4 ms per frame; afterwards only the title's rect-list draws still use tessellation (about 4 per frame, under 1 ms). Details and traces are on #9193. I had written a narrower fix for the same case and am not opening it.Cause 2 — exact GCN float emulation in full-screen shaders. The menu background (a procedural swirl, ~7 ms) and the CRT pass (~3.8 ms) are full-screen 1080p shaders, and almost all of their cost is per-pixel ALU: every f32 operation carries NaN-propagation and denormal-flush selects, and each
v_sin/v_coscomputes the native result plus two or three polynomial series. MoltenVK fast math made no difference. A local, opt-in experiment that drops those (native min/max, plain mul/add/mad, native sin/cos) cut menu GPU time ~22%. It deliberately gives up bit-exact GCN behaviour, so it stays a local experiment, not a PR; I'd welcome views on whether a per-title or user option for that would be acceptable.Result. With the float experiment plus my narrower fix for cause 1 (the session predates testing #9193, which measured better on the pack scene), a 5-minute session with shop, packs and normal play held 58–60 FPS throughout, including past the point where the Air used to throttle, with GPU time at 10–11 ms per frame and no visual problems seen. Clip of the #9193 build in normal play, FPS in the title bar:
https://github.com/user-attachments/assets/c61e8659-4615-4120-a938-92741d23f63f
What's left. The command submission thread is 94–99% busy at 60 FPS on the pack screen (~455 draws per frame at ~20 µs each; vertex data is already used in place), so CPU is now the tightest margin. A finding worth knowing for anyone profiling on Mac: per-pass GPU timestamps (pass splits) cost several FPS by themselves here, and the overlapping per-pass ranges are not exclusive GPU time; the fence-based
gpu_busy_ms_per_presentin the trace summary is the reliable number.AI-assisted: yes (Claude Code). Measurements are from my M2; gameplay observations are mine.
Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-22T07:05:32Z.
Proposal: keep the f32 NaN emulation exact, but pay for it only when a NaN appears. This is about the same cost as @krishalivaibhav's "cause 2" above. It's a design I'd like feedback on before writing it.
What it costs today.
TranslationContext::nanResultF32wraps every f32 add, sub, mul and fma: if a source is NaN, the result is the first NaN source (quieted in IEEE mode), otherwise a generated NaN becomes0xffc00000. In MSL that is three or four(x & 0x7fffffff) > 0x7f800000tests and selects per operation. Apple GPUs return0x7fc00000for every NaN result, so the payload can't come from the hardware.Measured on an M4 Pro (macOS 27.0.1, MoltenVK 1.4.2),
main+ #8658 + #9193 + #9263 + #8612. The off arm uses a local switch that returns the raw result; it is for measurement only and not exact:The f32 denormal flush already runs in hardware on this stack (#8578:
0 of 5472 probe results differ), so these selects are the main per-operation emulation cost left.What I tried. A Metal compute microbenchmark: 16M threads, 4 independent chains of 48 mul/add/fma each,
mathMode = .safe, variants interleaved over 40 rounds after warm-up, median GPU time. Every exact variant's output is compared bit for bit with the current form.if (isnan(r)) r = chainA branch per operation (C) saves only about a fifth. Doing a region plain and re-running it exactly only when a NaN shows up (D) costs about the same as plain code while NaNs are rare. It falls back to the cost of today's form when many lanes in a SIMD group hit a NaN.
Proposal (D as an IR pass, exact for every input):
isnanof each fast result whose NaN could leave the region or be hidden inside it. A result whose only users are other emulated add/sub/mul/fma in the same region needs no check, because those operations always return a NaN when a source is NaN, and their own results are checked. Results used by anything else (legacy multiply's zero select, min/max, compares, conversions, bitcasts, live-outs) are checked.nanResultF32chains and use those results.Why it is exact. When no checked result is NaN, no emulated operation in the region produced a NaN, so every select in today's chain returns the raw result. The fast path's bits are then the exact path's bits. When any result is NaN, the region runs today's code. So the existing emulation stays the only definition of the NaN behaviour, and no new RDNA hardware oracle is needed.
Costs and risks to measure:
Tests: the existing
f32_arithmetic_nan,f32_separate_roundingand denormal tests, plus new cases with a NaN produced in the middle of a region and hidden by a min/max, a compare and the legacy multiply.Questions:
SpirvBdaFault.cpp)?AI-assisted: yes (Claude Code). The measurements are from my M4 Pro.
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-22T08:07:39Z.
@imellag yes: your design would cover the NaN part of my experiment exactly, and on Balatro that is the largest single piece of it. I split the experiment apart to check.
Setup: MacBook Air M2 (fanless), macOS 27.2, MoltenVK 1.4.2, the macOS series (42c3fd09a2b6 plus local changes;
maindoesn't build on macOS), Balatro (PPSA21402) main menu, which is dominated by two full-screen 1080p shaders: a procedural background (27v_sin/v_cos, no samples) and the CRT pass (51 samples). Same build for every arm, each arm with its own warm shader cache,APS5_TRACE_SECONDS=12:15, no other trace or profile switch. A local measurement switch returns the raw result fromTranslationContext::nanResultF32(like your off arm, not exact).The f32 denormal flush is already in hardware on the M2 too:
[float-controls] f32 denormal flush: hardware (0 of 5472 probe results differ from the emulated flush), so as on your M4 Pro the NaN selects are what is left of the per-operation cost.Generated code (SPIR-V from the shader dump, through
spirv-cross --msl), the three heaviest pixel shaders:> 0x7f800000NaN testsGPU time per frame (fence-based
gpu_busy_ms_per_present; the menu is vsync-locked, so FPS stays at 60 either way):nanResultF32offSo about 0.8–1.7 ms per frame (7–13%) on this scene. For comparison, my earlier opt-in experiment as a whole (NaN, denormal and tiny-product flush off, native min/max/med3/clamp,
v_macas one fma, native sin/cos) measured 12.9 → 10.7–10.9 ms on the same menu; native sin/cos alone was about 1.1 ms of that, and native min/max and the fusedv_macwere within noise.What your design would not reach, from the dumps: the NaN tests left after dropping
nanResultF32come from other paths: the signaling-NaN quieting aroundFPMin/Max/Med3(ieeeMinMaxF32), conversions, and the range handling inside thev_sin/v_cosemulation (each computes the native result plus two or three polynomial series and selects between them). Those would stay at today's cost. The trig series is the other cost worth a separate look for shaders like this background.On the region split: these are long, mostly straight-line shaders (the background's only branches are a few bounds-checked uniform loads at the top), so one region per block would be large; the size cap and register pressure you mention will matter here. If you build it, I can run it on this scene on the M2 and post the same numbers.
AI-assisted: yes (Claude Code). The measurements are from my M2.
Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-22T09:55:38Z.
@rooklz on
guest_math: here (M5 Max, macOS 26.5.1, the series at 53db0badb) therand_r(nullptr)case passes with the test binary as it is, and the first check that fails isacosf(0.5f)(0x3f860a91), which your #9668 covers.rand_rthrows a hoststd::invalid_argument, which the system unwinder handles with the test's compact unwind. The test's own tables matter only where libc's unwinder walks its frame, that is libc's__cxa_throw(as inguest_bad_optional_access) and the_Unwind_*functions.So I would keep #8311 to the targets that need the tables, rather than change every test executable on macOS. If the
rand_rcase still ends interminateon your machine, could you post what it prints, and whether yourlibc.prxshows__eh_frameundersize -m? If it reproduces, I'll addguest_math_teststo #8311.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T10:25:09Z.
Follow-up on my 10-18 note about the two tests that are intermittent on Apple. I said
agc_driver_cross_workgroup_flagdidn't look like store visibility, and that was only partly right. Setup: M2 Max, macOS 27.2, x86-64 under Rosetta, #8658 @f48446abb, MoltenVK 1.4.2 and MoltenVK main + SPIRV-Cross #2704.agc_driver_cross_workgroup_flag: two causes. In a local copy of the test, the reader stores the poll count at which it saw the flag (40 wave64 and 40 wave32 dispatches per process, 6 rounds, plain store and atomic store alternating in the same binary):OpAtomicStoredevice scopeOpAtomicStoredevice scopeOpAtomicLoad, but the GLC store is stillOpStore ... VolatileinEmitBdaStoreAt. In the MSL it is a plain*(device uint*)p = 1u. On Apple the reader never sees that store on its first poll; it takes 300 to 1M polls. With the coherent aligned dword store as anOpAtomicStoreat device scope, it sees the flag on the first poll in about 95% of wave32 dispatches.So a store-side change like #2259's would be correct by the memory model, but it would not make this test reliable on Apple. I'm not proposing it on its own.
agc_driver_uint8x4_color_targetfails in 19 of 150 runs on MoltenVK 1.4.2 and 23 of 150 on MoltenVK main. The_no_residentvariant passes 150 of 150 on both. It is nearly always one of the XOR cases (SW_64KB_D_X target with XOR: byte 0 is 90, expected 49, or theZ_Xone): the target still holds the fill byte (0x5a), so the draw never reached guest memory. In 100 runs each on MoltenVK 1.4.2:host imports resolve write protection: no ... imported ranges stay watched)APS5_WRITE_WATCH_IMPORTS=watchAPS5_WRITE_WATCH_IMPORTS=unwatchAPS5_NO_HOST_IMPORT=1APS5_NO_WRITE_WATCH=1APS5_PACKET_EPOCH=1So on macOS, with host imports that stay watched, the resident target's write-back sometimes doesn't show up in the guest read. The full
^agcset withunwatchgives the same 18 failures as the default, sounwatchcosts nothing in the suite. I haven't found where the write-back is lost: the probe may not cover this case on macOS, or the flush may race with re-arming the protection.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by tkcm01 on 2026-10-22T10:39:21Z.
@rooklz on
guest_getrlimit: it passes on the M4, 3 runs of 3 (same tree as my earlier list), which fits your explanation. Herekern.maxfilesis 184320,kern.maxfilesperproc92160 andkern.num_filesabout 8550 before and after the runs, so the per-process limit is reached long before the system table and thepipeloop ends withEMFILE. On your machine 122880 − ~70000 open leaves fewer than the 61440 per-process limit, henceENFILE.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Mauro42K on 2026-10-22T12:37:16Z.
Hi @Gonic0 — I completed the requested negative controls on my Apple M1 MacBook Pro (8 GB RAM, macOS 27.0.1).
Tested commit:
e0a3ccec02.I used a separate worktree and build, reverting each of the two macOS-specific blocks in core/libs/prx/libSceNet/Export.cpp independently.
Results:
These results support that both fixes are required for the test to pass on this M1 configuration.
Limitation: CTest recorded the aborts but did not print the exact failing assertion or source line. I also attempted LLDB, but it stalled while launching the x86_64 executable under Rosetta 2, so I cannot independently confirm the specific assertion locations you observed on M5 Pro.
The worktree was restored to a clean state. Detailed logs, patches, and hashes are retained locally.
AI-assisted: yes. Codex was used to perform and document the validation.
Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-22T14:46:28Z.
M5 data point: 32 catalog homebrew titles run natively, converted with
--macos --to-rosetta, on MoltenVK.Same tree as my earlier notes (
ci/macos-series-2at53db0badbwith #7524, the code of #7937 and the libSceSsl change of #7332), macOS 26.2, Apple clang 21, x86-64 under Rosetta 2; MoltenVK built from the MBridge copy with an x86-64 Vulkan loader, 75 s per title, no game data supplied. The emulator-side stops, grouped:AGC graphics: device does not support mesh shaders(this MoltenVK reports no mesh-shader feature)AGC driver: a pixel shader on the mesh path reads barycentrics, and this device has neither VK_KHR_fragment_shader_barycentric nor mesh shaders(the extension is listed, its feature reports false)AGC graphics: last provoking vertex requires VK_EXT_provoking_vertex with provokingVertexLast enabled(listed, feature false;MVK_CONFIG_USE_METAL_PRIVATE_API=1does not change it on this build)vkCreateGraphicsPipelines: Vulkan result -3, Metal refusing afloat4output on a UINT attachment: #9783Guest TLS access without a non-empty PT_TLSfrom the tree's relinker (emptyPT_TLSplusfs:accesses);main's relinker converts all five, so this is already fixed thereForbidden syscall instruction; converts with--trap-sdk-syscall-stubsThe rest stop in their own code: PPSA99620 and PPSA99621 (Ship of Harkinian, 2 Ship 2 Harkinian) crash in a guest thread reading
0x20(%r12)withr12null (EXC_BAD_ACCESS, all frames in the title until libkernel'sRunGuest), which looks like a missing-asset null since they have no OTR data here; the others ask for their game files and exit. PPSA99666 DOOM, PPSA47402 Syobon Action and PPSA99429 ApricotGS render frames (AGC compute presentation on DOOM,gpu-display flipcounters on ApricotGS). Bring-up threads exist for PPSA98512 (#9758) and PPSA99630 (#9762).The first four rows are driver or MoltenVK capability gaps rather than title bugs; the mesh-shader and barycentric rows alone account for nine titles. I'm not taking any of them without asking here first.
AI-assisted: yes