macOS support #1

Open
opened 2026-09-24 17:29:25 +00:00 by TheGuyWhoIsIdiot · 168 comments
TheGuyWhoIsIdiot commented 2026-09-24 17:29:25 +00:00 (Migrated from github.com)
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5572097800 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1). Originally posted by [TheGuyWhoIsIdiot](https://github.com/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.
boykopovar commented 2026-09-24 19:18:51 +00:00 (Migrated from github.com)
Author
Contributor

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:

  1. It doesn't require reworking the overall rendering logic for a less efficient version.
  2. MoltenVk won't build on Linux and Windows (as far as I know, that's easy to do).
  3. It's x86-64, like yours.

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5820635974 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-5820635974). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-09-24T19:18:51Z. --- I'm not against a pull request for macOS support if: 1. It doesn't require reworking the overall rendering logic for a less efficient version. 2. MoltenVk won't build on Linux and Windows (as far as I know, that's easy to do). 3. It's x86-64, like yours. But for macOS, I'm more concerned about the [libc.prx](https://github.com/boykopovar/AnyPS5/tree/main/core/libs/prx/libc) (especially the work of exceptions) and [libkernel.prx](https://github.com/boykopovar/AnyPS5/tree/main/core/libs/prx/libkernel) implementation. These libraries contain a lot of platform-specific code.
Vladislav-Kalinkin commented 2026-09-25 05:11:40 +00:00 (Migrated from github.com)
Author
Contributor

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5827160250 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-5827160250). Originally posted by [Vladislav-Kalinkin](https://github.com/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).
franpeza commented 2026-09-26 16:40:13 +00:00 (Migrated from github.com)
Author
Contributor

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

  1. Rendering: the rendering logic is unchanged. Vulkan runs through MoltenVK. The only shader-side change: MoltenVK has no subgroup operations in vertex shaders, so the recompiler emits single-lane equivalents for stages the device reports as unsupported. The default is all stages supported, so nothing changes on Linux or Windows.
  2. MoltenVK: only fetched and staged on Apple; nothing is built on Linux or Windows.
  3. x86-64: yes, x86-64 under Rosetta 2.

libc exceptions and libkernel (the concerns you mentioned)

  • The exception runtime now reads RTTI through its own Itanium-ABI structs instead of libstdc++ internals. Only the host glue for exception_ptr differs between libstdc++ and libc++.
  • libc.prx remains the process-wide exception runtime
  • The libkernel and libc changes are mostly #if APPLE branches.

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5847981386 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-5847981386). Originally posted by [franpeza](https://github.com/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 1. Rendering: the rendering logic is unchanged. Vulkan runs through MoltenVK. The only shader-side change: MoltenVK has no subgroup operations in vertex shaders, so the recompiler emits single-lane equivalents for stages the device reports as unsupported. The default is all stages supported, so nothing changes on Linux or Windows. 2. MoltenVK: only fetched and staged on Apple; nothing is built on Linux or Windows. 3. x86-64: yes, x86-64 under Rosetta 2. libc exceptions and libkernel (the concerns you mentioned) - The exception runtime now reads RTTI through its own Itanium-ABI structs instead of libstdc++ internals. Only the host glue for exception_ptr differs between libstdc++ and libc++. - libc.prx remains the process-wide exception runtime - The libkernel and libc changes are mostly #if __APPLE__ branches. 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.
theChaosCoder commented 2026-09-26 17:12:12 +00:00 (Migrated from github.com)
Author
Contributor

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5848205377 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-5848205377). Originally posted by [theChaosCoder](https://github.com/theChaosCoder) on 2026-09-26T17:12:12Z. --- Fyi Apple is phasing out Rosetta 2, with full support ending after macOS 27 (Golden Gate).
TheGuyWhoIsIdiot commented 2026-09-26 17:31:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by TheGuyWhoIsIdiot on 2026-09-26T17:31:22Z.


Fyi Apple is phasing out Rosetta 2, with full support ending after macOS 27 (Golden Gate).

Support only ends at macOS 28, though users can always dual boot older Mac versions.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5848340297 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-5848340297). Originally posted by [TheGuyWhoIsIdiot](https://github.com/TheGuyWhoIsIdiot) on 2026-09-26T17:31:22Z. --- > Fyi Apple is phasing out Rosetta 2, with full support ending after macOS 27 (Golden Gate). Support only ends at macOS 28, though users can always dual boot older Mac versions.
theChaosCoder commented 2026-09-26 17:34:15 +00:00 (Migrated from github.com)
Author
Contributor

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

macOS 27: Final release to support Rosetta — Intel-only apps will no longer run on Mac computers with Apple silicon after this update.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5848360665 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-5848360665). Originally posted by [theChaosCoder](https://github.com/theChaosCoder) on 2026-09-26T17:34:15Z. --- nope ends with 27. https://developer.apple.com/news/?id=w5ngl9k2 > macOS 27: Final release to support Rosetta — **Intel-only apps will no longer run on Mac computers with Apple silicon after this update.**
Vladislav-Kalinkin commented 2026-09-26 18:16:04 +00:00 (Migrated from github.com)
Author
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5848659488 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-5848659488). Originally posted by [Vladislav-Kalinkin](https://github.com/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.
TheGuyWhoIsIdiot commented 2026-09-26 18:54:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by TheGuyWhoIsIdiot on 2026-09-26T18:54:41Z.


nope ends with 27. https://developer.apple.com/news/?id=w5ngl9k2

macOS 27: Final release to support Rosetta — Intel-only apps will no longer run on Mac computers with Apple silicon after this update.

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5848935910 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-5848935910). Originally posted by [TheGuyWhoIsIdiot](https://github.com/TheGuyWhoIsIdiot) on 2026-09-26T18:54:41Z. --- > nope ends with 27. https://developer.apple.com/news/?id=w5ngl9k2 > > > macOS 27: Final release to support Rosetta — **Intel-only apps will no longer run on Mac computers with Apple silicon after this update.** **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.
TheGuyWhoIsIdiot commented 2026-09-26 18:55:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by TheGuyWhoIsIdiot on 2026-09-26T18:55:41Z.


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.

I genuinely think this goes against the idea of the project which targets native execution rather than being transformation recompilation.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5848942758 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-5848942758). Originally posted by [TheGuyWhoIsIdiot](https://github.com/TheGuyWhoIsIdiot) on 2026-09-26T18:55:41Z. --- > 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. I genuinely think this goes against the idea of the project which targets native execution rather than being transformation recompilation.
Vladislav-Kalinkin commented 2026-09-26 19:03:03 +00:00 (Migrated from github.com)
Author
Contributor

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?”

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5848994009 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-5848994009). Originally posted by [Vladislav-Kalinkin](https://github.com/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?”
mugurc commented 2026-10-05 20:47:49 +00:00 (Migrated from github.com)
Author
Contributor

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:

  1. Rendering is unchanged, and Vulkan goes through MoltenVK. The recompiler changes emit SPIR-V that means the same on every driver but survives SPIRV-Cross's translation to Metal:
    • ordered not-equal;
    • NaN tests on the bits;
    • subgroup results that SPIRV-Cross would otherwise move into ?: / &&;
    • a texture fence before image atomics.
  2. MoltenVK is not built anywhere. It comes from the Vulkan SDK at run time, and a packaging script copies it into an .app. The Linux and Windows builds are unchanged.
  3. Only x86-64.

libc and libkernel:

  • Exceptions:
    • On macOS, host code keeps libc++abi, because libc++ binds __cxa_throw two-level. libc.prx's runtime serves guest code.
    • Guest frames are found through their PT_GNU_EH_FRAME, using a dl_iterate_phdr emulation over the original program headers that the relinker keeps.
    • Host frames are found through __TEXT,__eh_frame; the prx are linked with -no_compact_unwind.
  • The libkernel and libc changes are __APPLE__ branches:
    • shm_open instead of memfd;
    • mach_vm_map instead of MAP_FIXED_NOREPLACE;
    • guest TLS through a per-image pthread key: macOS cannot set the fs base, so the relinker rewrites %fs accesses into stubs;
    • the guest starts on a secondary thread, so AppKit keeps the main thread.

Relinker:

  • --macos writes 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-intel places 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:

  • All non-GPU tests pass.
  • 148 of the 166 AGC and shader tests pass through MoltenVK. 16 need f64, 64-bit atomics or the shader clock, which Metal does not have. One is still open: a signed zero in an SDWA f16 multiply.
  • I have no PS5, so no commercial title was tested. Testing used the fixtures and a small Breakout guest built like a PS5 title (video out, pad, audio out), which runs at 60 fps as a double-clickable app.

The code was written with AI assistance; I reviewed and tested it.

Proposed split, each against main:

  1. fix(recompiler): the SPIRV-Cross-safe emission above, neutral for other drivers.
  2. fix(libc): __gcc_personality_v0 exported for guest C code (it is missing on every platform), and strtoimax/strtoumax errno.
  3. feat(macos): the build and the prx libraries.
  4. feat(macos): relinker --macos (depends on 3).
  5. feat(macos): app bundle packaging.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6002632419 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6002632419). Originally posted by [mugurc](https://github.com/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: 1. Rendering is unchanged, and Vulkan goes through MoltenVK. The recompiler changes emit SPIR-V that means the same on every driver but survives SPIRV-Cross's translation to Metal: - ordered not-equal; - NaN tests on the bits; - subgroup results that SPIRV-Cross would otherwise move into `?:` / `&&`; - a texture fence before image atomics. 2. MoltenVK is not built anywhere. It comes from the Vulkan SDK at run time, and a packaging script copies it into an `.app`. The Linux and Windows builds are unchanged. 3. Only x86-64. libc and libkernel: - Exceptions: - On macOS, host code keeps libc++abi, because libc++ binds `__cxa_throw` two-level. libc.prx's runtime serves guest code. - Guest frames are found through their `PT_GNU_EH_FRAME`, using a `dl_iterate_phdr` emulation over the original program headers that the relinker keeps. - Host frames are found through `__TEXT,__eh_frame`; the prx are linked with `-no_compact_unwind`. - The libkernel and libc changes are `__APPLE__` branches: - shm_open instead of memfd; - mach_vm_map instead of MAP_FIXED_NOREPLACE; - guest TLS through a per-image pthread key: macOS cannot set the fs base, so the relinker rewrites `%fs` accesses into stubs; - the guest starts on a secondary thread, so AppKit keeps the main thread. Relinker: - `--macos` writes 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-intel` places 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: - All non-GPU tests pass. - 148 of the 166 AGC and shader tests pass through MoltenVK. 16 need f64, 64-bit atomics or the shader clock, which Metal does not have. One is still open: a signed zero in an SDWA f16 multiply. - I have no PS5, so no commercial title was tested. Testing used the fixtures and a small Breakout guest built like a PS5 title (video out, pad, audio out), which runs at 60 fps as a double-clickable app. The code was written with AI assistance; I reviewed and tested it. Proposed split, each against `main`: 1. fix(recompiler): the SPIRV-Cross-safe emission above, neutral for other drivers. 2. fix(libc): `__gcc_personality_v0` exported for guest C code (it is missing on every platform), and strtoimax/strtoumax errno. 3. feat(macos): the build and the prx libraries. 4. feat(macos): `relinker --macos` (depends on 3). 5. feat(macos): app bundle packaging. @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.
ymatrix1 commented 2026-10-05 23:36:06 +00:00 (Migrated from github.com)
Author
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6005536308 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6005536308). Originally posted by [ymatrix1](https://github.com/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.
boykopovar commented 2026-10-06 17:03:40 +00:00 (Migrated from github.com)
Author
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6021333984 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6021333984). Originally posted by [boykopovar](https://github.com/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.
mugurc commented 2026-10-06 17:12:11 +00:00 (Migrated from github.com)
Author
Contributor

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_v0 is also exported to guest code now, because guest C built with -fexceptions imports it, and CallPersonality recognizes that export. On Linux and Windows the host __gxx_personality_v0 and __gcc_personality_v0 are unchanged; they forward to the same code.
  • The exception_ptr model and the type_info declarations are only compiled with libc++/libc++abi (_LIBCPP_VERSION, _LIBCPPABI_VERSION). The Linux and Windows builds use libstdc++, so they don't see them.
  • Finding host frames through __TEXT,__eh_frame and the dl_iterate_phdr emulation over the guest program headers are __APPLE__ only.

The PR's CI will run exception_runtime and exception_c_cleanup on Linux. They are UNIX-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: --macos lowers 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6021485765 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6021485765). Originally posted by [mugurc](https://github.com/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_v0` is also exported to guest code now, because guest C built with `-fexceptions` imports it, and `CallPersonality` recognizes that export. On Linux and Windows the host `__gxx_personality_v0` and `__gcc_personality_v0` are unchanged; they forward to the same code. - The `exception_ptr` model and the `type_info` declarations are only compiled with libc++/libc++abi (`_LIBCPP_VERSION`, `_LIBCPPABI_VERSION`). The Linux and Windows builds use libstdc++, so they don't see them. - Finding host frames through `__TEXT,__eh_frame` and the `dl_iterate_phdr` emulation over the guest program headers are `__APPLE__` only. The PR's CI will run `exception_runtime` and `exception_c_cleanup` on Linux. They are `UNIX`-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: `--macos` lowers 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`.
GeorgeHulpoi commented 2026-10-06 17:39:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by GeorgeHulpoi on 2026-10-06T17:39:06Z.


+1. It would be nice to have support for MacOS.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6021941470 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6021941470). Originally posted by [GeorgeHulpoi](https://github.com/GeorgeHulpoi) on 2026-10-06T17:39:06Z. --- +1. It would be nice to have support for MacOS.
Zheorgyan commented 2026-10-08 10:36:22 +00:00 (Migrated from github.com)
Author
Contributor

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6058003690 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6058003690). Originally posted by [Zheorgyan](https://github.com/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
aksmith-git commented 2026-10-08 10:53:38 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by aksmith-git on 2026-10-08T10:53:38Z.


Fyi Apple is phasing out Rosetta 2, with full support ending after macOS 27 (Golden Gate).

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6058287147 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6058287147). Originally posted by [aksmith-git](https://github.com/aksmith-git) on 2026-10-08T10:53:38Z. --- > Fyi Apple is phasing out Rosetta 2, with full support ending after macOS 27 (Golden Gate). 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
Vladislav-Kalinkin commented 2026-10-08 11:52:45 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Vladislav-Kalinkin on 2026-10-08T11:52:45Z.


Fyi Apple is phasing out Rosetta 2, with full support ending after macOS 27 (Golden Gate).

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

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6059260369 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6059260369). Originally posted by [Vladislav-Kalinkin](https://github.com/Vladislav-Kalinkin) on 2026-10-08T11:52:45Z. --- > > Fyi Apple is phasing out Rosetta 2, with full support ending after macOS 27 (Golden Gate). > > 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 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
mugurc commented 2026-10-08 12:10:48 +00:00 (Migrated from github.com)
Author
Contributor

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

cmake -S . -B build-mac -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DBUILD_TESTING=ON
ninja -C build-mac && ninja -C build-mac libs
ctest --test-dir build-mac -j4

Without a Vulkan environment ctest runs 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/lib and VK_DRIVER_FILES pointing at the MoltenVK_icd.json file itself. Please run them in small batches with a timeout (ctest -j1 --timeout 30), not under a debugger, and leave out agc_driver_lds_atomics64 and 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 --macos output. 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6059553605 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6059553605). Originally posted by [mugurc](https://github.com/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): ``` cmake -S . -B build-mac -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DBUILD_TESTING=ON ninja -C build-mac && ninja -C build-mac libs ctest --test-dir build-mac -j4 ``` Without a Vulkan environment `ctest` runs 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/lib` and `VK_DRIVER_FILES` pointing at the `MoltenVK_icd.json` file itself. Please run them in small batches with a timeout (`ctest -j1 --timeout 30`), not under a debugger, and leave out `agc_driver_lds_atomics64` and 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 `--macos` output. 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.
arvindfroi commented 2026-10-08 12:40:38 +00:00 (Migrated from github.com)
Author
Contributor

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:

  • FEXCore from willfaust/FEX (Madeira's Darwin port) builds as a native arm64 macOS library. I used 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).
  • macOS refuses RWX, so the JIT runs from one pool mapped twice (RW + RX via mach_vm_remap), through the fork's DualMap::WriteOffset and the FEXCore::Allocator::mmap hook.
  • Two proofs of concept run in-process on an M3 Pro: x86-64 arithmetic and a loop (RAX = 229), and x86-64 calling a native arm64 function through a mov r10, rcx; mov eax, id; syscall; ret stub 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.
  • On the 16 KiB pages: PS5 pages are 16 KiB too (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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6060078054 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6060078054). Originally posted by [arvindfroi](https://github.com/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: - FEXCore from [willfaust/FEX](https://github.com/willfaust/FEX) (Madeira's Darwin port) builds as a native arm64 macOS library. I used `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). - macOS refuses RWX, so the JIT runs from one pool mapped twice (RW + RX via `mach_vm_remap`), through the fork's `DualMap::WriteOffset` and the `FEXCore::Allocator::mmap` hook. - Two proofs of concept run in-process on an M3 Pro: x86-64 arithmetic and a loop (`RAX = 229`), and x86-64 calling a **native arm64 function** through a `mov r10, rcx; mov eax, id; syscall; ret` stub 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. - On the 16 KiB pages: PS5 pages are 16 KiB too (`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.
Zheorgyan commented 2026-10-08 12:40:51 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-08T12:40:51Z.


thanks, built macos-port at dcc8dc76 with 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 MoltenVK

it doesn't build on this toolchain as is. libc++ 19 only has std::stop_token behind -fexperimental-library, so Shutdown.hpp and Process.cpp fail. adding add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fexperimental-library>) and add_link_options(-fexperimental-library) in the APPLE branch of the top CMakeLists fixes it

with that, 431 tests, 6 fail

  • agc_driver_sdwa_float_selectors fails the same way as on your M5
  • agc_driver_exec_host_lanes stops 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. a SubgroupStages() getter on VulkanDevice plus a skip fixes it, and it's the same on main for any device without vertex subgroups
  • agc_driver_vop1_float_unary gets 0 for exp_f32 of -126. M1's exp2 comes 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, a UMax32 with 0x00800000 in the FPExp2 specials fixes it and passes here
  • agc_driver_many_buffers needs 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 1000000
  • agc_driver_pixel_interlock doesn't compile in MoltenVK because Metal rejects raster_order_group on an argument buffer field. without argument buffers it compiles but loses 2 of 64 updates, since raster order groups don't cover BDA access
  • host_thread_local is flaky. libc++ makes an async future ready before the thread's thread_local destructors run

I'd like to take the M1 GPU ones, exec_host_lanes and the exp fix. if nobody has started many_buffers I'd look at the update-after-bind path for it too

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6060081570 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6060081570). Originally posted by [Zheorgyan](https://github.com/Zheorgyan) on 2026-10-08T12:40:51Z. --- thanks, built `macos-port` at `dcc8dc76` with 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 MoltenVK it doesn't build on this toolchain as is. libc++ 19 only has `std::stop_token` behind `-fexperimental-library`, so `Shutdown.hpp` and `Process.cpp` fail. adding `add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fexperimental-library>)` and `add_link_options(-fexperimental-library)` in the `APPLE` branch of the top CMakeLists fixes it with that, 431 tests, 6 fail - `agc_driver_sdwa_float_selectors` fails the same way as on your M5 - `agc_driver_exec_host_lanes` stops 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. a `SubgroupStages()` getter on `VulkanDevice` plus a skip fixes it, and it's the same on main for any device without vertex subgroups - `agc_driver_vop1_float_unary` gets 0 for `exp_f32` of -126. M1's `exp2` comes 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, a `UMax32` with `0x00800000` in the FPExp2 specials fixes it and passes here - `agc_driver_many_buffers` needs 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 1000000 - `agc_driver_pixel_interlock` doesn't compile in MoltenVK because Metal rejects `raster_order_group` on an argument buffer field. without argument buffers it compiles but loses 2 of 64 updates, since raster order groups don't cover BDA access - `host_thread_local` is flaky. libc++ makes an async future ready before the thread's `thread_local` destructors run I'd like to take the M1 GPU ones, `exec_host_lanes` and the `exp` fix. if nobody has started `many_buffers` I'd look at the update-after-bind path for it too
Vladislav-Kalinkin commented 2026-10-08 13:09:51 +00:00 (Migrated from github.com)
Author
Contributor

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6060598012 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6060598012). Originally posted by [Vladislav-Kalinkin](https://github.com/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.
mugurc commented 2026-10-08 13:18:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-08T13:18:58Z.


@Zheorgyan thanks for testing, and for the -fexperimental-library fix: it is on macos-port now (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, the exp fix (I saw #1565 and #1571), and many_buffers with the update-after-bind path. I haven't started any of them, and I haven't run many_buffers, pixel_interlock or exec_host_lanes on the M5. sdwa_float_selectors fails on the M5 as well; it is recorded in docs/dev/TechnicalDebt.md on 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_tcp is 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 at host_thread_local.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6060760839 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6060760839). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-08T13:18:58Z. --- @Zheorgyan thanks for testing, and for the `-fexperimental-library` fix: it is on `macos-port` now (`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`, the `exp` fix (I saw #1565 and #1571), and `many_buffers` with the update-after-bind path. I haven't started any of them, and I haven't run `many_buffers`, `pixel_interlock` or `exec_host_lanes` on the M5. `sdwa_float_selectors` fails on the M5 as well; it is recorded in `docs/dev/TechnicalDebt.md` on 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_tcp` is 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 at `host_thread_local`.
mugurc commented 2026-10-08 13:21:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-08T13:21:57Z.


Starting the next piece now: the relinker's --macos output (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-intel will be separate PRs after it, so nobody needs to wait on a big one. I'll link the PR here when it is open.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6060813714 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6060813714). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-08T13:21:57Z. --- Starting the next piece now: the relinker's `--macos` output (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-intel` will be separate PRs after it, so nobody needs to wait on a big one. I'll link the PR here when it is open.
Zheorgyan commented 2026-10-08 13:29:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-08T13:29:27Z.


thanks. many_buffers is up as #1580. I'm taking sdwa_float_selectors next, the f16 multiply that gives +0.0 instead of -0.0 on Apple GPUs

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6060954086 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6060954086). Originally posted by [Zheorgyan](https://github.com/Zheorgyan) on 2026-10-08T13:29:27Z. --- thanks. `many_buffers` is up as #1580. I'm taking `sdwa_float_selectors` next, the f16 multiply that gives +0.0 instead of -0.0 on Apple GPUs
mugurc commented 2026-10-08 14:03:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-08T14:03:27Z.


The relinker --macos PR 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-intel and the Mach-O NID patcher are next, as separate PRs.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6061593047 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6061593047). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-08T14:03:27Z. --- The relinker `--macos` PR 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-intel` and the Mach-O NID patcher are next, as separate PRs.
Zheorgyan commented 2026-10-08 14:03:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-08T14:03:52Z.


@mugurc root cause of agc_driver_sdwa_float_selectors on M1 for your TechnicalDebt entry: SPIRV-Cross's MSL backend computes precise multiplications as fma(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 side

Other M1 GPU fixes from me: #1565, #1571, #1580

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6061600997 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6061600997). Originally posted by [Zheorgyan](https://github.com/Zheorgyan) on 2026-10-08T14:03:52Z. --- @mugurc root cause of `agc_driver_sdwa_float_selectors` on M1 for your TechnicalDebt entry: SPIRV-Cross's MSL backend computes precise multiplications as `fma(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 side Other M1 GPU fixes from me: #1565, #1571, #1580
Cloud-Multiplayer commented 2026-10-08 15:14:12 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Cloud-Multiplayer on 2026-10-08T15:14:12Z.


@mugurc I built your macos-port branch (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.dylib at the MoltenVK dylib directly and skipped the unconditional VK_KHR_portability_enumeration request, which MoltenVK itself rejects without the loader (VK_ERROR_EXTENSION_NOT_PRESENT). Requesting it only when vkEnumerateInstanceExtensionProperties lists it would make both setups work.

1. Startup crash that depends on the ASLR slide

Most launches end with:

terminating due to uncaught exception of type std::runtime_error: guest protection or unmap range has a hole

It happens exactly when the image is not loaded on a 16 KiB boundary. Six launches with DYLD_PRINT_SEGMENTS=1:

__ELF0 load address mod 0x4000 result
0x144D42000 0x2000 crash
0x140915000 0x1000 crash
0x1408B4000 0 runs
0x140599000 0x1000 crash
0x14294C000 0 runs
0x142501000 0x1000 crash

My reading of the cause, from hitting the same message in my own loader before I aligned its base: the guest rounds an mprotect range 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 that GuestAllocationsRegisterMainImage never 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 (__ELF0 at 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:

[gpu] skipped draw: AGC graphics: subgroup capability 61 is unsupported for shader stage 1

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 is PerVertexKHR decoration is not supported in MSL: MoltenVK 1.4.2 advertises fragmentShaderBarycentric, but SPIRV-Cross cannot translate it. Their 0007-validated-fixed-function-interpolation covers 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:

  • Write watch for macOS. GuestWriteWatch has no backend on macOS in main or 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, Collect re-protects). Because the protection is real, it hooks GuestArena::HostWrite so system calls that write guest memory do not fail with EFAULT, routes mprotect/fixed mmap through it, and reports the guest's protection rather than the real one to GuestMemory. About 300 lines, self-contained.
  • sceKernelGetdirentries on APFS. d_seekoff is 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.
  • A wall-clock sampling profiler for the process (signals each thread, records RIP), since sample and lldb could 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 main if that fits your plan for the runtime pieces, or to hand it to you to fold into macos-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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6062988668 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6062988668). Originally posted by [Cloud-Multiplayer](https://github.com/Cloud-Multiplayer) on 2026-10-08T15:14:12Z. --- @mugurc I built your `macos-port` branch (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.dylib` at the MoltenVK dylib directly and skipped the unconditional `VK_KHR_portability_enumeration` request, which MoltenVK itself rejects without the loader (`VK_ERROR_EXTENSION_NOT_PRESENT`). Requesting it only when `vkEnumerateInstanceExtensionProperties` lists it would make both setups work. ### 1. Startup crash that depends on the ASLR slide Most launches end with: ``` terminating due to uncaught exception of type std::runtime_error: guest protection or unmap range has a hole ``` It happens exactly when the image is not loaded on a 16 KiB boundary. Six launches with `DYLD_PRINT_SEGMENTS=1`: | `__ELF0` load address | mod 0x4000 | result | | --- | --- | --- | | 0x144D42000 | 0x2000 | crash | | 0x140915000 | 0x1000 | crash | | 0x1408B4000 | 0 | runs | | 0x140599000 | 0x1000 | crash | | 0x14294C000 | 0 | runs | | 0x142501000 | 0x1000 | crash | My reading of the cause, from hitting the same message in my own loader before I aligned its base: the guest rounds an `mprotect` range 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 that `GuestAllocationsRegisterMainImage` never 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 (`__ELF0` at 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: ``` [gpu] skipped draw: AGC graphics: subgroup capability 61 is unsupported for shader stage 1 ``` 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 is `PerVertexKHR decoration is not supported in MSL`: MoltenVK 1.4.2 advertises `fragmentShaderBarycentric`, but SPIRV-Cross cannot translate it. Their `0007-validated-fixed-function-interpolation` covers 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: - **Write watch for macOS.** `GuestWriteWatch` has no backend on macOS in `main` or 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, `Collect` re-protects). Because the protection is real, it hooks `GuestArena::HostWrite` so system calls that write guest memory do not fail with EFAULT, routes `mprotect`/fixed `mmap` through it, and reports the guest's protection rather than the real one to `GuestMemory`. About 300 lines, self-contained. - **`sceKernelGetdirentries` on APFS.** `d_seekoff` is 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. - A wall-clock sampling profiler for the process (signals each thread, records RIP), since `sample` and `lldb` could 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 `main` if that fits your plan for the runtime pieces, or to hand it to you to fold into `macos-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.
arvindfroi commented 2026-10-08 15:30:49 +00:00 (Migrated from github.com)
Author
Contributor

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:

  • The libraries build natively for arm64 (-DCMAKE_OSX_ARCHITECTURES=arm64). ctest runs 431 tests: 260 pass and 171 skip (the GPU tests; no Vulkan driver is installed). The arm64 changes:
    • the guest's va_list is read by hand, as on Windows;
    • the x87 long double is converted exactly in software (strtold, wcstold, %L);
    • guest-state operations such as setjmp throw until a runner provides them.
  • A small runner, aps5-fex, loads the relinker's Linux output and runs it in-process with FEXCore (willfaust/FEX at the MIT-licensed ac555dd8). Imports call the arm64 libraries through x86 stubs. Ten guest programs pass, covering:
    • library calls, double results and variadic printf/snprintf;
    • a guest qsort comparator called from a library;
    • threads with thread_local;
    • long double returns in st(0);
    • the C++ exception and C cleanup programs from 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:

  • mugurc/AnyPS5#3, the libraries on arm64. It also has two fixes that matter for x86-64: libraries find each other through @loader_path, because dyld ignores $ORIGIN and the executable's rpath hid this; and guest_module_fixture is re-signed after NID patching.
  • mugurc/AnyPS5#4, the runner, on top of #3.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6063347492 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6063347492). Originally posted by [arvindfroi](https://github.com/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`: - The libraries build natively for arm64 (`-DCMAKE_OSX_ARCHITECTURES=arm64`). `ctest` runs 431 tests: 260 pass and 171 skip (the GPU tests; no Vulkan driver is installed). The arm64 changes: - the guest's `va_list` is read by hand, as on Windows; - the x87 `long double` is converted exactly in software (`strtold`, `wcstold`, `%L`); - guest-state operations such as `setjmp` throw until a runner provides them. - A small runner, `aps5-fex`, loads the relinker's Linux output and runs it in-process with FEXCore (willfaust/FEX at the MIT-licensed `ac555dd8`). Imports call the arm64 libraries through x86 stubs. Ten guest programs pass, covering: - library calls, `double` results and variadic `printf`/`snprintf`; - a guest `qsort` comparator called from a library; - threads with `thread_local`; - `long double` returns in `st(0)`; - the C++ exception and C cleanup programs from `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: - mugurc/AnyPS5#3, the libraries on arm64. It also has two fixes that matter for x86-64: libraries find each other through `@loader_path`, because dyld ignores `$ORIGIN` and the executable's rpath hid this; and `guest_module_fixture` is re-signed after NID patching. - mugurc/AnyPS5#4, the runner, on top of #3. AI-assisted (Claude Code).
mugurc commented 2026-10-08 15:49:30 +00:00 (Migrated from github.com)
Author
Contributor

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 (__ELF0 at ...C000, ...D000, ...7000 over eight launches). My fixtures never round a range to 16 KiB, so they never saw it. With MH_PIE cleared the executable loads at 0x140010000 every 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 the sceKernelGetdirentries change and the profiler to your fork and link them here. The branch already handles d_seekoff == 0 for getdents64, so I'd like to compare. Requesting VK_KHR_portability_enumeration only 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_path and re-signing parts matter for x86-64 as well, so I'll look at them for the macOS build PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6063698323 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6063698323). Originally posted by [mugurc](https://github.com/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 (`__ELF0` at `...C000`, `...D000`, `...7000` over eight launches). My fixtures never round a range to 16 KiB, so they never saw it. With `MH_PIE` cleared the executable loads at `0x140010000` every 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 the `sceKernelGetdirentries` change and the profiler to your fork and link them here. The branch already handles `d_seekoff == 0` for `getdents64`, so I'd like to compare. Requesting `VK_KHR_portability_enumeration` only 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_path` and re-signing parts matter for x86-64 as well, so I'll look at them for the macOS build PR.
morten-holm commented 2026-10-08 15:55:44 +00:00 (Migrated from github.com)
Author
Contributor

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-port at 4dc40455 (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:

  1. PIE slide. The load address slides in 4 KB steps (for example 0x144cae000), but the guest assumes 16 KB pages. Its mprotect(R) then covers writable data and the title dies with SIGBUS KERN_PROTECTION_FAILURE. Clearing MH_PIE (load at 0x140000000) fixes it. I would make the executable fixed-base with 16 KB borders by default.
  2. GuestAllocationsRegisterMainImage skips segments with initprot == NONE. A no-access filler segment between two data segments is then missing from the registry, and the guest's mprotect across it throws "guest protection or unmap range has a hole". Registering them (except __PAGEZERO) fixes it.
  3. That segment has maxprot == initprot == 0, so the same mprotect gets EACCES. Giving no-access guest segments maxprot read+write fixes it. __PAGEZERO must stay 0, or the kernel kills the process at exec.
  4. VK_KHR_portability_enumeration is requested unconditionally, so vkCreateInstance fails 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 main for problems that are independent of the Mach-O writer. All three were found with the same title:

  • #1640: s_cselect_b64 of two masks as a lane bit (vertex shaders without subgroups on Metal)
  • #1653: do not use fragment barycentric on MoltenVK (PerVertexKHR is rejected)
  • #1658: run guest exit handlers before the host exit handlers (abort on window close)

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6063811455 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6063811455). Originally posted by [morten-holm](https://github.com/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-port` at 4dc40455 (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: 1. PIE slide. The load address slides in 4 KB steps (for example `0x144cae000`), but the guest assumes 16 KB pages. Its `mprotect(R)` then covers writable data and the title dies with `SIGBUS KERN_PROTECTION_FAILURE`. Clearing `MH_PIE` (load at `0x140000000`) fixes it. I would make the executable fixed-base with 16 KB borders by default. 2. `GuestAllocationsRegisterMainImage` skips segments with `initprot == NONE`. A no-access filler segment between two data segments is then missing from the registry, and the guest's `mprotect` across it throws "guest protection or unmap range has a hole". Registering them (except `__PAGEZERO`) fixes it. 3. That segment has `maxprot == initprot == 0`, so the same `mprotect` gets EACCES. Giving no-access guest segments `maxprot` read+write fixes it. `__PAGEZERO` must stay 0, or the kernel kills the process at exec. 4. `VK_KHR_portability_enumeration` is requested unconditionally, so `vkCreateInstance` fails 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 `main` for problems that are independent of the Mach-O writer. All three were found with the same title: - #1640: `s_cselect_b64` of two masks as a lane bit (vertex shaders without subgroups on Metal) - #1653: do not use fragment barycentric on MoltenVK (`PerVertexKHR` is rejected) - #1658: run guest exit handlers before the host exit handlers (abort on window close) 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.
arvindfroi commented 2026-10-08 16:03:28 +00:00 (Migrated from github.com)
Author
Contributor

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:

  • macOS 27.0, with the libraries from mugurc/AnyPS5#3.
  • Homebrew's molten-vk 1.4.2 and vulkan-loader 1.4.363.0, with DYLD_LIBRARY_PATH=/opt/homebrew/lib and VK_DRIVER_FILES=/opt/homebrew/etc/vulkan/icd.d/MoltenVK_icd.json.
  • One test at a time with --timeout 30, leaving out agc_driver_lds_atomics64.

Results:

  • 143 pass.

  • 23 skip. 21 are for features this GPU lacks:

    • shaderFloat64: the f64_* tests, the division modifier tests and float16_dot;
    • shaderBufferInt64Atomics: the 64-bit atomic tests, buffer_atomics, global_atomics_lanes and look_back_scan;
    • float atomics;
    • the subgroup and device clocks;
    • min/max sampler reduction with component mapping;
    • 4097 storage buffers per stage.

    agc_write_tracking skips 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: vkCreateGraphicsPipelines returns -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_csub failed on arm64 only. Its 4 KiB guest block from aligned_alloc sits 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_sets opened libvulkan.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.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6063949682 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6063949682). Originally posted by [arvindfroi](https://github.com/arvindfroi) on 2026-10-08T16:03:28Z. --- **GPU tests on an M3 Pro, native arm64 (no Rosetta)** Setup: - macOS 27.0, with the libraries from mugurc/AnyPS5#3. - Homebrew's `molten-vk` 1.4.2 and `vulkan-loader` 1.4.363.0, with `DYLD_LIBRARY_PATH=/opt/homebrew/lib` and `VK_DRIVER_FILES=/opt/homebrew/etc/vulkan/icd.d/MoltenVK_icd.json`. - One test at a time with `--timeout 30`, leaving out `agc_driver_lds_atomics64`. Results: - **143 pass.** - **23 skip.** 21 are for features this GPU lacks: - `shaderFloat64`: the `f64_*` tests, the division modifier tests and `float16_dot`; - `shaderBufferInt64Atomics`: the 64-bit atomic tests, `buffer_atomics`, `global_atomics_lanes` and `look_back_scan`; - float atomics; - the subgroup and device clocks; - min/max sampler reduction with component mapping; - 4097 storage buffers per stage. `agc_write_tracking` skips 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`: `vkCreateGraphicsPipelines` returns -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_csub` failed on arm64 only. Its 4 KiB guest block from `aligned_alloc` sits 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_sets` opened `libvulkan.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.
Cloud-Multiplayer commented 2026-10-08 16:26:51 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Cloud-Multiplayer on 2026-10-08T16:26:51Z.


@mugurc done:

  • Write watch: #1686, against main. It carries its own tests (native and through Rosetta) and lists what the macOS memory paths will need to call.
  • The rest is on a snapshot branch, one commit on top of 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.
    • getdents64 on APFS: Aps5MacGetdents64, called from sceKernelGetdirentries. Every entry gets the descriptor position after the read as d_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.
    • Profiler: Loader.cpp, started by APS5_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.
    • The 16 KiB base, for reference, is here: the loader over-reserves by the largest segment alignment and trims. For dylibs that dyld slides, that is not available, so tolerating the gap in the runtime sounds right.

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 supportedStages has 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064367265 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6064367265). Originally posted by [Cloud-Multiplayer](https://github.com/Cloud-Multiplayer) on 2026-10-08T16:26:51Z. --- @mugurc done: - Write watch: #1686, against `main`. It carries its own tests (native and through Rosetta) and lists what the macOS memory paths will need to call. - The rest is on a snapshot branch, one commit on top of `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. - `getdents64` on APFS: [`Aps5MacGetdents64`](https://github.com/Cloud-Multiplayer/AnyPS5/blob/4804bb60b3fc26125c949883492efab860e793fa/core/libs/prx/libc/src/specifics/macos/MacCompat.cpp#L87), called from [`sceKernelGetdirentries`](https://github.com/Cloud-Multiplayer/AnyPS5/blob/4804bb60b3fc26125c949883492efab860e793fa/core/libs/prx/libkernel/File/src/Stdio.cpp#L465). Every entry gets the descriptor position after the read as `d_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. - Profiler: [`Loader.cpp`](https://github.com/Cloud-Multiplayer/AnyPS5/blob/4804bb60b3fc26125c949883492efab860e793fa/core/macos/loader/Loader.cpp#L573), started by `APS5_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. - The 16 KiB base, for reference, is [here](https://github.com/Cloud-Multiplayer/AnyPS5/blob/4804bb60b3fc26125c949883492efab860e793fa/core/macos/loader/Loader.cpp#L334): the loader over-reserves by the largest segment alignment and trims. For dylibs that dyld slides, that is not available, so tolerating the gap in the runtime sounds right. 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 `supportedStages` has 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.
shanto462 commented 2026-10-08 16:29:56 +00:00 (Migrated from github.com)
Author
Contributor

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-port on 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-port at 4dc40455, built with mugurc's cmake line (x86-64):

  • Build and ninja libs: OK, 116 libraries.
  • ctest without Vulkan: 431 tests, 260 pass, 171 skip, 0 fail.
  • GPU tests (ctest -j1 --timeout 30, without agc_driver_lds_atomics64 and 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 1
    • many_buffers: shader descriptors exceed per-stage limits
    • sdwa_float_selectors: lane 2 mul_f16 gives 0x00000000, expected 0x00008000
    • pixel_interlock: vkCreateGraphicsPipelines returns -3, after the Metal error type 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'. This matches what @Zheorgyan found on M1 (raster_order_group on an argument buffer field).
  • run_macos_fixtures.py with LLVM 23.1.3: 10 of 10 pass.

ASLR slide: it happens on M4 too. With MH_PIE set, __ELF0 loads in 4 KiB steps (for example 0x142632000 and 0x144807000, which are off a 16 KiB boundary). With MH_PIE cleared it loads at 0x140010000 every run, and the import and tls fixtures still pass.

I also cherry-picked #1640, #1653 and #1658 onto macos-port locally. It builds, ctest gives 434 tests, 263 pass, 171 skip, 0 fail, and the GPU results are the same 143 / 23 / 4. On that build, Breakout (with MH_PIE cleared, packaged with package_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_interlock on 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064421010 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6064421010). Originally posted by [shanto462](https://github.com/shanto462) on 2026-10-08T16:29:56Z. --- Hi all, thank you for all the work here. I tested `macos-port` on 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-port` at `4dc40455`**, built with mugurc's cmake line (x86-64): - Build and `ninja libs`: OK, 116 libraries. - `ctest` without Vulkan: 431 tests, 260 pass, 171 skip, 0 fail. - GPU tests (`ctest -j1 --timeout 30`, without `agc_driver_lds_atomics64` and 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 1` - `many_buffers`: `shader descriptors exceed per-stage limits` - `sdwa_float_selectors`: lane 2 `mul_f16` gives `0x00000000`, expected `0x00008000` - `pixel_interlock`: `vkCreateGraphicsPipelines` returns -3, after the Metal error `type 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'`. This matches what @Zheorgyan found on M1 (`raster_order_group` on an argument buffer field). - `run_macos_fixtures.py` with LLVM 23.1.3: 10 of 10 pass. **ASLR slide:** it happens on M4 too. With `MH_PIE` set, `__ELF0` loads in 4 KiB steps (for example `0x142632000` and `0x144807000`, which are off a 16 KiB boundary). With `MH_PIE` cleared it loads at `0x140010000` every run, and the `import` and `tls` fixtures still pass. I also cherry-picked #1640, #1653 and #1658 onto `macos-port` locally. It builds, `ctest` gives 434 tests, 263 pass, 171 skip, 0 fail, and the GPU results are the same 143 / 23 / 4. On that build, Breakout (with `MH_PIE` cleared, packaged with `package_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_interlock` on 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.
jamesst20 commented 2026-10-08 22:08:54 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by jamesst20 on 2026-10-08T22:08:54Z.


@mugurc done:

  • Write watch: feat(libc): write watch on macOS hosts #1686, against main. It carries its own tests (native and through Rosetta) and lists what the macOS memory paths will need to call.

  • The rest is on a snapshot branch, one commit on top of 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.

    • getdents64 on APFS: Aps5MacGetdents64, called from sceKernelGetdirentries. Every entry gets the descriptor position after the read as d_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.
    • Profiler: Loader.cpp, started by APS5_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.
    • The 16 KiB base, for reference, is here: the loader over-reserves by the largest segment alignment and trims. For dylibs that dyld slides, that is not available, so tolerating the gap in the runtime sounds right.

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 supportedStages has 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.

Tested your fork and it works very well on M4 Pro. Had to pass APS5_FIXED_FUNCTION_INTERPOLATION=1 to get video output

Image

Since you forked AnyPS5, the main branch changed quite a lot and introduces breaking change to your fork

  1. github.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

  2. github.com/boykopovar/AnyPS5@3e47c30ed7
    ->MoltenVK doesn't expose shaderStorageImageMultisample https://github.com/KhronosGroup/MoltenVK/pull/505

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6070000634 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6070000634). Originally posted by [jamesst20](https://github.com/jamesst20) on 2026-10-08T22:08:54Z. --- > [@mugurc](https://github.com/mugurc) done: > > * Write watch: [feat(libc): write watch on macOS hosts #1686](https://github.com/boykopovar/AnyPS5/pull/1686), against `main`. It carries its own tests (native and through Rosetta) and lists what the macOS memory paths will need to call. > * The rest is on a snapshot branch, one commit on top of `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. > > * `getdents64` on APFS: [`Aps5MacGetdents64`](https://github.com/Cloud-Multiplayer/AnyPS5/blob/4804bb60b3fc26125c949883492efab860e793fa/core/libs/prx/libc/src/specifics/macos/MacCompat.cpp#L87), called from [`sceKernelGetdirentries`](https://github.com/Cloud-Multiplayer/AnyPS5/blob/4804bb60b3fc26125c949883492efab860e793fa/core/libs/prx/libkernel/File/src/Stdio.cpp#L465). Every entry gets the descriptor position after the read as `d_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. > * Profiler: [`Loader.cpp`](https://github.com/Cloud-Multiplayer/AnyPS5/blob/4804bb60b3fc26125c949883492efab860e793fa/core/macos/loader/Loader.cpp#L573), started by `APS5_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. > * The 16 KiB base, for reference, is [here](https://github.com/Cloud-Multiplayer/AnyPS5/blob/4804bb60b3fc26125c949883492efab860e793fa/core/macos/loader/Loader.cpp#L334): the loader over-reserves by the largest segment alignment and trims. For dylibs that dyld slides, that is not available, so tolerating the gap in the runtime sounds right. > > 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 `supportedStages` has 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. Tested your fork and it works very well on M4 Pro. Had to pass `APS5_FIXED_FUNCTION_INTERPOLATION=1` to get video output <img width="1417" height="840" alt="Image" src="https://github.com/user-attachments/assets/45ffeb71-8183-446d-94d5-cbd4f5047377" /> Since you forked AnyPS5, the `main` branch changed quite a lot and introduces breaking change to your fork 1. https://github.com/boykopovar/AnyPS5/commit/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 2. https://github.com/boykopovar/AnyPS5/commit/3e47c30ed737299a981c6412def6b4b11a71ae1f ->MoltenVK doesn't expose shaderStorageImageMultisample https://github.com/KhronosGroup/MoltenVK/pull/505
Zheorgyan commented 2026-10-09 07:41:02 +00:00 (Migrated from github.com)
Author
Contributor

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_group on a field inside the argument buffer, happy to look at the PR when it's up

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6076656538 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6076656538). Originally posted by [Zheorgyan](https://github.com/Zheorgyan) on 2026-10-09T07:41:02Z. --- @shanto462 go ahead, it's yours. the cause is SPIRV-Cross putting `raster_order_group` on a field inside the argument buffer, happy to look at the PR when it's up
mugurc commented 2026-10-09 08:44:35 +00:00 (Migrated from github.com)
Author
Contributor

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

  • DoMprotect now 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.
  • A relinked guest registers only its __ELF segments. Before, the Mach-O header, __APS5DATA and __LINKEDIT were registered too, so a range rounded into them tried to give the read-only __LINKEDIT write access and mprotect failed with EACCES. That one only showed once the first fix was in.
  • MH_PIE stays set, and modules need no special handling.
  • New fixture 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, 0x3000 mod 0x4000) had no failure, and the full ctest is 431 tests with 0 failures.

@jamesst20 thank you for the two commits on main. I'll check them when I re-stack macos-port on main; #2015 and #2016 look related.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077556383 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6077556383). Originally posted by [mugurc](https://github.com/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. - `DoMprotect` now 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. - A relinked guest registers only its `__ELF` segments. Before, the Mach-O header, `__APS5DATA` and `__LINKEDIT` were registered too, so a range rounded into them tried to give the read-only `__LINKEDIT` write access and `mprotect` failed with `EACCES`. That one only showed once the first fix was in. - `MH_PIE` stays set, and modules need no special handling. - New fixture `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`, `0x3000` mod `0x4000`) had no failure, and the full `ctest` is 431 tests with 0 failures. @jamesst20 thank you for the two commits on `main`. I'll check them when I re-stack `macos-port` on `main`; #2015 and #2016 look related.
mugurc commented 2026-10-09 09:09:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T09:09:25Z.


macos-port is re-stacked on current main (6cc0503d) and is now at c3affc1c. 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.

ctest without Vulkan variables: 489 tests, 282 pass, 206 skip, 1 fails.

What main added since the last base that needed macOS changes:

  • Linux-only code in GuestMemory (PROCMAP_QUERY) and DynamicLoader (<link.h>), and two test targets that find the SPIR-V headers only in the Linux system path.
  • INSTALL_RPATH $ORIGIN on every prx replaced the @loader_path macOS needs, so a library loaded alone could not find the others (the new patched_libraries test shows it; the same finding as in #3).
  • libSystem's __cxa_thread_atexit returns void, 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_case creates Settings.ini and SETTINGS.INI side 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 -fwrapv and 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 main commits @jamesst20 pointed out (dccfa08d, 3e47c30e); #2015 and #2016 are not merged yet.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077923290 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6077923290). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-09T09:09:25Z. --- `macos-port` is re-stacked on current `main` (`6cc0503d`) and is now at `c3affc1c`. 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. `ctest` without Vulkan variables: 489 tests, 282 pass, 206 skip, 1 fails. What `main` added since the last base that needed macOS changes: - Linux-only code in `GuestMemory` (`PROCMAP_QUERY`) and `DynamicLoader` (`<link.h>`), and two test targets that find the SPIR-V headers only in the Linux system path. - `INSTALL_RPATH $ORIGIN` on every prx replaced the `@loader_path` macOS needs, so a library loaded alone could not find the others (the new `patched_libraries` test shows it; the same finding as in #3). - libSystem's `__cxa_thread_atexit` returns `void`, 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_case` creates `Settings.ini` and `SETTINGS.INI` side 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 -fwrapv` and 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 `main` commits @jamesst20 pointed out (`dccfa08d`, `3e47c30e`); #2015 and #2016 are not merged yet.
mugurc commented 2026-10-09 09:10:34 +00:00 (Migrated from github.com)
Author
Contributor

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-intel converts it lowers RDSEED to RDRAND, drops CLWB and makes RDPID return processor 0, because Rosetta has none of them. --macos and Intel output stay as they are. It is independent of #1597, so it will be its own PR against main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077941055 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6077941055). Originally posted by [mugurc](https://github.com/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-intel` converts it lowers RDSEED to RDRAND, drops CLWB and makes RDPID return processor 0, because Rosetta has none of them. `--macos` and Intel output stay as they are. It is independent of #1597, so it will be its own PR against `main`.
mugurc commented 2026-10-09 09:23:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T09:23:26Z.


The --to-rosetta PR is open: https://github.com/boykopovar/AnyPS5/pull/2119. It is independent of #1597.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6078137821 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6078137821). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-09T09:23:26Z. --- The `--to-rosetta` PR is open: https://github.com/boykopovar/AnyPS5/pull/2119. It is independent of #1597.
Zheorgyan commented 2026-10-09 10:27:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-09T10:27:49Z.


@mugurc GPU tests on c3affc1c with #2015 and #2016, M1 Pro under Rosetta: same 11 failures as arvindfroi plus vop1_float_unary from #1571. guest_ajm is LibAtrac9 writing past Block::Gradient[31] on the synthetic block, so the result depends on the compiler, fixed in #2163

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6079071889 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6079071889). Originally posted by [Zheorgyan](https://github.com/Zheorgyan) on 2026-10-09T10:27:49Z. --- @mugurc GPU tests on `c3affc1c` with #2015 and #2016, M1 Pro under Rosetta: same 11 failures as arvindfroi plus `vop1_float_unary` from #1571. `guest_ajm` is LibAtrac9 writing past `Block::Gradient[31]` on the synthetic block, so the result depends on the compiler, fixed in #2163
mugurc commented 2026-10-09 12:34:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported 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-stack macos-port, and thanks for running the GPU tests on c3affc1c with #2015 and #2016.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6080993306 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6080993306). Originally posted by [mugurc](https://github.com/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-stack `macos-port`, and thanks for running the GPU tests on `c3affc1c` with #2015 and #2016.
mugurc commented 2026-10-09 12:35:55 +00:00 (Migrated from github.com)
Author
Contributor

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_postfix symbols of a library built on macOS into NIDs, so that ninja libs can produce the prx files there. It is a separate PR from the build changes that need it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6081008591 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6081008591). Originally posted by [mugurc](https://github.com/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_postfix` symbols of a library built on macOS into NIDs, so that `ninja libs` can produce the prx files there. It is a separate PR from the build changes that need it.
mugurc commented 2026-10-09 13:10:35 +00:00 (Migrated from github.com)
Author
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6081552821 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6081552821). Originally posted by [mugurc](https://github.com/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.
mugurc commented 2026-10-09 18:18:00 +00:00 (Migrated from github.com)
Author
Contributor

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-slide fixture). They are all on macos-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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6086710450 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6086710450). Originally posted by [mugurc](https://github.com/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-slide` fixture). They are all on `macos-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.
mugurc commented 2026-10-09 21:20:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-09T21:20:49Z.


@jermainee thank you, this is very useful. macos-port is re-stacked on main (73ba24aa) and now at e9db5ebf, with these of your commits taken as they are (author kept):

  • 67ae96de and d5e06abf: socketpair throws for SOCK_SEQPACKET.
  • c76a529c: x86-64 selected for the full build.
  • cb6865be: the fixtures only in the full build.
  • b1b07b8b and 5d64d07c: the Vulkan loader and portability drivers in the cache budget and descriptor set tests.
  • d32c465a: the AtomicSharedPtr mutex fallback.
  • fabd982b: standard C++ in the guest fixtures.

sceKernelGetCurrentCpu goes through GuestCpuFromHost now, as you described. I left out the CI and BUILD.md commits: those are for @boykopovar to decide, and the macOS pieces are not in main yet. The branch also has #2163 (the guest_ajm fix, one line) cherry-picked, with Zheorgyan as author, since it is approved and not merged yet.

ctest without 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6089457130 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6089457130). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-09T21:20:49Z. --- @jermainee thank you, this is very useful. `macos-port` is re-stacked on `main` (`73ba24aa`) and now at `e9db5ebf`, with these of your commits taken as they are (author kept): - `67ae96de` and `d5e06abf`: `socketpair` throws for `SOCK_SEQPACKET`. - `c76a529c`: x86-64 selected for the full build. - `cb6865be`: the fixtures only in the full build. - `b1b07b8b` and `5d64d07c`: the Vulkan loader and portability drivers in the cache budget and descriptor set tests. - `d32c465a`: the `AtomicSharedPtr` mutex fallback. - `fabd982b`: standard C++ in the guest fixtures. `sceKernelGetCurrentCpu` goes through `GuestCpuFromHost` now, as you described. I left out the CI and `BUILD.md` commits: those are for @boykopovar to decide, and the macOS pieces are not in `main` yet. The branch also has #2163 (the `guest_ajm` fix, one line) cherry-picked, with Zheorgyan as author, since it is approved and not merged yet. `ctest` without 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.
jermainee commented 2026-10-09 21:28:04 +00:00 (Migrated from github.com)
Author
Contributor

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 current main (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 to macos-port itself; the fixes are on my branch, so take whatever is useful.

On macos-port as it is

  • macos_fixtures is registered under if(APPLE), so the relinker-only build registers it too. That build has no core/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_64 has no effect with CMake 4.4: project() sets CMAKE_SYSTEM_PROCESSOR back to arm64. It is harmless today, since libjpeg-turbo builds with WITH_SIMD=OFF, but the value also goes into the shader cache key. CMAKE_APPLE_SILICON_PROCESSOR=x86_64 set before project() works. My branch defaults it and CMAKE_OSX_ARCHITECTURES to x86-64 for the full build on a Mac, so a plain cmake -S . -B build -G Ninja gives x86-64, and the relinker-only build stays native (c76a529c).
  • OversizedDescriptorSets (and, from main since, StorageCacheBudget and SampledCacheBudget) load only libvulkan.so.1 outside Windows, and create their instance without VK_KHR_portability_enumeration. With the SDK loader they get VK_ERROR_INCOMPATIBLE_DRIVER. Loading libvulkan.1.dylib and enumerating portability drivers, as BdaDevice does, fixes them (b1b07b8b, 5d64d07c). The three cache budget tests then pass, and oversized_descriptor_sets skips, since the M4 Pro binds fewer than 4097 storage buffers per stage.
  • greet.cpp's __attribute__((constructor)) is folded into .data at -O1: LLVM evaluates it at compile time, so the module has no .init_array and the module fixture never runs an initializer. A dynamic initializer that reads a volatile keeps it. That change, plus volatile function pointers instead of noinline and <ammintrin.h> instead of vector_size, takes the Conventions check from 11 findings to 2: the cleanup attribute and the initial-exec tls_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 main since 6cc0503d (these will show up on the next re-stack)

  • socketpair (8f316964): macOS has no AF_UNIX SOCK_SEQPACKET pair, so guest_socket_pair aborted. It now throws, as Windows does (67ae96de).
  • sceKernelGetCurrentCpu now goes through GuestCpuFromHost. The pthread_cpu_number_np branch sets index and falls through to it (merge commit).

CI

A macos full-build job on macos-latest (arm64 runner, x86-64 under Rosetta). On a cold runner patched_libraries took 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 before ctest. Result: 503 of 505. The failures are guest_ajm (#2163) and host_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, without lds_atomics64 and the flip and display tests)

Current main requires nullDescriptor, so without #2015 every GPU test stops at device creation. With #2015, on the branch: 210 run, 169 pass, 26 skip, 15 fail.

  • The 4 prepared_shaders* tests fail on MSAA storage images (#2016).
  • The other 11:
    • no subgroups in the vertex stage: exec_host_lanes, ngg_vertex_wave_info
    • -0 products come out as +0, the SPIRV-Cross fma(l, r, 0) cause: sdwa_float_selectors, packed_alu, f32_denormal_flush, f32_output_modifier
    • descriptor limits: many_buffers
    • raster order groups: pixel_interlock
    • 40 KiB of threadgroup memory against Metal's 32 KiB: lds_src2
    • buffer_unaligned_base and interpolation_f16 fail on the missing shaderBufferInt64Atomics and Float64, where other tests skip.

vop1_float_unary passes on the M4 Pro.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6089551698 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6089551698). Originally posted by [jermainee](https://github.com/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 current `main` (`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 to `macos-port` itself; the fixes are on my branch, so take whatever is useful. **On `macos-port` as it is** - `macos_fixtures` is registered under `if(APPLE)`, so the relinker-only build registers it too. That build has no `core/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_64` has no effect with CMake 4.4: `project()` sets `CMAKE_SYSTEM_PROCESSOR` back to `arm64`. It is harmless today, since libjpeg-turbo builds with `WITH_SIMD=OFF`, but the value also goes into the shader cache key. `CMAKE_APPLE_SILICON_PROCESSOR=x86_64` set before `project()` works. My branch defaults it and `CMAKE_OSX_ARCHITECTURES` to x86-64 for the full build on a Mac, so a plain `cmake -S . -B build -G Ninja` gives x86-64, and the relinker-only build stays native (`c76a529c`). - `OversizedDescriptorSets` (and, from `main` since, `StorageCacheBudget` and `SampledCacheBudget`) load only `libvulkan.so.1` outside Windows, and create their instance without `VK_KHR_portability_enumeration`. With the SDK loader they get `VK_ERROR_INCOMPATIBLE_DRIVER`. Loading `libvulkan.1.dylib` and enumerating portability drivers, as `BdaDevice` does, fixes them (`b1b07b8b`, `5d64d07c`). The three cache budget tests then pass, and `oversized_descriptor_sets` skips, since the M4 Pro binds fewer than 4097 storage buffers per stage. - `greet.cpp`'s `__attribute__((constructor))` is folded into `.data` at `-O1`: LLVM evaluates it at compile time, so the module has no `.init_array` and the `module` fixture never runs an initializer. A dynamic initializer that reads a `volatile` keeps it. That change, plus volatile function pointers instead of `noinline` and `<ammintrin.h>` instead of `vector_size`, takes the Conventions check from 11 findings to 2: the `cleanup` attribute and the initial-exec `tls_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 `main` since `6cc0503d`** (these will show up on the next re-stack) - `socketpair` (`8f316964`): macOS has no `AF_UNIX` `SOCK_SEQPACKET` pair, so `guest_socket_pair` aborted. It now throws, as Windows does (`67ae96de`). - `sceKernelGetCurrentCpu` now goes through `GuestCpuFromHost`. The `pthread_cpu_number_np` branch sets `index` and falls through to it (merge commit). **CI** A `macos` full-build job on `macos-latest` (arm64 runner, x86-64 under Rosetta). On a cold runner `patched_libraries` took 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 before `ctest`. Result: 503 of 505. The failures are `guest_ajm` (#2163) and `host_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`, without `lds_atomics64` and the flip and display tests) Current `main` requires `nullDescriptor`, so without #2015 every GPU test stops at device creation. With #2015, on the branch: 210 run, 169 pass, 26 skip, 15 fail. - The 4 `prepared_shaders*` tests fail on MSAA storage images (#2016). - The other 11: - no subgroups in the vertex stage: `exec_host_lanes`, `ngg_vertex_wave_info` - -0 products come out as +0, the SPIRV-Cross `fma(l, r, 0)` cause: `sdwa_float_selectors`, `packed_alu`, `f32_denormal_flush`, `f32_output_modifier` - descriptor limits: `many_buffers` - raster order groups: `pixel_interlock` - 40 KiB of threadgroup memory against Metal's 32 KiB: `lds_src2` - `buffer_unaligned_base` and `interpolation_f16` fail on the missing `shaderBufferInt64Atomics` and Float64, where other tests skip. `vop1_float_unary` passes on the M4 Pro. AI-assisted (Claude Code).
Cloud-Multiplayer commented 2026-10-10 01:13:37 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Cloud-Multiplayer on 2026-10-10T01:13:37Z.


@mugurc #1686 (write watch) is rebased onto current main and mergeable again; its nine checks were green before the rebase. Thank you for the slide fix and the mprotect-slide fixture.

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 main merged in. That is a different container from macos-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 with read_symlink("/proc/self/exe") outside Windows. On macOS that fails and the function returns an empty path, so the cache is disabled. _NSGetExecutablePath in an __APPLE__ branch fixes it; ANYPS5_SHADER_CACHE_DIR also 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 of sceKernelGetModuleInfoForUnwind (libkernel/Module/src/Module.cpp) sets eh_frame_hdr_addr and leaves eh_frame_addr and eh_frame_size at zero. A title's own unwinder (the one in its bundled libc.prx) asks for the frame it is in, gets no table, and __cxa_throw ends in terminate. 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 (read eh_frame_ptr from the header, walk the records to the terminator), and reporting the whole image as seg0, fixes it. Two details: the relinker's executable output has no PT_GNU_EH_FRAME, though the table is still at the start of its read-only segment (01 1b 03 3b); and sceSysmoduleGetModuleInfoForUnwind should 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. sceSysmoduleGetModuleInfoForUnwind reads /proc/self/maps outside 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 (every longjmp and every throw walks frames through it), and rendering the address space for each call took about three quarters of the main thread. One mach_vm_region call for the address does the same job.

4. nullDescriptor. main now requires robustness2.nullDescriptor at device creation (VulkanDevice.cpp, "shader runtime requires nullDescriptor"). MoltenVK 1.4.2 has VK_EXT_robustness2 but 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. sceKernelRaiseException is Windows-only. Outside Windows it reaches NotImplemented. The Boehm collector in IL2CPP uses it to stop the world, so a Unity title ends inside il2cpp_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 the pthread_t has to be kept separately.

6. Two costs that only show with many shaders. Structurizer::computeDominatorTree and computePostDominators intersect 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 and agc_structurizer_tests passing. Separately, PrepareRegistered builds 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: main now ends the process on any draw it cannot execute. On MoltenVK that includes host gaps (the PerVertexKHR case, 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6092050292 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6092050292). Originally posted by [Cloud-Multiplayer](https://github.com/Cloud-Multiplayer) on 2026-10-10T01:13:37Z. --- @mugurc #1686 (write watch) is rebased onto current `main` and mergeable again; its nine checks were green before the rebase. Thank you for the slide fix and the `mprotect-slide` fixture. 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 `main` merged in. That is a different container from `macos-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 with `read_symlink("/proc/self/exe")` outside Windows. On macOS that fails and the function returns an empty path, so the cache is disabled. `_NSGetExecutablePath` in an `__APPLE__` branch fixes it; `ANYPS5_SHADER_CACHE_DIR` also 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 of `sceKernelGetModuleInfoForUnwind` (`libkernel/Module/src/Module.cpp`) sets `eh_frame_hdr_addr` and leaves `eh_frame_addr` and `eh_frame_size` at zero. A title's own unwinder (the one in its bundled `libc.prx`) asks for the frame it is in, gets no table, and `__cxa_throw` ends in `terminate`. 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 (read `eh_frame_ptr` from the header, walk the records to the terminator), and reporting the whole image as `seg0`, fixes it. Two details: the relinker's executable output has no `PT_GNU_EH_FRAME`, though the table is still at the start of its read-only segment (`01 1b 03 3b`); and `sceSysmoduleGetModuleInfoForUnwind` should 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. `sceSysmoduleGetModuleInfoForUnwind` reads `/proc/self/maps` outside 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 (every `longjmp` and every throw walks frames through it), and rendering the address space for each call took about three quarters of the main thread. One `mach_vm_region` call for the address does the same job. **4. `nullDescriptor`.** `main` now requires `robustness2.nullDescriptor` at device creation (`VulkanDevice.cpp`, "shader runtime requires nullDescriptor"). MoltenVK 1.4.2 has `VK_EXT_robustness2` but 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. `sceKernelRaiseException` is Windows-only.** Outside Windows it reaches `NotImplemented`. The Boehm collector in IL2CPP uses it to stop the world, so a Unity title ends inside `il2cpp_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 the `pthread_t` has to be kept separately. **6. Two costs that only show with many shaders.** `Structurizer::computeDominatorTree` and `computePostDominators` intersect 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 and `agc_structurizer_tests` passing. Separately, `PrepareRegistered` builds 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: `main` now ends the process on any draw it cannot execute. On MoltenVK that includes host gaps (the `PerVertexKHR` case, 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.
morten-holm commented 2026-10-10 07:59:29 +00:00 (Migrated from github.com)
Author
Contributor

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.cpp writes MH_PIE for executables, but the image is linked at a fixed base (__PAGEZERO up to 0x140000000) 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. The mprotect-slide work covers the pages that end up off a 16 KB boundary. Not setting the flag avoids the slide altogether.

Fix: drop MhPie from the header flags in MacOsImage.cpp:

-    Io::WriteU32(file, 24, MhNoUndefs | MhDyldLink | MhTwoLevel | (input.Executable ? MhPie : 0));
+    Io::WriteU32(file, 24, MhNoUndefs | MhDyldLink | MhTwoLevel);

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.py that MH_PIE is 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-port I 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095403638 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6095403638). Originally posted by [morten-holm](https://github.com/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.cpp` writes `MH_PIE` for executables, but the image is linked at a fixed base (`__PAGEZERO` up to `0x140000000`) 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. The `mprotect-slide` work covers the pages that end up off a 16 KB boundary. Not setting the flag avoids the slide altogether. **Fix:** drop `MhPie` from the header flags in `MacOsImage.cpp`: ```diff - Io::WriteU32(file, 24, MhNoUndefs | MhDyldLink | MhTwoLevel | (input.Executable ? MhPie : 0)); + Io::WriteU32(file, 24, MhNoUndefs | MhDyldLink | MhTwoLevel); ``` 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.py` that `MH_PIE` is 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-port` I 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.
mugurc commented 2026-10-10 09:33:11 +00:00 (Migrated from github.com)
Author
Contributor

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 new main. macos-port is now at 92d7098f; 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. 40cabefd counts 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_PIE stays set for now; clearing it would only help the executable.

@Cloud-Multiplayer thank you for the list.

  • 2 and 3 were true and are fixed in 92d7098f: sceKernelGetModuleInfoForUnwind fills eh_frame_addr and eh_frame_size from the eh_frame_hdr the image keeps in its program headers (a fixture with one CIE exits with 16, and with 0 before), and sceSysmoduleGetModuleInfoForUnwind answers from mach_vm_region and dladdr instead 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.
  • 1: the shader cache directory is fixed on macos-port (_NSGetExecutablePath) but not on main.
  • 5: sceKernelRaiseException is still NotImplemented outside Windows on macos-port. I have not looked at it yet.
  • 4 waits for #2015; 6 and the draw policy are for @boykopovar.

@mrzacarias thank you for running Balatro. I'll look at your packager commits (the app0 link 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-port until @boykopovar says how they should come in.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6096161601 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6096161601). Originally posted by [mugurc](https://github.com/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 new `main`. `macos-port` is now at `92d7098f`; 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`. `40cabefd` counts 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_PIE` stays set for now; clearing it would only help the executable. @Cloud-Multiplayer thank you for the list. - 2 and 3 were true and are fixed in `92d7098f`: `sceKernelGetModuleInfoForUnwind` fills `eh_frame_addr` and `eh_frame_size` from the `eh_frame_hdr` the image keeps in its program headers (a fixture with one CIE exits with 16, and with 0 before), and `sceSysmoduleGetModuleInfoForUnwind` answers from `mach_vm_region` and `dladdr` instead 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. - 1: the shader cache directory is fixed on `macos-port` (`_NSGetExecutablePath`) but not on `main`. - 5: `sceKernelRaiseException` is still `NotImplemented` outside Windows on `macos-port`. I have not looked at it yet. - 4 waits for #2015; 6 and the draw policy are for @boykopovar. @mrzacarias thank you for running Balatro. I'll look at your packager commits (the `app0` link 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-port` until @boykopovar says how they should come in.
DavidSamir commented 2026-10-10 11:19:58 +00:00 (Migrated from github.com)
Author
Contributor

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-port at 92d7098f.

Branch as is

  • Full build and libs: clean. ctest without a loader: 509 tests, 296 pass, 211 skip, 2 not passed.
  • patched_libraries times out at 120 s under --parallel 8; alone it passes in 66 s.
  • guest_tcp aborts 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).
  • With the loader, every GPU test still skips: shader runtime requires nullDescriptor (needs #2015).

With #2015 on top (cherry-picked; four one-hunk conflicts: the test list in libSceAgcDriver/CMakeLists.txt, the bufferInt64Atomics lines in VulkanDevice.cpp and Context.hpp that the branch does not have, and TechnicalDebt.md)

  • GPU tests, -j1 --timeout 30, without lds_atomics64 and guest_video_out_wqhd_detection: 209 run, 166 pass, 27 skip, 16 fail.
  • The 16 are jermainee's 15 from the M4 Pro plus 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.bin and sce_module/libc.prx unwrapped from their SELF containers)

  1. package_macos_app.py and the relinker disagree on the guest module path. The executable loads @executable_path/app0/sce_module/libc.prx.guest.prx; the packager puts eboot in Contents/MacOS and app0 in Contents/Resources/game. dyld stops at launch with Library not loaded. A symlink Contents/MacOS/app0 -> ../Resources/game/app0 gets past it. Any title with a bundled module is affected.
  2. #1497 applies to --macos too: GuestModuleBuilder takes the non-Windows path. A/B with the same libraries, only the relinker differing:
    • without #1529: two empty [notification] lines, /app0/test.cfg opened with a garbage mode, doom1.wad never opened, exit 0 after 7 s;
    • with #1529's GuestModuleBuilder.cpp change (applies cleanly): debug text is printed, doom1.wad opens, the device and swapchain are created, and the shareware demo loop runs at 23 to 28 FPS (window title counter, 996 frames).
  3. First launch with an empty shader cache: gpu: frame 1 never completed, then video: GPU presentation failed, switching to the CPU scaler. Second launch with the cache warm: neither line.
  4. /download0 does not exist in the bundle's game folder: cannot write /download0/doom.log (errno 2).

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6096952968 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6096952968). Originally posted by [DavidSamir](https://github.com/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-port` at 92d7098f. **Branch as is** - Full build and `libs`: clean. ctest without a loader: 509 tests, 296 pass, 211 skip, 2 not passed. - `patched_libraries` times out at 120 s under `--parallel 8`; alone it passes in 66 s. - `guest_tcp` aborts 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). - With the loader, every GPU test still skips: `shader runtime requires nullDescriptor` (needs #2015). **With #2015 on top** (cherry-picked; four one-hunk conflicts: the test list in `libSceAgcDriver/CMakeLists.txt`, the `bufferInt64Atomics` lines in `VulkanDevice.cpp` and `Context.hpp` that the branch does not have, and `TechnicalDebt.md`) - GPU tests, `-j1 --timeout 30`, without `lds_atomics64` and `guest_video_out_wqhd_detection`: 209 run, 166 pass, 27 skip, 16 fail. - The 16 are jermainee's 15 from the M4 Pro plus `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.bin` and `sce_module/libc.prx` unwrapped from their SELF containers) 1. `package_macos_app.py` and the relinker disagree on the guest module path. The executable loads `@executable_path/app0/sce_module/libc.prx.guest.prx`; the packager puts `eboot` in `Contents/MacOS` and `app0` in `Contents/Resources/game`. dyld stops at launch with `Library not loaded`. A symlink `Contents/MacOS/app0 -> ../Resources/game/app0` gets past it. Any title with a bundled module is affected. 2. #1497 applies to `--macos` too: `GuestModuleBuilder` takes the non-Windows path. A/B with the same libraries, only the relinker differing: - without #1529: two empty `[notification]` lines, `/app0/test.cfg` opened with a garbage mode, `doom1.wad` never opened, exit 0 after 7 s; - with #1529's `GuestModuleBuilder.cpp` change (applies cleanly): debug text is printed, `doom1.wad` opens, the device and swapchain are created, and the shareware demo loop runs at 23 to 28 FPS (window title counter, 996 frames). 3. First launch with an empty shader cache: `gpu: frame 1 never completed`, then `video: GPU presentation failed, switching to the CPU scaler`. Second launch with the cache warm: neither line. 4. `/download0` does not exist in the bundle's game folder: `cannot write /download0/doom.log (errno 2)`. AI-assisted: yes
Bruggi-ch commented 2026-10-10 19:16:47 +00:00 (Migrated from github.com)
Author
Contributor

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 on macos-port; this one covers only what is already in main.

Setup

  • Apple M5 (MacBook Air, 32 GB), macOS 27.0.1 (26A434), Apple clang 21.0.0
  • CMake 4.4.4, Ninja 1.13.2
  • Rosetta 2 freshly installed (softwareupdate --install-rosetta)
  • main at 1476f769

Relinker-only build (-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON, native arm64)

  • Full build in about 8 s
  • ctest: 91 of 91 passed

Write watch and register context (as described in BUILD.md, -DCMAKE_OSX_ARCHITECTURES=x86_64, run under Rosetta; file confirms an x86_64 Mach-O binary)

  • write_watch_tests: 5 of 5 passed. write_watch_threads took 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-linkage warnings from libc/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 in main.

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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101224955 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6101224955). Originally posted by [Bruggi-ch](https://github.com/Bruggi-ch) on 2026-10-10T19:16:47Z. --- Short report from a base Apple M5 (MacBook Air) on current `main`. Most results above are on `macos-port`; this one covers only what is already in `main`. **Setup** - Apple M5 (MacBook Air, 32 GB), macOS 27.0.1 (26A434), Apple clang 21.0.0 - CMake 4.4.4, Ninja 1.13.2 - Rosetta 2 freshly installed (`softwareupdate --install-rosetta`) - `main` at `1476f769` **Relinker-only build** (`-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON`, native arm64) - Full build in about 8 s - `ctest`: 91 of 91 passed **Write watch and register context** (as described in BUILD.md, `-DCMAKE_OSX_ARCHITECTURES=x86_64`, run under Rosetta; `file` confirms an x86_64 Mach-O binary) - `write_watch_tests`: 5 of 5 passed. `write_watch_threads` took 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-linkage` warnings from `libc/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 in `main`. 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)
Bruggi-ch commented 2026-10-10 19:43:16 +00:00 (Migrated from github.com)
Author
Contributor

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-port at 2861c1a, 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

  • ninja and ninja libs: no errors, 2 min 40 s.
  • ctest -j4 --timeout 180: 510 tests, 299 passed, 211 skipped, 0 failed, 56 s. patched_libraries took 30 s, the slowest.

Flaky tests, 50 sequential runs each

  • guest_tcp: 47 passed, 3 aborted.
  • host_thread_local: 49 passed, 1 aborted.
  • I did not capture the failure reason of the aborts.

GPU tests through MoltenVK, with #2015 on top
I cherry-picked b288aa84 (#2015) onto macos-port. It conflicted in libSceAgcDriver/CMakeLists.txt, VulkanDevice.cpp, Context.hpp and TechnicalDebt.md, as DavidSamir described. I kept only the placeholder-image parts and dropped the bufferInt64Atomics lines, which this branch does not have.

ctest -j1 --timeout 30, without lds_atomics64 and guest_video_out_wqhd_detection: 509 tests, 469 passed, 25 skipped, 15 failed.

Failures, with the first message each test printed:

  • -0.0 becomes +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_unary passed 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 as exec_host_lanes. #1565 fixed that test, but NggVertexWaveInfo.cpp on current main has 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 need shaderFloat64 skip 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_lanes and many_buffers fail on macos-port only because it does not have #1565 and #1580 yet.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101470970 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6101470970). Originally posted by [Bruggi-ch](https://github.com/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-port` at `2861c1a`, 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** - `ninja` and `ninja libs`: no errors, 2 min 40 s. - `ctest -j4 --timeout 180`: 510 tests, 299 passed, 211 skipped, 0 failed, 56 s. `patched_libraries` took 30 s, the slowest. **Flaky tests, 50 sequential runs each** - `guest_tcp`: 47 passed, 3 aborted. - `host_thread_local`: 49 passed, 1 aborted. - I did not capture the failure reason of the aborts. **GPU tests through MoltenVK, with #2015 on top** I cherry-picked b288aa84 (#2015) onto `macos-port`. It conflicted in `libSceAgcDriver/CMakeLists.txt`, `VulkanDevice.cpp`, `Context.hpp` and `TechnicalDebt.md`, as DavidSamir described. I kept only the placeholder-image parts and dropped the `bufferInt64Atomics` lines, which this branch does not have. `ctest -j1 --timeout 30`, without `lds_atomics64` and `guest_video_out_wqhd_detection`: 509 tests, 469 passed, 25 skipped, 15 failed. Failures, with the first message each test printed: - `-0.0` becomes `+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_unary` passed 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 as `exec_host_lanes`. #1565 fixed that test, but `NggVertexWaveInfo.cpp` on current `main` has 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 need `shaderFloat64` skip 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_lanes` and `many_buffers` fail on `macos-port` only because it does not have #1565 and #1580 yet.
mugurc commented 2026-10-11 10:39:41 +00:00 (Migrated from github.com)
Author
Contributor

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. main has 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 and VirtualQuery, 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108162174 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6108162174). Originally posted by [mugurc](https://github.com/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. `main` has 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 and `VirtualQuery`, 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.
mugurc commented 2026-10-11 10:53:37 +00:00 (Migrated from github.com)
Author
Contributor

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 main gains code that only compiles on Linux every few hours. In the last 12 hours alone: feof_unlocked and getc_unlocked called as ::name (they are macros on macOS), ppoll and POLLRDHUP, ucontext register names in sceKernelRaiseException, a constexpr 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 macos job in build.yml next to linux and windows, with the same triggers (push to main and 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108269431 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6108269431). Originally posted by [mugurc](https://github.com/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 `main` gains code that only compiles on Linux every few hours. In the last 12 hours alone: `feof_unlocked` and `getc_unlocked` called as `::name` (they are macros on macOS), `ppoll` and `POLLRDHUP`, `ucontext` register names in `sceKernelRaiseException`, a `constexpr 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 `macos` job in `build.yml` next to `linux` and `windows`, with the same triggers (push to `main` and 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.
krishalivaibhav commented 2026-10-11 11:00:28 +00:00 (Migrated from github.com)
Author
Contributor

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 SystemPlatform instance present while its account pointer remained null and CurrentPlatform remained zero for 80 seconds. The observed game initialization path assigns those fields only after PS5Account construction 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108321944 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6108321944). Originally posted by [krishalivaibhav](https://github.com/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 `SystemPlatform` instance present while its account pointer remained null and `CurrentPlatform` remained zero for 80 seconds. The observed game initialization path assigns those fields only after `PS5Account` construction 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.
krishalivaibhav commented 2026-10-11 11:12:23 +00:00 (Migrated from github.com)
Author
Contributor

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 CurrentPlatform remained zero throughout. No sampled instruction pointer landed in the selected SystemPlatform.Initialize, PS5Account constructor / InitNpSystem, preloader account-wait, or PlatformIntegration method 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108415236 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6108415236). Originally posted by [krishalivaibhav](https://github.com/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 `CurrentPlatform` remained zero throughout. No sampled instruction pointer landed in the selected `SystemPlatform.Initialize`, `PS5Account` constructor / `InitNpSystem`, preloader account-wait, or `PlatformIntegration` method 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.
krishalivaibhav commented 2026-10-11 11:49:34 +00:00 (Migrated from github.com)
Author
Contributor

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 synchronous Unity.PSN.PS5.Main.Initialize call. Before it starts UserSystem or publishes the account, Main.Initialize calls the dynamically resolved PSN_PrxInitialize entry and checks its result; the nonzero-result path throws. It then calls PrxIsSystemEventQueueInitialized; 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108709001 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6108709001). Originally posted by [krishalivaibhav](https://github.com/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 synchronous `Unity.PSN.PS5.Main.Initialize` call. Before it starts `UserSystem` or publishes the account, `Main.Initialize` calls the dynamically resolved `PSN_PrxInitialize` entry and checks its result; the nonzero-result path throws. It then calls `PrxIsSystemEventQueueInitialized`; 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.
jeank93 commented 2026-10-11 13:46:24 +00:00 (Migrated from github.com)
Author
Contributor

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109682707 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6109682707). Originally posted by [jeank93](https://github.com/jeank93) on 2026-10-11T13:46:24Z. --- I found this fork for macOS https://github.com/RINNECODER/AnyPS5
mrzacarias commented 2026-10-11 22:30:10 +00:00 (Migrated from github.com)
Author
Contributor

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, main at a11c8f7f7 plus #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_dwordx4 through the V# in s[4:7] instead of taking it from the user SGPRs:

d7460004 04010c08 f4280302 fa000000 bf8cc07f 7e00020c 7e02020d 7e04020e 7e06020f e01c2000 80000004 bf810000

matchesFillKernel only 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_TEST only 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 guest mprotect on watched memory leaves the macOS watch with stale state.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114613325 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6114613325). Originally posted by [mrzacarias](https://github.com/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, `main` at `a11c8f7f7` plus #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_dwordx4` through the V# in `s[4:7]` instead of taking it from the user SGPRs: ``` d7460004 04010c08 f4280302 fa000000 bf8cc07f 7e00020c 7e02020d 7e04020e 7e06020f e01c2000 80000004 bf810000 ``` `matchesFillKernel` only 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_TEST` only 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 guest `mprotect` on watched memory leaves the macOS watch with stale state.
mugurc commented 2026-10-11 23:50:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-11T23:50:53Z.


@mrzacarias on your last point: the macos-port branch (https://github.com/mugurc/AnyPS5/tree/macos-port) calls GuestWriteWatchProtectionChanged from DoMprotect in DirectMemory.cpp, so a guest mprotect on watched memory updates the macOS watch there. On main it is still only called from tests, as you saw; it goes in with the memory-protection PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115288270 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6115288270). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-11T23:50:53Z. --- @mrzacarias on your last point: the `macos-port` branch (https://github.com/mugurc/AnyPS5/tree/macos-port) calls `GuestWriteWatchProtectionChanged` from `DoMprotect` in `DirectMemory.cpp`, so a guest `mprotect` on watched memory updates the macOS watch there. On `main` it is still only called from tests, as you saw; it goes in with the memory-protection PR.
krishalivaibhav commented 2026-10-12 07:24:54 +00:00 (Migrated from github.com)
Author
Contributor

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=1 improved 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6119687871 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6119687871). Originally posted by [krishalivaibhav](https://github.com/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=1` improved 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.
krishalivaibhav commented 2026-10-12 07:56:53 +00:00 (Migrated from github.com)
Author
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120126728 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6120126728). Originally posted by [krishalivaibhav](https://github.com/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.
krishalivaibhav commented 2026-10-12 10:34:36 +00:00 (Migrated from github.com)
Author
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6122526025 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6122526025). Originally posted by [krishalivaibhav](https://github.com/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.
mugurc commented 2026-10-12 12:33:38 +00:00 (Migrated from github.com)
Author
Contributor

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 libs and ctest run on macOS 26 under Rosetta).

Order:

  1. Build the tree: 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.
  2. The Mach-O guest runtime: thread-local storage, starting the guest off the main thread, image registration, memory protection and sceKernelVirtualQuery. The relinker that is already in main emits calls to Aps5GuestTls* and Aps5StartGuest; nothing in core/libs provides them yet, so a relinked macOS executable cannot run on main today.
  3. MoltenVK: Vulkan device creation, guest page description, thread priority, one SDL copy, and three SPIR-V workarounds for Metal.
  4. Tooling: the macOS fixture runner for relinked programs, and the app packager.

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.yml stays open; it would be the last pull request of the series.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6124344298 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6124344298). Originally posted by [mugurc](https://github.com/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 libs` and `ctest` run on macOS 26 under Rosetta). Order: 1. Build the tree: `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. 2. The Mach-O guest runtime: thread-local storage, starting the guest off the main thread, image registration, memory protection and `sceKernelVirtualQuery`. The relinker that is already in main emits calls to `Aps5GuestTls*` and `Aps5StartGuest`; nothing in `core/libs` provides them yet, so a relinked macOS executable cannot run on main today. 3. MoltenVK: Vulkan device creation, guest page description, thread priority, one SDL copy, and three SPIR-V workarounds for Metal. 4. Tooling: the macOS fixture runner for relinked programs, and the app packager. 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.yml` stays open; it would be the last pull request of the series.
mugurc commented 2026-10-12 17:04:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-12T17:04:05Z.


Opened: #4626, #4627, #4628, #4629 and #4630 (after #4628).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128891460 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6128891460). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-12T17:04:05Z. --- Opened: #4626, #4627, #4628, #4629 and #4630 (after #4628).
mugurc commented 2026-10-12 17:04:06 +00:00 (Migrated from github.com)
Author
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128891829 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6128891829). Originally posted by [mugurc](https://github.com/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.
011010 commented 2026-10-12 17:59:44 +00:00 (Migrated from github.com)
Author
Contributor

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

  • Apple M4, 24 GB, macOS 26.6.2 (25G83); x86-64 runtime under Rosetta 2.
  • AppleClang 21.0.0.21000334, CMake 4.4.4, Ninja 1.13.2.
  • mugurc/macos-port at de3ef5d53 ("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/libs holds 124 .prx, each Mach-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:

  • AGC/GPU tests (334): skipped, no usable Vulkan device: AGC graphics: cannot load Vulkan.
  • video_out_flip_* and guest_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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6129746306 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6129746306). Originally posted by [011010](https://github.com/011010) on 2026-10-12T17:59:44Z. --- macOS build and test report — Apple M4 (Mac mini), x86-64 runtime under Rosetta 2. **Environment** - Apple M4, 24 GB, macOS 26.6.2 (25G83); x86-64 runtime under Rosetta 2. - AppleClang 21.0.0.21000334, CMake 4.4.4, Ninja 1.13.2. - `mugurc/macos-port` at `de3ef5d53` ("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/libs` holds 124 `.prx`, each `Mach-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: - AGC/GPU tests (334): `skipped, no usable Vulkan device: AGC graphics: cannot load Vulkan`. - `video_out_flip_*` and `guest_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.
011010 commented 2026-10-12 18:31:13 +00:00 (Migrated from github.com)
Author
Contributor

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, so export 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.py only 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6130236479 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6130236479). Originally posted by [011010](https://github.com/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, so `export 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.py` only 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.
011010 commented 2026-10-12 19:32:30 +00:00 (Migrated from github.com)
Author
Contributor

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 call sceVideoOutOpen from main() and never call Aps5StartGuest, so SDL creates the NSWindow off the main thread. libSceVideoOut/tests/Flip.cpp already avoids this by running its body inside Aps5StartGuest_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).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6131220246 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6131220246). Originally posted by [011010](https://github.com/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 call `sceVideoOutOpen` from `main()` and never call `Aps5StartGuest`, so SDL creates the NSWindow off the main thread. `libSceVideoOut/tests/Flip.cpp` already avoids this by running its body inside `Aps5StartGuest_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).
krishalivaibhav commented 2026-10-12 19:51:18 +00:00 (Migrated from github.com)
Author
Contributor

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6131512943 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6131512943). Originally posted by [krishalivaibhav](https://github.com/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). ;-;
krishalivaibhav commented 2026-10-12 23:19:35 +00:00 (Migrated from github.com)
Author
Contributor

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_FINI arrays or replace guest finalization with forced termination.

Validation:

  • A synthetic test exercises the actual guest-startup path and host Cxa cleanup registry. Saved old libc fails because its loader callback is null (child exit 32). Candidate startup, libc TLS and relinker TLS tests each pass three repetitions; callback/exit events verify finite reverse cleanup and subsequent native exit.
  • A real normal-exit probe returns 0. In a separate uninstrumented game run, the user physically pressed Command-Q and reported prompt closure; the process returned 0 after 43.24 seconds without a bounded stop.
  • Startup and regression source compile for ARM64. Runtime validation so far is x86-64 under Rosetta, not native ARM64.

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6134481555 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6134481555). Originally posted by [krishalivaibhav](https://github.com/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_FINI` arrays or replace guest finalization with forced termination. Validation: - A synthetic test exercises the actual guest-startup path and host Cxa cleanup registry. Saved old libc fails because its loader callback is null (child exit 32). Candidate startup, libc TLS and relinker TLS tests each pass three repetitions; callback/exit events verify finite reverse cleanup and subsequent native exit. - A real normal-exit probe returns 0. In a separate uninstrumented game run, the user physically pressed Command-Q and reported prompt closure; the process returned 0 after 43.24 seconds without a bounded stop. - Startup and regression source compile for ARM64. Runtime validation so far is x86-64 under Rosetta, not native ARM64. 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.
itar3 commented 2026-10-13 00:30:12 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by itar3 on 2026-10-13T00:30:12Z.


103. vampire-survivors-m2-gameplay.mp4

  M2, 16 GB RAM, modified local AnyPS5 build. Gameplay works; a later vertex-subgroup crash remains under investigation.
  (quality degraded due to compression).
  ;-;

could you do a step by step guide how did you make run please?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135291716 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6135291716). Originally posted by [itar3](https://github.com/itar3) on 2026-10-13T00:30:12Z. --- > 103\. vampire-survivors-m2-gameplay.mp4 > > > > > > > > > M2, 16 GB RAM, modified local AnyPS5 build. Gameplay works; a later vertex-subgroup crash remains under investigation. > (quality degraded due to compression). > ;-; could you do a step by step guide how did you make run please?
krishalivaibhav commented 2026-10-13 04:44:22 +00:00 (Migrated from github.com)
Author
Contributor

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:

lipo -archs /absolute/path/to/libMoltenVK.dylib

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_sys metadata and game assets from your own dump. An encrypted package, just eboot.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:

cd /path/to/integrated-AnyPS5
# For a Git checkout whose submodule revisions are pinned:
git submodule update --init --recursive
cmake -S . -B build-macos -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_OSX_ARCHITECTURES=x86_64 \
  -DBUILD_TESTING=ON \
  -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build-macos --parallel 2
cmake --build build-macos --target libs --parallel 2

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 the unpatched intermediate libraries. Preserve the source SHA, local patches and submodule revisions alongside the build.

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_generated module, 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 --help describes 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:

run/
  eboot.bin                 # converted Mach-O, not the original ELF
  libs/                     # matching patched host .prx packages
  app0/                     # original assets/metadata + consistently converted plugins

Keep the guest module paths expected by the game. The converted executable searches @executable_path/libs. Run from run/ 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.dylib alias pointing to the actual MoltenVK dylib. With that alias and the complete run directory in place, the essential launch environment is:

cd /path/to/run
SDL_VULKAN_LIBRARY=/absolute/path/to/mvk-dir/libvulkan.1.dylib \
DYLD_LIBRARY_PATH=/absolute/path/to/mvk-dir \
MVK_CONFIG_LOG_LEVEL=1 \
./eboot.bin > vampire-survivors.log 2>&1

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6138415359 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6138415359). Originally posted by [krishalivaibhav](https://github.com/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: ```sh lipo -archs /absolute/path/to/libMoltenVK.dylib ``` 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_sys` metadata and game assets from your own dump. An encrypted package, just `eboot.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: ```sh cd /path/to/integrated-AnyPS5 # For a Git checkout whose submodule revisions are pinned: git submodule update --init --recursive cmake -S . -B build-macos -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_OSX_ARCHITECTURES=x86_64 \ -DBUILD_TESTING=ON \ -DANYPS5_ENABLE_SPIRV_TOOLS=ON cmake --build build-macos --parallel 2 cmake --build build-macos --target libs --parallel 2 ``` 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 the `unpatched` intermediate 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_generated` module, 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 `--help` describes 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: ```text run/ eboot.bin # converted Mach-O, not the original ELF libs/ # matching patched host .prx packages app0/ # original assets/metadata + consistently converted plugins ``` Keep the guest module paths expected by the game. The converted executable searches `@executable_path/libs`. Run from `run/` 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.dylib` alias pointing to the actual MoltenVK dylib. With that alias and the complete run directory in place, the essential launch environment is: ```sh cd /path/to/run SDL_VULKAN_LIBRARY=/absolute/path/to/mvk-dir/libvulkan.1.dylib \ DYLD_LIBRARY_PATH=/absolute/path/to/mvk-dir \ MVK_CONFIG_LOG_LEVEL=1 \ ./eboot.bin > vampire-survivors.log 2>&1 ``` 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.
krishalivaibhav commented 2026-10-13 07:26:20 +00:00 (Migrated from github.com)
Author
Contributor

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..2 viewport, 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 legal 0..1 viewport, 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 main currently supports.

AI-assisted: yes. User observations, independently reported platform tests, local regression/GPU evidence, and unresolved limitations are distinguished above.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140534450 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6140534450). Originally posted by [krishalivaibhav](https://github.com/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..2` viewport, 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 legal `0..1` viewport, 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 `main` currently supports. AI-assisted: yes. User observations, independently reported platform tests, local regression/GPU evidence, and unresolved limitations are distinguished above.
Zheorgyan commented 2026-10-13 09:28:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-13T09:28:13Z.


lds_src2 on Metal is already fixed on main by 7144bb57e, which spills oversized compute LDS to a storage buffer, it passes on the M1 Pro with macos-port at b7eb6b6b. I closed #5043

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6142525178 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6142525178). Originally posted by [Zheorgyan](https://github.com/Zheorgyan) on 2026-10-13T09:28:13Z. --- `lds_src2` on Metal is already fixed on `main` by 7144bb57e, which spills oversized compute LDS to a storage buffer, it passes on the M1 Pro with `macos-port` at `b7eb6b6b`. I closed #5043
Zheorgyan commented 2026-10-13 10:36:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported 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-port at b7eb6b6b, APS5_NO_WRITE_WATCH=1 makes srgb8_color_target, packed_unorm_color_target, swap_alt_blend, alpha_to_coverage, dual_source_blend, array_layer_target, storage_one_slice_alias and dcc_keys_first_write pass, depth_compare_copy needs the watch. srgb8_color_target passed on c3affc1c, before the watch was in. the GPU result never reaches the watched guest memory, APS5_WRITE_WATCH_IMPORTS does not change it. I am looking for where

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6143667712 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6143667712). Originally posted by [Zheorgyan](https://github.com/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-port` at `b7eb6b6b`, `APS5_NO_WRITE_WATCH=1` makes `srgb8_color_target`, `packed_unorm_color_target`, `swap_alt_blend`, `alpha_to_coverage`, `dual_source_blend`, `array_layer_target`, `storage_one_slice_alias` and `dcc_keys_first_write` pass, `depth_compare_copy` needs the watch. `srgb8_color_target` passed on `c3affc1c`, before the watch was in. the GPU result never reaches the watched guest memory, `APS5_WRITE_WATCH_IMPORTS` does not change it. I am looking for where
Zheorgyan commented 2026-10-13 11:41:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported 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 agc tests on macos-port. @mugurc it is against main, the same change applies to macos-port with its older ImportWatched

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6144733983 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6144733983). Originally posted by [Zheorgyan](https://github.com/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 `agc` tests on `macos-port`. @mugurc it is against `main`, the same change applies to `macos-port` with its older `ImportWatched`
itar3 commented 2026-10-13 16:46:33 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by itar3 on 2026-10-13T16:46:33Z.


[src/VulkanDevice.cpp:885 VulkanDevice] VulkanDevice constructor window=0x347da2da8
[src/VulkanDevice.cpp:896 VulkanDevice] Vulkan loader loaded library=0x342d50
[src/VulkanDevice.cpp:912 VulkanDevice] Presentation window context=0x6000008801e0 extent=1920x1080 extensions=2
[src/VulkanDevice.cpp:935 VulkanDevice] Vulkan instance created instance=0x7f91c2849c00
[src/VulkanDevice.cpp:940 VulkanDevice] Vulkan surface created surface=0x6000019a0a80 window=0x6000008801e0
[src/VulkanDevice.cpp:946 VulkanDevice] Physical device count=1
[src/VulkanDevice.cpp:979 VulkanDevice] Physical device candidate=0x6000037e09a0 name=Apple M4 Pro api=0x401165 type=1
[src/VulkanDevice.cpp:1026 VulkanDevice] Physical device selected physical=0x6000037e09a0 queueFamily=0
[src/VulkanDevice.cpp:1039 VulkanDevice] Selected GPU name=Apple M4 Pro vendor=0x106b device=0x1b000209 subgroup=32
[src/VulkanDevice.cpp:1041 VulkanDevice] Memory heap 0 size=24576.0 MiB flags=0x1
[src/VulkanDevice.cpp:1042 VulkanDevice] Memory type 0 heap=0 flags=0x1
[src/VulkanDevice.cpp:1042 VulkanDevice] Memory type 1 heap=0 flags=0xf
[src/VulkanDevice.cpp:1042 VulkanDevice] Memory type 2 heap=0 flags=0x11
[src/VulkanDevice.cpp:1360 VulkanDevice] Vulkan features tessellationAvailable=1 mesh=0 depthClip=1 depthRangeUnrestricted=0 pipelineLibrary=0
[src/VulkanDevice.cpp:1597 VulkanDevice] Vulkan device ready device=0x7f91c287c218 queue=0x7f91c1504ec8 family=0
[write-watch] host imports resolve write protection: no (0 of 4 scratch pages written after a GPU read, 0 after a GPU write, 0 after the import); imported ranges stay watched
[src/VulkanDevice.cpp:1635 VulkanDevice] Surface capabilities drawable=2160x1216 min=1x1 max=16384x16384 minImages=2 maxImages=3 usage=0x1f
[src/VulkanDevice.cpp:1679 VulkanDevice] Swapchain created swapchain=0x7f91c28b6000 extent=2160x1216 images=2
[src/Thread.cpp:413 RunThread] RunThread entry=0x140026640 arg=0x0 self=0x7f91c132eee0
[SAVEDATA:native] mount3 user=268435456 dir=SAVEDATA mode=0x1 blocks=48 -> 0x00000000 point=/savedata0 status=0
[SAVEDATA:native] umount2 mode=0x0 point=/savedata0 -> 0x00000000
[shader-disk-cache] /Users/Itt339/Downloads/5/shader_cache/ce44ca1d80d3af6e (source version ce44ca1d80d3af6e, format 27)
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c33042e0
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c1204810
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c15316e0
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c07474c0
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c1730a50
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c12049c0
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c0747670
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c1730f30
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3304610
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3104a10
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3206150
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3206300
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3104bc0
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3104d70
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3304930
[src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3206620
[SAVEDATA:native] mount3 user=268435456 dir=SAVEDATA mode=0x20 blocks=48 -> 0x00000000 point=/savedata0 status=0
[SAVEDATA:native] mount3 user=268435456 dir=SAVEDATA mode=0x20 blocks=48 -> 0x809f0003 point= status=0
[Shaders/ShaderRegistry.cpp:838 operator()] Shader 0x14226e800 could not be prepared after registration: shader 0x14226e800 stage 0: ShaderRecompiler::Recompile: SPIR-V module emission failed: storage image multisampling is unavailable on the target device
RecompileRequest:
NVNQQREAAAAAAOgmQgEAAABEAAAAAAAAAAEAoL8EAEbXDAYBBAUARtcNBgUEDgIMfoICDn4IAgB+CQICfgoCBH4LAgZ+gwIQfjgPIPAEAAAAOg8g8AQAAAAFBggAAACBvwAAAAAAAAAAc2wwMHEAAACLAAAAAAAAAFclEAAApgEEEAoQCxAMEEBAQiBLEEwQTRBOEG9geRB6EIUQAABuAABkDyAhECRAJRAAAGQhECRAAABcKFApEAAAgUACoACEeNaLEIAAShBDAF0QXV80OAoAYgsQYmYwNWsVbwIICAFrAQ6QTv8DAFEMoICAQCCmi8rmDwAAAAAAYmFyZWZvb3RKIIyYAAAAAAEAAABIAAAAAAAAAIsAAAADu3HLpoXS/AAAAAAAAAAAKGAmQgEAAAAwAQAAAAAAADEyMzQYAAAACGEmQgEAAAAA6CZCAQAAAAAAAAAAAAAAuGAmQgEAAACIYCZCAQAAAAAAAAAAAAAAAAAAAAAAAAAwAQAAEAEAAAAAAAAOAAAAAAAAAAAAAAAwAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAAAAMAAAAAAAAAAAAAAAAAAAAAABiAgAAAAAAAAwCAADoJkIBDQIAAAAAAAAqAgAA4AAAKCoCAABKIIyYEgIAAIIALEATAgAAmAsAACgCAAAAAAAABwIAAAgAAAAIAgAACAAAAAkCAAABAAAAQGEmQgEAAABYYSZCAQAAAFhhJkIBAAAAWGEmQgEAAABYYSZCAQAAAAAADAALAAAAAAAAAAAAAAD//wAA////////////////////////AABAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQgAAAAIAAAAAQAAAAAAAAABAQEAAgAAAAAAAgAAAAAAAAAA6CZCAQAAABABAAAAAAAAAQCgvwQARtcMBgEEBQBG1w0GBQQOAgx+ggIOfggCAH4JAgJ+CgIEfgsCBn6DAhB+OA8g8AQAAAA6DyDwBAAAAAUGCAAAAIG/AAAAAAAAAABzbDAwcQAAAIsAAAAAAAAAVyUQAACmAQQQChALEAwQQEBCIEsQTBBNEE4Qb2B5EHoQhRAAAG4AAGQPICEQJEAlEAAAZCEQJEAAAFwoUCkQAACBQAKgAIR41osQgABKEEMAXRBdXzQ4CgBiCxBiZjA1axVvAggIAWsBDpBO/wMAUQyggIBAIKaLyuYPAAAAAABiYXJlZm9vdEogjJgAAAAAAQAAAEgAAAAAAAAAiwAAAAO7ccumhdL8AAAAAAAAAAAoYCZCAQAAADABAAAAAAAAMTIzNBgAAAAIYSZCAQAAAADoJkIBAAAAAAAAAAAAAAC4YCZCAQAAAIhgJkIBAAAAAAAAAAAAAAAAAAAAAAAAADABAAAQAQAAAAAAAA4AAAAAAAAAAAAAADAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAACEAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAGICAAAAAAAADAIAAOgmQgENAgAAAAAAACoCAADgAAAoKgIAAEogjJgSAgAAggAsQBMCAACYCwAAKAIAAAAAAAAHAgAACAAAAAgCAAAIAAAACQIAAAEAAABAYSZCAQAAAFhhJkIBAAAAWGEmQgEAAABYYSZCAQAAAFhhJkIBAAAAAAAMAAsAAAAAAAAAAAAAAP//AAD///////////////////////8AAAHAAAAAAQAAABBAAAADAQAgAAAAAQAAABcAAAAAAAAAAQAAAAMAAAALAAAAGQAAAB0AAAAfAAAAIAAAACoAAAAwAAAANwAAADgAAAA9AAAAPwAAAEAAAABBAAAAYBEAAHIRAACVEwAAtRQAALsUAAC9FAAA4xQAAAIVAAAGAAAAAAAAABsAAAAAAAAAU1BWX0VYVF9kZXNjcmlwdG9yX2luZGV4aW5nIQAAAAAAAABTUFZfRVhUX2ZyYWdtZW50X3NoYWRlcl9pbnRlcmxvY2sdAAAAAAAAAFNQVl9FWFRfc2hhZGVyX3N0ZW5jaWxfZXhwb3J0FAAAAAAAAABTUFZfS0hSXzhiaXRfc3RvcmFnZRYAAAAAAAAAU1BWX0tIUl9mbG9hdF9jb250cm9scx8AAAAAAAAAU1BWX0tIUl9waHlzaWNhbF9zdG9yYWdlX2J1ZmZlcgAABAAAAAQAAAAEAAAABAAAAIAAAAABIAAAAHwAAAB8AAAAeAAAAPgPAAB8AAAAfAAAAAAAAAAAAAAAAAAAAIAAAAAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAEANAwA=
[Shaders/ShaderRegistry.cpp:838 operator()] Shader 0x14226e700 could not be prepared after registration: shader 0x14226e700 stage 0: ShaderRecompiler::Recompile: SPIR-V module emission failed: storage image multisampling is unavailable on the target device
RecompileRequest:
NVNQQREAAAAAAOcmQgEAAABAAAAAAAAAAAQARtcMBgEEBQBG1w0GBQQOAgx+gAIOfggCAH4JAgJ+CgIEfgsCBn44DyDwBAAAAAAAgb8AAAAAAAAAAAAAAABzbDAwbwAAAIkAAAAAAAAAVyUQAACmAQQQChALEAwQQEBCIEsQTBBNEE4Qb2B5EHoQhRAAAG4AAGQPICEQJEAlEAAAZCEQJEAAAFwoUCkQAABhoAGAAPqshAACShBDAFsQW100OAoAYAsQYGQwNWkVbQIICAFpAQ6QTv8DAFEKoICAQCCmi8rmDwAAAAAAAABiYXJlZm9vdChlFBwAAAAAAQAAADQAAAAAAAAAiQAAAMDrBSemhdL8AAAAAAAAAAD4XiZCAQAAADABAAAAAAAAMTIzNBgAAADYXyZCAQAAAADnJkIBAAAAAAAAAAAAAACIXyZCAQAAAFhfJkIBAAAAAAAAAAAAAAAAAAAAAAAAADABAAAAAQAAAAAAAA4AAAAAAAAAAAAAADAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAACEAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAGICAAAAAAAADAIAAOcmQgENAgAAAAAAACoCAADQAAAoKgIAAChlFBwSAgAAgQAsQBMCAACYCwAAKAIAAAAAAAAHAgAACAAAAAgCAAAIAAAACQIAAAEAAAAQYCZCAQAAAChgJkIBAAAAKGAmQgEAAAAoYCZCAQAAAChgJkIBAAAAAAAMAAsAAAAAAAAAAAAAAP//AAD///////////////////////8AAEAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCAAAAAgAAAABAAAAAAAAAAEBAQACAAAAAAACAAAAAAAAAADnJkIBAAAAAAEAAAAAAAAEAEbXDAYBBAUARtcNBgUEDgIMfoACDn4IAgB+CQICfgoCBH4LAgZ+OA8g8AQAAAAAAIG/AAAAAAAAAAAAAAAAc2wwMG8AAACJAAAAAAAAAFclEAAApgEEEAoQCxAMEEBAQiBLEEwQTRBOEG9geRB6EIUQAABuAABkDyAhECRAJRAAAGQhECRAAABcKFApEAAAYaABgAD6rIQAAkoQQwBbEFtdNDgKAGALEGBkMDVpFW0CCAgBaQEOkE7/AwBRCqCAgEAgpovK5g8AAAAAAAAAYmFyZWZvb3QoZRQcAAAAAAEAAAA0AAAAAAAAAIkAAADA6wUnpoXS/AAAAAAAAAAA+F4mQgEAAAAwAQAAAAAAADEyMzQYAAAA2F8mQgEAAAAA5yZCAQAAAAAAAAAAAAAAiF8mQgEAAABYXyZCAQAAAAAAAAAAAAAAAAAAAAAAAAAwAQAAAAEAAAAAAAAOAAAAAAAAAAAAAAAwAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAAAAMAAAAAAAAAAAAAAAAAAAAAABiAgAAAAAAAAwCAADnJkIBDQIAAAAAAAAqAgAA0AAAKCoCAAAoZRQcEgIAAIEALEATAgAAmAsAACgCAAAAAAAABwIAAAgAAAAIAgAACAAAAAkCAAABAAAAEGAmQgEAAAAoYCZCAQAAAChgJkIBAAAAKGAmQgEAAAAoYCZCAQAAAAAADAALAAAAAAAAAAAAAAD//wAA////////////////////////AAABwAAAAAEAAAAQQAAAAwEAIAAAAAEAAAAXAAAAAAAAAAEAAAADAAAACwAAABkAAAAdAAAAHwAAACAAAAAqAAAAMAAAADcAAAA4AAAAPQAAAD8AAABAAAAAQQAAAGARAAByEQAAlRMAALUUAAC7FAAAvRQAAOMUAAACFQAABgAAAAAAAAAbAAAAAAAAAFNQVl9FWFRfZGVzY3JpcHRvcl9pbmRleGluZyEAAAAAAAAAU1BWX0VYVF9mcmFnbWVudF9zaGFkZXJfaW50ZXJsb2NrHQAAAAAAAABTUFZfRVhUX3NoYWRlcl9zdGVuY2lsX2V4cG9ydBQAAAAAAAAAU1BWX0tIUl84Yml0X3N0b3JhZ2UWAAAAAAAAAFNQVl9LSFJfZmxvYXRfY29udHJvbHMfAAAAAAAAAFNQVl9LSFJfcGh5c2ljYWxfc3RvcmFnZV9idWZmZXIAAAQAAAAEAAAABAAAAAQAAACAAAAAASAAAAB8AAAAfAAAAHgAAAD4DwAAfAAAAHwAAAAAAAAAAAAAAAAAAACAAAAAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAABADQMA
[Shaders/ShaderRegistry.cpp:838 operator()] Shader 0x14226f700 could not be prepared after registration: shader 0x14226f700 stage 0: ShaderRecompiler::Recompile: SPIR-V module emission failed: storage image multisampling is unavailable on the target device
RecompileRequest:
NVNQQREAAAAAAPcmQgEAAAB4AAAAAAAAAAIAoL8AAEbXDgYBBAEARtcPBgUEgAwHvxQAhL/5GIR9gwCGhvkYhH2BjoaGDIIGv/kGBQKCBoaGgYBrhQyBBr8DAAHVgwg5AP1raogAAIC/foDqhQIHBgL5BgUCggaGhgMBCDQCAwo0BwCCv4QCBDSDAgI0hAAINP8EADbg////BQBx14gCAgQQAgx+gAPqvmoNCr8JAIS/agIOfggCAH4JAgJ+CgIEfgsCBn5qgWqBOA8g8AQAAAD1/4K/AACBvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAAAAAAAAAc2wwMHsAAACVAAAAAAAAAFclEAAApgEEEAoQCxAMEEBAQiBLEEwQTRBOEG9geRB6EIUQAABuAABkDyAhECRAJRAAAGQhECRAAABcKRAAAEFBCKAABEOPEGkeFk9yuWy+aHOKHwQAAkoQQwBnEGdpODgKAGwNEGxwODV1FXkCCAgBdQEOkE7/AwBPGKCCgEAgpovK5g8AAAAAAAAAAAAAAGJhcmVmb2908KOfvQAAAAABAAAACAEAAAAAAACVAAAA5/eDZaaF0vwAAAAAAAAAAEhnJkIBAAAAMAEAAAAAAAAxMjM0GAAAAChoJkIBAAAAAPcmQgEAAAAAAAAAAAAAANhnJkIBAAAAqGcmQgEAAAAAAAAAAAAAAAAAAAAAAAAAMAEAAOABAAAAAAAADgAAAAAAAAAAAAAAMAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAIQAAAAAADgAAAAAAAAAAAAAAAAAAAAAAYgIAAAAAAAAMAgAA9yZCAQ0CAAAAAAAAKgIAALABACgqAgAA8KOfvRICAACBACxAEwIAAJwLAAAoAgAAAAAAAAcCAAAIAAAACAIAAAgAAAAJAgAAAQAAAGBoJkIBAAAAeGgmQgEAAAB4aCZCAQAAAHhoJkIBAAAAeGgmQgEAAAAAAA4ACwAAAAAAAAAAAAAA//8AAP///////////////////////wAAQAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQgAAAAIAAAAAQAAAAAAAAABAQEAAgAAAAAAAgAAAAAAAAAA9yZCAQAAAOABAAAAAAAAAgCgvwAARtcOBgEEAQBG1w8GBQSADAe/FACEv/kYhH2DAIaG+RiEfYGOhoYMgga/+QYFAoIGhoaBgGuFDIEGvwMAAdWDCDkA/WtqiAAAgL9+gOqFAgcGAvkGBQKCBoaGAwEINAIDCjQHAIK/hAIENIMCAjSEAAg0/wQANuD///8FAHHXiAICBBACDH6AA+q+ag0KvwkAhL9qAg5+CAIAfgkCAn4KAgR+CwIGfmqBaoE4DyDwBAAAAPX/gr8AAIG/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AAAAAAAAAABzbDAwewAAAJUAAAAAAAAAVyUQAACmAQQQChALEAwQQEBCIEsQTBBNEE4Qb2B5EHoQhRAAAG4AAGQPICEQJEAlEAAAZCEQJEAAAFwpEAAAQUEIoAAEQ48QaR4WT3K5bL5oc4ofBAACShBDAGcQZ2k4OAoAbA0QbHA4NXUVeQIICAF1AQ6QTv8DAE8YoIKAQCCmi8rmDwAAAAAAAAAAAAAAYmFyZWZvb3Two5+9AAAAAAEAAAAIAQAAAAAAAJUAAADn94NlpoXS/AAAAAAAAAAASGcmQgEAAAAwAQAAAAAAADEyMzQYAAAAKGgmQgEAAAAA9yZCAQAAAAAAAAAAAAAA2GcmQgEAAACoZyZCAQAAAAAAAAAAAAAAAAAAAAAAAAAwAQAA4AEAAAAAAAAOAAAAAAAAAAAAAAAwAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAAAAOAAAAAAAAAAAAAAAAAAAAAABiAgAAAAAAAAwCAAD3JkIBDQIAAAAAAAAqAgAAsAEAKCoCAADwo5+9EgIAAIEALEATAgAAnAsAACgCAAAAAAAABwIAAAgAAAAIAgAACAAAAAkCAAABAAAAYGgmQgEAAAB4aCZCAQAAAHhoJkIBAAAAeGgmQgEAAAB4aCZCAQAAAAAADgALAAAAAAAAAAAAAAD//wAA////////////////////////AAABwAAAAAEAAAAQQAAAAwEAIAAAAAEAAAAXAAAAAAAAAAEAAAADAAAACwAAABkAAAAdAAAAHwAAACAAAAAqAAAAMAAAADcAAAA4AAAAPQAAAD8AAABAAAAAQQAAAGARAAByEQAAlRMAALUUAAC7FAAAvRQAAOMUAAACFQAABgAAAAAAAAAbAAAAAAAAAFNQVl9FWFRfZGVzY3JpcHRvcl9pbmRleGluZyEAAAAAAAAAU1BWX0VYVF9mcmFnbWVudF9zaGFkZXJfaW50ZXJsb2NrHQAAAAAAAABTUFZfRVhUX3NoYWRlcl9zdGVuY2lsX2V4cG9ydBQAAAAAAAAAU1BWX0tIUl84Yml0X3N0b3JhZ2UWAAAAAAAAAFNQVl9LSFJfZmxvYXRfY29udHJvbHMfAAAAAAAAAFNQVl9LSFJfcGh5c2ljYWxfc3RvcmFnZV9idWZmZXIAAAQAAAAEAAAABAAAAAQAAACAAAAAASAAAAB8AAAAfAAAAHgAAAD4DwAAfAAAAHwAAAAAAAAAAAAAAAAAAACAAAAAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAABADQMA
[Shaders/ShaderRegistry.cpp:838 operator()] Shader 0x14226ea00 could not be prepared after registration: shader 0x14226ea00 stage 0: ShaderRecompiler::Recompile: SPIR-V module emission failed: storage image multisampling is unavailable on the target device
RecompileRequest:
NVNQQREAAAAAAOomQgEAAABkAAAAAAAAAAIAoL8EAEbXDAYBBAUARtcNBgUEDgIMfoICDn4IAgB+CQICfgoCBH4LAgZ+gwIQfoQCEn6FAhR+hgIWfocCGH44DyDwBAAAADoPIPAEAAAABQYIADoPIPAEAAAABQYJADoPIPAEAAAABQYKADoPIPAEAAAABQYLADoPIPAEAAAABQYMAAAAgb8AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AAAAAAAAAABzbDAwcQAAAIsAAAAAAAAAVyUQAACmAQQQChALEAwQQEBCIEsQTBBNEE4Qb2B5EHoQhRAAAG4AAGQPICEQJEAlEAAAZCEQJEAAAFwoUCkQAACBQAbAAAjis16EAARKEEMAXRBdXzQ4CgBiCxBiZjA1axVvAggIAWsBDpBO/wMAUQyggIBAIKaLyuYPAAAAAABiYXJlZm9vdDfnPh0AAAAAAQAAAMgAAAAAAAAAiwAAAAwGu3OmhdL8AAAAAAAAAABYYSZCAQAAADABAAAAAAAAMTIzNBgAAAA4YiZCAQAAAADqJkIBAAAAAAAAAAAAAADoYSZCAQAAALhhJkIBAAAAAAAAAAAAAAAAAAAAAAAAADABAACQAQAAAAAAAA4AAAAAAAAAAAAAADAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAACEAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAGICAAAAAAAADAIAAOomQgENAgAAAAAAACoCAABgAQAoKgIAADfnPh0SAgAAgwAsQBMCAACYCwAAKAIAAAAAAAAHAgAACAAAAAgCAAAIAAAACQIAAAEAAABwYiZCAQAAAIhiJkIBAAAAiGImQgEAAACIYiZCAQAAAIhiJkIBAAAAAAAMAAsAAAAAAAAAAAAAAP//AAD///////////////////////8AAEAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCAAAAAgAAAABAAAAAAAAAAEBAQACAAAAAAACAAAAAAAAAADqJkIBAAAAkAEAAAAAAAACAKC/BABG1wwGAQQFAEbXDQYFBA4CDH6CAg5+CAIAfgkCAn4KAgR+CwIGfoMCEH6EAhJ+hQIUfoYCFn6HAhh+OA8g8AQAAAA6DyDwBAAAAAUGCAA6DyDwBAAAAAUGCQA6DyDwBAAAAAUGCgA6DyDwBAAAAAUGCwA6DyDwBAAAAAUGDAAAAIG/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAAAAAAAAAc2wwMHEAAACLAAAAAAAAAFclEAAApgEEEAoQCxAMEEBAQiBLEEwQTRBOEG9geRB6EIUQAABuAABkDyAhECRAJRAAAGQhECRAAABcKFApEAAAgUAGwAAI4rNehAAEShBDAF0QXV80OAoAYgsQYmYwNWsVbwIICAFrAQ6QTv8DAFEMoICAQCCmi8rmDwAAAAAAYmFyZWZvb3Q35z4dAAAAAAEAAADIAAAAAAAAAIsAAAAMBrtzpoXS/AAAAAAAAAAAWGEmQgEAAAAwAQAAAAAAADEyMzQYAAAAOGImQgEAAAAA6iZCAQAAAAAAAAAAAAAA6GEmQgEAAAC4YSZCAQAAAAAAAAAAAAAAAAAAAAAAAAAwAQAAkAEAAAAAAAAOAAAAAAAAAAAAAAAwAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAAAAMAAAAAAAAAAAAAAAAAAAAAABiAgAAAAAAAAwCAADqJkIBDQIAAAAAAAAqAgAAYAEAKCoCAAA35z4dEgIAAIMALEATAgAAmAsAACgCAAAAAAAABwIAAAgAAAAIAgAACAAAAAkCAAABAAAAcGImQgEAAACIYiZCAQAAAIhiJkIBAAAAiGImQgEAAACIYiZCAQAAAAAADAALAAAAAAAAAAAAAAD//wAA////////////////////////AAABwAAAAAEAAAAQQAAAAwEAIAAAAAEAAAAXAAAAAAAAAAEAAAADAAAACwAAABkAAAAdAAAAHwAAACAAAAAqAAAAMAAAADcAAAA4AAAAPQAAAD8AAABAAAAAQQAAAGARAAByEQAAlRMAALUUAAC7FAAAvRQAAOMUAAACFQAABgAAAAAAAAAbAAAAAAAAAFNQVl9FWFRfZGVzY3JpcHRvcl9pbmRleGluZyEAAAAAAAAAU1BWX0VYVF9mcmFnbWVudF9zaGFkZXJfaW50ZXJsb2NrHQAAAAAAAABTUFZfRVhUX3NoYWRlcl9zdGVuY2lsX2V4cG9ydBQAAAAAAAAAU1BWX0tIUl84Yml0X3N0b3JhZ2UWAAAAAAAAAFNQVl9LSFJfZmxvYXRfY29udHJvbHMfAAAAAAAAAFNQVl9LSFJfcGh5c2ljYWxfc3RvcmFnZV9idWZmZXIAAAQAAAAEAAAABAAAAAQAAACAAAAAASAAAAB8AAAAfAAAAHgAAAD4DwAAfAAAAHwAAAAAAAAAAAAAAAAAAACAAAAAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAABADQMA
[videoout] presentation failed: AGC graphics: subgroup capability 61 is unsupported for shader stage 1
libc++abi: terminating due to uncaught exception of type std::runtime_error: AGC graphics: subgroup capability 61 is unsupported for shader stage 1

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6150559870 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6150559870). Originally posted by [itar3](https://github.com/itar3) on 2026-10-13T16:46:33Z. --- ``` [src/VulkanDevice.cpp:885 VulkanDevice] VulkanDevice constructor window=0x347da2da8 [src/VulkanDevice.cpp:896 VulkanDevice] Vulkan loader loaded library=0x342d50 [src/VulkanDevice.cpp:912 VulkanDevice] Presentation window context=0x6000008801e0 extent=1920x1080 extensions=2 [src/VulkanDevice.cpp:935 VulkanDevice] Vulkan instance created instance=0x7f91c2849c00 [src/VulkanDevice.cpp:940 VulkanDevice] Vulkan surface created surface=0x6000019a0a80 window=0x6000008801e0 [src/VulkanDevice.cpp:946 VulkanDevice] Physical device count=1 [src/VulkanDevice.cpp:979 VulkanDevice] Physical device candidate=0x6000037e09a0 name=Apple M4 Pro api=0x401165 type=1 [src/VulkanDevice.cpp:1026 VulkanDevice] Physical device selected physical=0x6000037e09a0 queueFamily=0 [src/VulkanDevice.cpp:1039 VulkanDevice] Selected GPU name=Apple M4 Pro vendor=0x106b device=0x1b000209 subgroup=32 [src/VulkanDevice.cpp:1041 VulkanDevice] Memory heap 0 size=24576.0 MiB flags=0x1 [src/VulkanDevice.cpp:1042 VulkanDevice] Memory type 0 heap=0 flags=0x1 [src/VulkanDevice.cpp:1042 VulkanDevice] Memory type 1 heap=0 flags=0xf [src/VulkanDevice.cpp:1042 VulkanDevice] Memory type 2 heap=0 flags=0x11 [src/VulkanDevice.cpp:1360 VulkanDevice] Vulkan features tessellationAvailable=1 mesh=0 depthClip=1 depthRangeUnrestricted=0 pipelineLibrary=0 [src/VulkanDevice.cpp:1597 VulkanDevice] Vulkan device ready device=0x7f91c287c218 queue=0x7f91c1504ec8 family=0 [write-watch] host imports resolve write protection: no (0 of 4 scratch pages written after a GPU read, 0 after a GPU write, 0 after the import); imported ranges stay watched [src/VulkanDevice.cpp:1635 VulkanDevice] Surface capabilities drawable=2160x1216 min=1x1 max=16384x16384 minImages=2 maxImages=3 usage=0x1f [src/VulkanDevice.cpp:1679 VulkanDevice] Swapchain created swapchain=0x7f91c28b6000 extent=2160x1216 images=2 [src/Thread.cpp:413 RunThread] RunThread entry=0x140026640 arg=0x0 self=0x7f91c132eee0 [SAVEDATA:native] mount3 user=268435456 dir=SAVEDATA mode=0x1 blocks=48 -> 0x00000000 point=/savedata0 status=0 [SAVEDATA:native] umount2 mode=0x0 point=/savedata0 -> 0x00000000 [shader-disk-cache] /Users/Itt339/Downloads/5/shader_cache/ce44ca1d80d3af6e (source version ce44ca1d80d3af6e, format 27) [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c33042e0 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c1204810 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c15316e0 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c07474c0 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c1730a50 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c12049c0 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c0747670 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c1730f30 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3304610 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3104a10 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3206150 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3206300 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3104bc0 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3104d70 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3304930 [src/Thread.cpp:413 RunThread] RunThread entry=0x14b7afe30 arg=0x347afca38 self=0x7f91c3206620 [SAVEDATA:native] mount3 user=268435456 dir=SAVEDATA mode=0x20 blocks=48 -> 0x00000000 point=/savedata0 status=0 [SAVEDATA:native] mount3 user=268435456 dir=SAVEDATA mode=0x20 blocks=48 -> 0x809f0003 point= status=0 [Shaders/ShaderRegistry.cpp:838 operator()] Shader 0x14226e800 could not be prepared after registration: shader 0x14226e800 stage 0: ShaderRecompiler::Recompile: SPIR-V module emission failed: storage image multisampling is unavailable on the target device RecompileRequest: NVNQQREAAAAAAOgmQgEAAABEAAAAAAAAAAEAoL8EAEbXDAYBBAUARtcNBgUEDgIMfoICDn4IAgB+CQICfgoCBH4LAgZ+gwIQfjgPIPAEAAAAOg8g8AQAAAAFBggAAACBvwAAAAAAAAAAc2wwMHEAAACLAAAAAAAAAFclEAAApgEEEAoQCxAMEEBAQiBLEEwQTRBOEG9geRB6EIUQAABuAABkDyAhECRAJRAAAGQhECRAAABcKFApEAAAgUACoACEeNaLEIAAShBDAF0QXV80OAoAYgsQYmYwNWsVbwIICAFrAQ6QTv8DAFEMoICAQCCmi8rmDwAAAAAAYmFyZWZvb3RKIIyYAAAAAAEAAABIAAAAAAAAAIsAAAADu3HLpoXS/AAAAAAAAAAAKGAmQgEAAAAwAQAAAAAAADEyMzQYAAAACGEmQgEAAAAA6CZCAQAAAAAAAAAAAAAAuGAmQgEAAACIYCZCAQAAAAAAAAAAAAAAAAAAAAAAAAAwAQAAEAEAAAAAAAAOAAAAAAAAAAAAAAAwAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAAAAMAAAAAAAAAAAAAAAAAAAAAABiAgAAAAAAAAwCAADoJkIBDQIAAAAAAAAqAgAA4AAAKCoCAABKIIyYEgIAAIIALEATAgAAmAsAACgCAAAAAAAABwIAAAgAAAAIAgAACAAAAAkCAAABAAAAQGEmQgEAAABYYSZCAQAAAFhhJkIBAAAAWGEmQgEAAABYYSZCAQAAAAAADAALAAAAAAAAAAAAAAD//wAA////////////////////////AABAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQgAAAAIAAAAAQAAAAAAAAABAQEAAgAAAAAAAgAAAAAAAAAA6CZCAQAAABABAAAAAAAAAQCgvwQARtcMBgEEBQBG1w0GBQQOAgx+ggIOfggCAH4JAgJ+CgIEfgsCBn6DAhB+OA8g8AQAAAA6DyDwBAAAAAUGCAAAAIG/AAAAAAAAAABzbDAwcQAAAIsAAAAAAAAAVyUQAACmAQQQChALEAwQQEBCIEsQTBBNEE4Qb2B5EHoQhRAAAG4AAGQPICEQJEAlEAAAZCEQJEAAAFwoUCkQAACBQAKgAIR41osQgABKEEMAXRBdXzQ4CgBiCxBiZjA1axVvAggIAWsBDpBO/wMAUQyggIBAIKaLyuYPAAAAAABiYXJlZm9vdEogjJgAAAAAAQAAAEgAAAAAAAAAiwAAAAO7ccumhdL8AAAAAAAAAAAoYCZCAQAAADABAAAAAAAAMTIzNBgAAAAIYSZCAQAAAADoJkIBAAAAAAAAAAAAAAC4YCZCAQAAAIhgJkIBAAAAAAAAAAAAAAAAAAAAAAAAADABAAAQAQAAAAAAAA4AAAAAAAAAAAAAADAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAACEAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAGICAAAAAAAADAIAAOgmQgENAgAAAAAAACoCAADgAAAoKgIAAEogjJgSAgAAggAsQBMCAACYCwAAKAIAAAAAAAAHAgAACAAAAAgCAAAIAAAACQIAAAEAAABAYSZCAQAAAFhhJkIBAAAAWGEmQgEAAABYYSZCAQAAAFhhJkIBAAAAAAAMAAsAAAAAAAAAAAAAAP//AAD///////////////////////8AAAHAAAAAAQAAABBAAAADAQAgAAAAAQAAABcAAAAAAAAAAQAAAAMAAAALAAAAGQAAAB0AAAAfAAAAIAAAACoAAAAwAAAANwAAADgAAAA9AAAAPwAAAEAAAABBAAAAYBEAAHIRAACVEwAAtRQAALsUAAC9FAAA4xQAAAIVAAAGAAAAAAAAABsAAAAAAAAAU1BWX0VYVF9kZXNjcmlwdG9yX2luZGV4aW5nIQAAAAAAAABTUFZfRVhUX2ZyYWdtZW50X3NoYWRlcl9pbnRlcmxvY2sdAAAAAAAAAFNQVl9FWFRfc2hhZGVyX3N0ZW5jaWxfZXhwb3J0FAAAAAAAAABTUFZfS0hSXzhiaXRfc3RvcmFnZRYAAAAAAAAAU1BWX0tIUl9mbG9hdF9jb250cm9scx8AAAAAAAAAU1BWX0tIUl9waHlzaWNhbF9zdG9yYWdlX2J1ZmZlcgAABAAAAAQAAAAEAAAABAAAAIAAAAABIAAAAHwAAAB8AAAAeAAAAPgPAAB8AAAAfAAAAAAAAAAAAAAAAAAAAIAAAAAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAEANAwA= [Shaders/ShaderRegistry.cpp:838 operator()] Shader 0x14226e700 could not be prepared after registration: shader 0x14226e700 stage 0: ShaderRecompiler::Recompile: SPIR-V module emission failed: storage image multisampling is unavailable on the target device RecompileRequest: NVNQQREAAAAAAOcmQgEAAABAAAAAAAAAAAQARtcMBgEEBQBG1w0GBQQOAgx+gAIOfggCAH4JAgJ+CgIEfgsCBn44DyDwBAAAAAAAgb8AAAAAAAAAAAAAAABzbDAwbwAAAIkAAAAAAAAAVyUQAACmAQQQChALEAwQQEBCIEsQTBBNEE4Qb2B5EHoQhRAAAG4AAGQPICEQJEAlEAAAZCEQJEAAAFwoUCkQAABhoAGAAPqshAACShBDAFsQW100OAoAYAsQYGQwNWkVbQIICAFpAQ6QTv8DAFEKoICAQCCmi8rmDwAAAAAAAABiYXJlZm9vdChlFBwAAAAAAQAAADQAAAAAAAAAiQAAAMDrBSemhdL8AAAAAAAAAAD4XiZCAQAAADABAAAAAAAAMTIzNBgAAADYXyZCAQAAAADnJkIBAAAAAAAAAAAAAACIXyZCAQAAAFhfJkIBAAAAAAAAAAAAAAAAAAAAAAAAADABAAAAAQAAAAAAAA4AAAAAAAAAAAAAADAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAACEAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAGICAAAAAAAADAIAAOcmQgENAgAAAAAAACoCAADQAAAoKgIAAChlFBwSAgAAgQAsQBMCAACYCwAAKAIAAAAAAAAHAgAACAAAAAgCAAAIAAAACQIAAAEAAAAQYCZCAQAAAChgJkIBAAAAKGAmQgEAAAAoYCZCAQAAAChgJkIBAAAAAAAMAAsAAAAAAAAAAAAAAP//AAD///////////////////////8AAEAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCAAAAAgAAAABAAAAAAAAAAEBAQACAAAAAAACAAAAAAAAAADnJkIBAAAAAAEAAAAAAAAEAEbXDAYBBAUARtcNBgUEDgIMfoACDn4IAgB+CQICfgoCBH4LAgZ+OA8g8AQAAAAAAIG/AAAAAAAAAAAAAAAAc2wwMG8AAACJAAAAAAAAAFclEAAApgEEEAoQCxAMEEBAQiBLEEwQTRBOEG9geRB6EIUQAABuAABkDyAhECRAJRAAAGQhECRAAABcKFApEAAAYaABgAD6rIQAAkoQQwBbEFtdNDgKAGALEGBkMDVpFW0CCAgBaQEOkE7/AwBRCqCAgEAgpovK5g8AAAAAAAAAYmFyZWZvb3QoZRQcAAAAAAEAAAA0AAAAAAAAAIkAAADA6wUnpoXS/AAAAAAAAAAA+F4mQgEAAAAwAQAAAAAAADEyMzQYAAAA2F8mQgEAAAAA5yZCAQAAAAAAAAAAAAAAiF8mQgEAAABYXyZCAQAAAAAAAAAAAAAAAAAAAAAAAAAwAQAAAAEAAAAAAAAOAAAAAAAAAAAAAAAwAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAAAAMAAAAAAAAAAAAAAAAAAAAAABiAgAAAAAAAAwCAADnJkIBDQIAAAAAAAAqAgAA0AAAKCoCAAAoZRQcEgIAAIEALEATAgAAmAsAACgCAAAAAAAABwIAAAgAAAAIAgAACAAAAAkCAAABAAAAEGAmQgEAAAAoYCZCAQAAAChgJkIBAAAAKGAmQgEAAAAoYCZCAQAAAAAADAALAAAAAAAAAAAAAAD//wAA////////////////////////AAABwAAAAAEAAAAQQAAAAwEAIAAAAAEAAAAXAAAAAAAAAAEAAAADAAAACwAAABkAAAAdAAAAHwAAACAAAAAqAAAAMAAAADcAAAA4AAAAPQAAAD8AAABAAAAAQQAAAGARAAByEQAAlRMAALUUAAC7FAAAvRQAAOMUAAACFQAABgAAAAAAAAAbAAAAAAAAAFNQVl9FWFRfZGVzY3JpcHRvcl9pbmRleGluZyEAAAAAAAAAU1BWX0VYVF9mcmFnbWVudF9zaGFkZXJfaW50ZXJsb2NrHQAAAAAAAABTUFZfRVhUX3NoYWRlcl9zdGVuY2lsX2V4cG9ydBQAAAAAAAAAU1BWX0tIUl84Yml0X3N0b3JhZ2UWAAAAAAAAAFNQVl9LSFJfZmxvYXRfY29udHJvbHMfAAAAAAAAAFNQVl9LSFJfcGh5c2ljYWxfc3RvcmFnZV9idWZmZXIAAAQAAAAEAAAABAAAAAQAAACAAAAAASAAAAB8AAAAfAAAAHgAAAD4DwAAfAAAAHwAAAAAAAAAAAAAAAAAAACAAAAAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAABADQMA [Shaders/ShaderRegistry.cpp:838 operator()] Shader 0x14226f700 could not be prepared after registration: shader 0x14226f700 stage 0: ShaderRecompiler::Recompile: SPIR-V module emission failed: storage image multisampling is unavailable on the target device RecompileRequest: NVNQQREAAAAAAPcmQgEAAAB4AAAAAAAAAAIAoL8AAEbXDgYBBAEARtcPBgUEgAwHvxQAhL/5GIR9gwCGhvkYhH2BjoaGDIIGv/kGBQKCBoaGgYBrhQyBBr8DAAHVgwg5AP1raogAAIC/foDqhQIHBgL5BgUCggaGhgMBCDQCAwo0BwCCv4QCBDSDAgI0hAAINP8EADbg////BQBx14gCAgQQAgx+gAPqvmoNCr8JAIS/agIOfggCAH4JAgJ+CgIEfgsCBn5qgWqBOA8g8AQAAAD1/4K/AACBvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAAAAAAAAAc2wwMHsAAACVAAAAAAAAAFclEAAApgEEEAoQCxAMEEBAQiBLEEwQTRBOEG9geRB6EIUQAABuAABkDyAhECRAJRAAAGQhECRAAABcKRAAAEFBCKAABEOPEGkeFk9yuWy+aHOKHwQAAkoQQwBnEGdpODgKAGwNEGxwODV1FXkCCAgBdQEOkE7/AwBPGKCCgEAgpovK5g8AAAAAAAAAAAAAAGJhcmVmb2908KOfvQAAAAABAAAACAEAAAAAAACVAAAA5/eDZaaF0vwAAAAAAAAAAEhnJkIBAAAAMAEAAAAAAAAxMjM0GAAAAChoJkIBAAAAAPcmQgEAAAAAAAAAAAAAANhnJkIBAAAAqGcmQgEAAAAAAAAAAAAAAAAAAAAAAAAAMAEAAOABAAAAAAAADgAAAAAAAAAAAAAAMAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAIQAAAAAADgAAAAAAAAAAAAAAAAAAAAAAYgIAAAAAAAAMAgAA9yZCAQ0CAAAAAAAAKgIAALABACgqAgAA8KOfvRICAACBACxAEwIAAJwLAAAoAgAAAAAAAAcCAAAIAAAACAIAAAgAAAAJAgAAAQAAAGBoJkIBAAAAeGgmQgEAAAB4aCZCAQAAAHhoJkIBAAAAeGgmQgEAAAAAAA4ACwAAAAAAAAAAAAAA//8AAP///////////////////////wAAQAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQgAAAAIAAAAAQAAAAAAAAABAQEAAgAAAAAAAgAAAAAAAAAA9yZCAQAAAOABAAAAAAAAAgCgvwAARtcOBgEEAQBG1w8GBQSADAe/FACEv/kYhH2DAIaG+RiEfYGOhoYMgga/+QYFAoIGhoaBgGuFDIEGvwMAAdWDCDkA/WtqiAAAgL9+gOqFAgcGAvkGBQKCBoaGAwEINAIDCjQHAIK/hAIENIMCAjSEAAg0/wQANuD///8FAHHXiAICBBACDH6AA+q+ag0KvwkAhL9qAg5+CAIAfgkCAn4KAgR+CwIGfmqBaoE4DyDwBAAAAPX/gr8AAIG/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AAAAAAAAAABzbDAwewAAAJUAAAAAAAAAVyUQAACmAQQQChALEAwQQEBCIEsQTBBNEE4Qb2B5EHoQhRAAAG4AAGQPICEQJEAlEAAAZCEQJEAAAFwpEAAAQUEIoAAEQ48QaR4WT3K5bL5oc4ofBAACShBDAGcQZ2k4OAoAbA0QbHA4NXUVeQIICAF1AQ6QTv8DAE8YoIKAQCCmi8rmDwAAAAAAAAAAAAAAYmFyZWZvb3Two5+9AAAAAAEAAAAIAQAAAAAAAJUAAADn94NlpoXS/AAAAAAAAAAASGcmQgEAAAAwAQAAAAAAADEyMzQYAAAAKGgmQgEAAAAA9yZCAQAAAAAAAAAAAAAA2GcmQgEAAACoZyZCAQAAAAAAAAAAAAAAAAAAAAAAAAAwAQAA4AEAAAAAAAAOAAAAAAAAAAAAAAAwAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAAAAOAAAAAAAAAAAAAAAAAAAAAABiAgAAAAAAAAwCAAD3JkIBDQIAAAAAAAAqAgAAsAEAKCoCAADwo5+9EgIAAIEALEATAgAAnAsAACgCAAAAAAAABwIAAAgAAAAIAgAACAAAAAkCAAABAAAAYGgmQgEAAAB4aCZCAQAAAHhoJkIBAAAAeGgmQgEAAAB4aCZCAQAAAAAADgALAAAAAAAAAAAAAAD//wAA////////////////////////AAABwAAAAAEAAAAQQAAAAwEAIAAAAAEAAAAXAAAAAAAAAAEAAAADAAAACwAAABkAAAAdAAAAHwAAACAAAAAqAAAAMAAAADcAAAA4AAAAPQAAAD8AAABAAAAAQQAAAGARAAByEQAAlRMAALUUAAC7FAAAvRQAAOMUAAACFQAABgAAAAAAAAAbAAAAAAAAAFNQVl9FWFRfZGVzY3JpcHRvcl9pbmRleGluZyEAAAAAAAAAU1BWX0VYVF9mcmFnbWVudF9zaGFkZXJfaW50ZXJsb2NrHQAAAAAAAABTUFZfRVhUX3NoYWRlcl9zdGVuY2lsX2V4cG9ydBQAAAAAAAAAU1BWX0tIUl84Yml0X3N0b3JhZ2UWAAAAAAAAAFNQVl9LSFJfZmxvYXRfY29udHJvbHMfAAAAAAAAAFNQVl9LSFJfcGh5c2ljYWxfc3RvcmFnZV9idWZmZXIAAAQAAAAEAAAABAAAAAQAAACAAAAAASAAAAB8AAAAfAAAAHgAAAD4DwAAfAAAAHwAAAAAAAAAAAAAAAAAAACAAAAAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAABADQMA [Shaders/ShaderRegistry.cpp:838 operator()] Shader 0x14226ea00 could not be prepared after registration: shader 0x14226ea00 stage 0: ShaderRecompiler::Recompile: SPIR-V module emission failed: storage image multisampling is unavailable on the target device RecompileRequest: NVNQQREAAAAAAOomQgEAAABkAAAAAAAAAAIAoL8EAEbXDAYBBAUARtcNBgUEDgIMfoICDn4IAgB+CQICfgoCBH4LAgZ+gwIQfoQCEn6FAhR+hgIWfocCGH44DyDwBAAAADoPIPAEAAAABQYIADoPIPAEAAAABQYJADoPIPAEAAAABQYKADoPIPAEAAAABQYLADoPIPAEAAAABQYMAAAAgb8AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AAAAAAAAAABzbDAwcQAAAIsAAAAAAAAAVyUQAACmAQQQChALEAwQQEBCIEsQTBBNEE4Qb2B5EHoQhRAAAG4AAGQPICEQJEAlEAAAZCEQJEAAAFwoUCkQAACBQAbAAAjis16EAARKEEMAXRBdXzQ4CgBiCxBiZjA1axVvAggIAWsBDpBO/wMAUQyggIBAIKaLyuYPAAAAAABiYXJlZm9vdDfnPh0AAAAAAQAAAMgAAAAAAAAAiwAAAAwGu3OmhdL8AAAAAAAAAABYYSZCAQAAADABAAAAAAAAMTIzNBgAAAA4YiZCAQAAAADqJkIBAAAAAAAAAAAAAADoYSZCAQAAALhhJkIBAAAAAAAAAAAAAAAAAAAAAAAAADABAACQAQAAAAAAAA4AAAAAAAAAAAAAADAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAACEAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAGICAAAAAAAADAIAAOomQgENAgAAAAAAACoCAABgAQAoKgIAADfnPh0SAgAAgwAsQBMCAACYCwAAKAIAAAAAAAAHAgAACAAAAAgCAAAIAAAACQIAAAEAAABwYiZCAQAAAIhiJkIBAAAAiGImQgEAAACIYiZCAQAAAIhiJkIBAAAAAAAMAAsAAAAAAAAAAAAAAP//AAD///////////////////////8AAEAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCAAAAAgAAAABAAAAAAAAAAEBAQACAAAAAAACAAAAAAAAAADqJkIBAAAAkAEAAAAAAAACAKC/BABG1wwGAQQFAEbXDQYFBA4CDH6CAg5+CAIAfgkCAn4KAgR+CwIGfoMCEH6EAhJ+hQIUfoYCFn6HAhh+OA8g8AQAAAA6DyDwBAAAAAUGCAA6DyDwBAAAAAUGCQA6DyDwBAAAAAUGCgA6DyDwBAAAAAUGCwA6DyDwBAAAAAUGDAAAAIG/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAn78AAJ+/AACfvwAAAAAAAAAAc2wwMHEAAACLAAAAAAAAAFclEAAApgEEEAoQCxAMEEBAQiBLEEwQTRBOEG9geRB6EIUQAABuAABkDyAhECRAJRAAAGQhECRAAABcKFApEAAAgUAGwAAI4rNehAAEShBDAF0QXV80OAoAYgsQYmYwNWsVbwIICAFrAQ6QTv8DAFEMoICAQCCmi8rmDwAAAAAAYmFyZWZvb3Q35z4dAAAAAAEAAADIAAAAAAAAAIsAAAAMBrtzpoXS/AAAAAAAAAAAWGEmQgEAAAAwAQAAAAAAADEyMzQYAAAAOGImQgEAAAAA6iZCAQAAAAAAAAAAAAAA6GEmQgEAAAC4YSZCAQAAAAAAAAAAAAAAAAAAAAAAAAAwAQAAkAEAAAAAAAAOAAAAAAAAAAAAAAAwAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAhAAAAAAAMAAAAAAAAAAAAAAAAAAAAAABiAgAAAAAAAAwCAADqJkIBDQIAAAAAAAAqAgAAYAEAKCoCAAA35z4dEgIAAIMALEATAgAAmAsAACgCAAAAAAAABwIAAAgAAAAIAgAACAAAAAkCAAABAAAAcGImQgEAAACIYiZCAQAAAIhiJkIBAAAAiGImQgEAAACIYiZCAQAAAAAADAALAAAAAAAAAAAAAAD//wAA////////////////////////AAABwAAAAAEAAAAQQAAAAwEAIAAAAAEAAAAXAAAAAAAAAAEAAAADAAAACwAAABkAAAAdAAAAHwAAACAAAAAqAAAAMAAAADcAAAA4AAAAPQAAAD8AAABAAAAAQQAAAGARAAByEQAAlRMAALUUAAC7FAAAvRQAAOMUAAACFQAABgAAAAAAAAAbAAAAAAAAAFNQVl9FWFRfZGVzY3JpcHRvcl9pbmRleGluZyEAAAAAAAAAU1BWX0VYVF9mcmFnbWVudF9zaGFkZXJfaW50ZXJsb2NrHQAAAAAAAABTUFZfRVhUX3NoYWRlcl9zdGVuY2lsX2V4cG9ydBQAAAAAAAAAU1BWX0tIUl84Yml0X3N0b3JhZ2UWAAAAAAAAAFNQVl9LSFJfZmxvYXRfY29udHJvbHMfAAAAAAAAAFNQVl9LSFJfcGh5c2ljYWxfc3RvcmFnZV9idWZmZXIAAAQAAAAEAAAABAAAAAQAAACAAAAAASAAAAB8AAAAfAAAAHgAAAD4DwAAfAAAAHwAAAAAAAAAAAAAAAAAAACAAAAAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAABADQMA [videoout] presentation failed: AGC graphics: subgroup capability 61 is unsupported for shader stage 1 libc++abi: terminating due to uncaught exception of type std::runtime_error: AGC graphics: subgroup capability 61 is unsupported for shader stage 1 ``` 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
Bruggi-ch commented 2026-10-13 19:00:21 +00:00 (Migrated from github.com)
Author
Contributor

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

  • Apple M5, macOS 27.0.1, Apple clang 21.0.0, CMake 4.4.4, Ninja
  • macos-port at b7eb6b6b (the same commit @Zheorgyan used), x86-64 under Rosetta
  • LunarG Vulkan SDK 1.4.363.0 (MoltenVK), DYLD_LIBRARY_PATH and VK_DRIVER_FILES exported before ctest
  • Full build: 3054 steps, 0 errors; ninja libs: no work left

Tests

  • Without GPU: ctest -E 'agc|flip|display|vulkan|gpu': 495 of 495 passed, 5 skipped, 51 s
  • GPU: ctest -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_ancillary fails on the M5: SPIR-V requires unsupported device capability 2
  • agc_driver_prepared_shaders_registered_workgroup_sync passes 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_info still says subgroup capability 61 is unsupported for shader stage 1, pixel_interlock still 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-port in ImportWatched and GuestBufferMemory.cpp (the branch has importsStampPages), and I did not want to hand-port it. Instead I ran the same suite with APS5_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, plus unchanged_cpu_stamps (expected, the watch is off). That matches the M1 Pro result.
Two side effects with the watch off: depth_compare_copy now fails with the guest block is not write-watched, and pixel_fixed_point_position, which passes normally, fails with AGC graphics: cannot allocate the color target.

The Mac stayed stable through all runs. Logs are available if useful.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152955916 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6152955916). Originally posted by [Bruggi-ch](https://github.com/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** - Apple M5, macOS 27.0.1, Apple clang 21.0.0, CMake 4.4.4, Ninja - `macos-port` at `b7eb6b6b` (the same commit @Zheorgyan used), x86-64 under Rosetta - LunarG Vulkan SDK 1.4.363.0 (MoltenVK), `DYLD_LIBRARY_PATH` and `VK_DRIVER_FILES` exported before `ctest` - Full build: 3054 steps, 0 errors; `ninja libs`: no work left **Tests** - Without GPU: `ctest -E 'agc|flip|display|vulkan|gpu'`: 495 of 495 passed, 5 skipped, 51 s - GPU: `ctest -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_ancillary` fails on the M5: `SPIR-V requires unsupported device capability 2` - `agc_driver_prepared_shaders_registered_workgroup_sync` passes 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_info` still says `subgroup capability 61 is unsupported for shader stage 1`, `pixel_interlock` still 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-port` in `ImportWatched` and `GuestBufferMemory.cpp` (the branch has `importsStampPages`), and I did not want to hand-port it. Instead I ran the same suite with `APS5_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`, plus `unchanged_cpu_stamps` (expected, the watch is off). That matches the M1 Pro result. Two side effects with the watch off: `depth_compare_copy` now fails with `the guest block is not write-watched`, and `pixel_fixed_point_position`, which passes normally, fails with `AGC graphics: cannot allocate the color target`. The Mac stayed stable through all runs. Logs are available if useful. AI-assisted: yes (Claude Code)
Zheorgyan commented 2026-10-13 20:20:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-13T20:20:13Z.


@Bruggi-ch for macos-port at b7eb6b6b the change is only this, in ImportWatched in GuestMemory.cpp, it applies without conflicts:

    const bool before = covered && walkWrites(tracker, first, stop, StampKind::Cpu, true);
    bool imported = false;
    {
#ifdef __APPLE__
        const GuestArena::HostWrite open(reinterpret_cast<void*>(first), static_cast<std::size_t>(stop - first));
#endif
        imported = import();
    }
    if (!imported) return false;

on the M1 Pro it takes the same 10 off, dcc_keys_first_write stays because that branch has no import window compare yet

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6154411391 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6154411391). Originally posted by [Zheorgyan](https://github.com/Zheorgyan) on 2026-10-13T20:20:13Z. --- @Bruggi-ch for `macos-port` at `b7eb6b6b` the change is only this, in `ImportWatched` in `GuestMemory.cpp`, it applies without conflicts: ```cpp const bool before = covered && walkWrites(tracker, first, stop, StampKind::Cpu, true); bool imported = false; { #ifdef __APPLE__ const GuestArena::HostWrite open(reinterpret_cast<void*>(first), static_cast<std::size_t>(stop - first)); #endif imported = import(); } if (!imported) return false; ``` on the M1 Pro it takes the same 10 off, `dcc_keys_first_write` stays because that branch has no import window compare yet
yripper commented 2026-10-14 01:25:20 +00:00 (Migrated from github.com)
Author
Contributor

Imported 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:

  • Guest arena on macOS: reserving the guest address-space arena, with the holes recorded as debt. Your direct-memory branch assumes there is no arena, so I'd like to agree on an order before I open anything.
  • JIT shared memory under Rosetta: Rosetta can't execute code mapped from shm_open (bus error), so the JIT backing is an unlinked mkostemp file.
  • kqueue file watching: an EVFILT_VNODE backend for the file-event code that uses inotify on Linux.
  • Write-watch protection in the AGC page query: with mprotect-based watching, mach_vm_region reports watched pages as read-only, so the driver refused writable guest memory. It now asks the write watch for the logical protection.
  • MoltenVK portability: I check that VK_KHR_portability_enumeration is present before enabling it, which may be worth adding to your MoltenVK device branch.
  • Two MoltenVK performance items:
    • SPIR-V to MSL emits every NoContraction op as a call to a [[clang::optnone]] helper (spvFAdd/spvFMul). Dropping NoContraction in pixel programs on VK_DRIVER_ID_MOLTENVK took the title screen's GPU time from 35.8 to 14.5 ms a frame.
    • Pipeline creation on MoltenVK takes 100–860 ms, and I build missing pipelines in the background as an opt-in. I'll open a separate issue for that one.

Happy to rebase these onto your PRs and mark them Depends on:. How would you like them split?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6158795845 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6158795845). Originally posted by [yripper](https://github.com/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: - **Guest arena on macOS**: reserving the guest address-space arena, with the holes recorded as debt. Your direct-memory branch assumes there is no arena, so I'd like to agree on an order before I open anything. - **JIT shared memory under Rosetta**: Rosetta can't execute code mapped from `shm_open` (bus error), so the JIT backing is an unlinked `mkostemp` file. - **kqueue file watching**: an `EVFILT_VNODE` backend for the file-event code that uses inotify on Linux. - **Write-watch protection in the AGC page query**: with mprotect-based watching, `mach_vm_region` reports watched pages as read-only, so the driver refused writable guest memory. It now asks the write watch for the logical protection. - **MoltenVK portability**: I check that `VK_KHR_portability_enumeration` is present before enabling it, which may be worth adding to your MoltenVK device branch. - **Two MoltenVK performance items**: - SPIR-V to MSL emits every `NoContraction` op as a call to a `[[clang::optnone]]` helper (`spvFAdd`/`spvFMul`). Dropping `NoContraction` in pixel programs on `VK_DRIVER_ID_MOLTENVK` took the title screen's GPU time from 35.8 to 14.5 ms a frame. - Pipeline creation on MoltenVK takes 100–860 ms, and I build missing pipelines in the background as an opt-in. I'll open a separate issue for that one. Happy to rebase these onto your PRs and mark them `Depends on:`. How would you like them split?
Bruggi-ch commented 2026-10-14 03:37:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Bruggi-ch on 2026-10-14T03:37:44Z.


@Zheorgyan thanks, that applies cleanly on macos-port at b7eb6b6b and 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_flag already 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, so pixel_fixed_point_position still passes and depth_compare_copy is fixed.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6160326618 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6160326618). Originally posted by [Bruggi-ch](https://github.com/Bruggi-ch) on 2026-10-14T03:37:44Z. --- @Zheorgyan thanks, that applies cleanly on `macos-port` at `b7eb6b6b` and 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_flag` already 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, so `pixel_fixed_point_position` still passes and `depth_compare_copy` is fixed. AI-assisted: yes (Claude Code)
krishalivaibhav commented 2026-10-14 05:14:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-14T05:14:29Z.


Follow-up to the MoltenVK NoContraction performance 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) and MTLCompileOptions.fastMathEnabled = NO for both:

#pragma clang fp contract(off)
[[clang::optnone]] float oldadd(float a, float b) { return a + b; }
[[clang::optnone]] float oldmul(float a, float b) { return a * b; }
float newadd(float a, float b) { return a + b; }
float newmul(float a, float b) { return a * b; }
  1. Compile both kernels in the same Metal library, with shared input and distinct output buffers. Compare add, multiply, nested separately rounded MAD, and explicit fma outputs as raw bits.
  2. Across 65,536 deterministic input vectors (seed 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.
  3. The contraction-sensitive control uses a=b=1+2^-23, c=-(1+2^-22): both MAD outputs are zero; explicit FMA remains 0x28800000 (2^-46) in both kernels. Thus this sample did not silently turn MAD into FMA.
  4. Separate matched-workload timing: 65,536 lanes, each computing 64 dependent multiply/add iterations and storing the result. Use ordinary finite inputs (a bits 0x3f000000 + (rng & 0x007fffff), b bits 0x3f7ff000 + (rng & 0xfff), c bits 0x35800000 + (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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6161436057 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6161436057). Originally posted by [krishalivaibhav](https://github.com/krishalivaibhav) on 2026-10-14T05:14:29Z. --- Follow-up to the MoltenVK `NoContraction` performance 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)` and `MTLCompileOptions.fastMathEnabled = NO` for both**: ```metal #pragma clang fp contract(off) [[clang::optnone]] float oldadd(float a, float b) { return a + b; } [[clang::optnone]] float oldmul(float a, float b) { return a * b; } float newadd(float a, float b) { return a + b; } float newmul(float a, float b) { return a * b; } ``` 1. Compile both kernels in the same Metal library, with shared input and distinct output buffers. Compare add, multiply, nested separately rounded MAD, and explicit `fma` outputs as raw bits. 2. Across 65,536 deterministic input vectors (seed `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. 3. The contraction-sensitive control uses `a=b=1+2^-23`, `c=-(1+2^-22)`: both MAD outputs are zero; explicit FMA remains `0x28800000` (2^-46) in both kernels. Thus this sample did not silently turn MAD into FMA. 4. Separate matched-workload timing: 65,536 lanes, each computing 64 dependent multiply/add iterations and storing the result. Use ordinary finite inputs (`a` bits `0x3f000000 + (rng & 0x007fffff)`, `b` bits `0x3f7ff000 + (rng & 0xfff)`, `c` bits `0x35800000 + (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.
mugurc commented 2026-10-14 08:34:23 +00:00 (Migrated from github.com)
Author
Contributor

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_enumeration check and the write-watch protection query are welcome as separate small PRs, each with Depends on:.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6164296403 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6164296403). Originally posted by [mugurc](https://github.com/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_enumeration` check and the write-watch protection query are welcome as separate small PRs, each with `Depends on:`.
mugurc commented 2026-10-14 08:38:00 +00:00 (Migrated from github.com)
Author
Contributor

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 in AllocateHostStack. @thuanquang found on #4628 that the macOS SDK has no MAP_STACK, so libSceFiber/Export.cpp stopped compiling on macOS after #4265.

Status of the series: #4626 and #4628 are merged; #4627, #4629, #4630 and #5735 are open.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6164358151 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6164358151). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-14T08:38:00Z. --- Opened #5735, `fix(libSceFiber): map fiber host stacks on hosts without MAP_STACK`: a five-line fix in `AllocateHostStack`. @thuanquang found on #4628 that the macOS SDK has no `MAP_STACK`, so `libSceFiber/Export.cpp` stopped compiling on macOS after #4265. Status of the series: #4626 and #4628 are merged; #4627, #4629, #4630 and #5735 are open.
OleksandrS23 commented 2026-10-14 09:04:40 +00:00 (Migrated from github.com)
Author
Contributor

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 (native EVFILT_VNODE + EVFILT_USER stop, under __APPLE__). I'll test it with guest_kqueue on an M4 Pro, macOS 27.0.1, x86-64 under Rosetta. AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6164816461 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6164816461). Originally posted by [OleksandrS23](https://github.com/OleksandrS23) on 2026-10-14T09:04:40Z. --- I'd like to take the kqueue backend for `FileEvent.cpp` (native `EVFILT_VNODE` + `EVFILT_USER` stop, under `__APPLE__`). I'll test it with `guest_kqueue` on an M4 Pro, macOS 27.0.1, x86-64 under Rosetta. AI-assisted (Claude Code).
Zheorgyan commented 2026-10-14 10:42:30 +00:00 (Migrated from github.com)
Author
Contributor

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 that

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6166524066 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6166524066). Originally posted by [Zheorgyan](https://github.com/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 that
Cipriamn commented 2026-10-14 12:16:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported 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

  • Apple M3 Max, macOS 26.2 (25C56), Apple clang 21.0.0, CMake 4.4.4, Ninja 1.13.2
  • macos-port at b7eb6b6b, x86-64 under Rosetta
  • LunarG Vulkan SDK 1.4.363.0 (MoltenVK 1.4.2), DYLD_LIBRARY_PATH and VK_DRIVER_FILES exported before ctest. x86-64 vulkaninfo reports Apple M3 Max, API 1.4.357.
  • Full build: 3054/3054 steps, 0 errors; 124 .prx, each Mach-O 64-bit x86_64

Tests without GPU (ctest -E 'agc|flip|display|vulkan|gpu' -j8): 495 selected, 490 pass, 5 skip. patched_libraries timed 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 three guest_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_ancillary fails as on the M5 (SPIR-V requires unsupported device capability 2), and prepared_shaders_registered_workgroup_sync passes as on the M5.

With @Zheorgyan's ImportWatched change applied locally: 22 → 13, the same 13 as on the M5 and M1 Pro:

  • Device capabilities:
    • ngg_vertex_wave_info: subgroup capability 61 is unsupported for shader stage 1
    • pixel_interlock: MoltenVK MSL compile error, type 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'
    • relative_ancillary: capability 2
    • f32_dot2_rounding: needs Float64
  • Float group: f32_constant_factor_tininess, f32_denormal_flush, f32_output_modifier, float16_fma_rounding, float16_rounding, dpp16_operands, packed_alu, sdwa_float_selectors
  • dcc_keys_first_write, as expected, since the branch has no import-window compare yet

Skip reasons: no shaderBufferInt64Atomics, no shaderFloat64, no graphics pipeline libraries.

guest_video_out_*: with a Vulkan loader present, guest_video_out_wqhd_detection, guest_video_out_resolution_status and guest_video_out_output_mode skip with DisplayWindow: NSWindow should only be instantiated on the main thread!, as @011010 reported on the M4. Without the loader they skip earlier, at Failed to load Vulkan Portability library.

@mugurc I'd like to take the fix @011010 described: run those three tests inside Aps5StartGuest_nid_no_patch, as libSceVideoOut/tests/Flip.cpp does. Do you want it as a commit for macos-port, or as a PR to main after the main-thread runtime is in?

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6168127847 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6168127847). Originally posted by [Cipriamn](https://github.com/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** - Apple M3 Max, macOS 26.2 (25C56), Apple clang 21.0.0, CMake 4.4.4, Ninja 1.13.2 - `macos-port` at `b7eb6b6b`, x86-64 under Rosetta - LunarG Vulkan SDK 1.4.363.0 (MoltenVK 1.4.2), `DYLD_LIBRARY_PATH` and `VK_DRIVER_FILES` exported before `ctest`. x86-64 `vulkaninfo` reports `Apple M3 Max`, API 1.4.357. - Full build: 3054/3054 steps, 0 errors; 124 `.prx`, each `Mach-O 64-bit x86_64` **Tests without GPU** (`ctest -E 'agc|flip|display|vulkan|gpu' -j8`): 495 selected, 490 pass, 5 skip. `patched_libraries` timed 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 three `guest_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_ancillary` fails as on the M5 (`SPIR-V requires unsupported device capability 2`), and `prepared_shaders_registered_workgroup_sync` passes as on the M5. **With @Zheorgyan's `ImportWatched` change applied locally: 22 → 13**, the same 13 as on the M5 and M1 Pro: - Device capabilities: - `ngg_vertex_wave_info`: `subgroup capability 61 is unsupported for shader stage 1` - `pixel_interlock`: MoltenVK MSL compile error, `type 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'` - `relative_ancillary`: capability 2 - `f32_dot2_rounding`: needs Float64 - Float group: `f32_constant_factor_tininess`, `f32_denormal_flush`, `f32_output_modifier`, `float16_fma_rounding`, `float16_rounding`, `dpp16_operands`, `packed_alu`, `sdwa_float_selectors` - `dcc_keys_first_write`, as expected, since the branch has no import-window compare yet Skip reasons: no `shaderBufferInt64Atomics`, no `shaderFloat64`, no graphics pipeline libraries. **`guest_video_out_*`**: with a Vulkan loader present, `guest_video_out_wqhd_detection`, `guest_video_out_resolution_status` and `guest_video_out_output_mode` skip with `DisplayWindow: NSWindow should only be instantiated on the main thread!`, as @011010 reported on the M4. Without the loader they skip earlier, at `Failed to load Vulkan Portability library`. @mugurc I'd like to take the fix @011010 described: run those three tests inside `Aps5StartGuest_nid_no_patch`, as `libSceVideoOut/tests/Flip.cpp` does. Do you want it as a commit for `macos-port`, or as a PR to `main` after the main-thread runtime is in? AI-assisted: yes (Claude Code)
jotitadev commented 2026-10-14 15:19:42 +00:00 (Migrated from github.com)
Author
Contributor

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

  • Apple M2 Max (32 GB), macOS 27.2 (26B5091g), Apple clang 17.0.0 (clang-1700.6.3.2, Command Line Tools), CMake 4.4.4, Ninja 1.13.2
  • macos-port at b7eb6b6b, x86-64 under Rosetta
  • cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON, then ninja -C build and ninja -C build libs
  • Full build: 3054/3054 steps, 0 errors, 6 min 16 s; ninja libs: no work left. 124 .prx, each Mach-O 64-bit x86_64
  • Apple clang 17 builds the branch without changes, so the -fexperimental-library fix from 4d1e064c covers this toolchain.

Tests without GPU (ctest -E 'agc|flip|display|vulkan|gpu' -j8): 495 selected, 490 pass, 5 skip, 0 fail, 54 s. patched_libraries passed 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 only
  • video_out_frame_dump_queue: SDL offscreen driver has no Vulkan
  • guest_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_tcp and host_thread_local passed 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_PATH and VK_DRIVER_FILES exported before ctest. x86-64 vulkaninfo reports Apple 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_sync passes.

With APS5_NO_WRITE_WATCH=1 the count goes from 22 to 14, as on the M1 Pro and M3 Max:

  • Nine tests pass: 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_position fails with AGC 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6171750680 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6171750680). Originally posted by [jotitadev](https://github.com/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** - Apple M2 Max (32 GB), macOS 27.2 (26B5091g), Apple clang 17.0.0 (clang-1700.6.3.2, Command Line Tools), CMake 4.4.4, Ninja 1.13.2 - `macos-port` at `b7eb6b6b`, x86-64 under Rosetta - `cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON`, then `ninja -C build` and `ninja -C build libs` - Full build: 3054/3054 steps, 0 errors, 6 min 16 s; `ninja libs`: no work left. 124 `.prx`, each `Mach-O 64-bit x86_64` - Apple clang 17 builds the branch without changes, so the `-fexperimental-library` fix from `4d1e064c` covers this toolchain. **Tests without GPU** (`ctest -E 'agc|flip|display|vulkan|gpu' -j8`): 495 selected, 490 pass, 5 skip, 0 fail, 54 s. `patched_libraries` passed 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 only` - `video_out_frame_dump_queue`: SDL offscreen driver has no Vulkan - `guest_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_tcp` and `host_thread_local` passed 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_PATH` and `VK_DRIVER_FILES` exported before `ctest`. x86-64 `vulkaninfo` reports `Apple 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_sync` passes. With `APS5_NO_WRITE_WATCH=1` the count goes from 22 to 14, as on the M1 Pro and M3 Max: - Nine tests pass: `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_position` fails with `AGC 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.
011010 commented 2026-10-14 16:42:23 +00:00 (Migrated from github.com)
Author
Contributor

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.

  • Apple M4 (Mac mini), macOS 27.0.1 (26A434), x86-64 under Rosetta 2; Apple clang 21, CMake 4.4.4, Ninja 1.13.2.
  • macos-port at b7eb6b6b with @Zheorgyan's ImportWatched change from #5101 applied verbatim.
  • LunarG Vulkan SDK 1.4.363.0 (MoltenVK); DYLD_LIBRARY_PATH and VK_DRIVER_FILES exported before ctest. Device: Apple M4, subgroup 32.
  • Build: 2382 targets, 0 errors; 124 .prx, each Mach-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_ancillary fails 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6173405801 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6173405801). Originally posted by [011010](https://github.com/011010) on 2026-10-14T16:42:23Z. --- M4 result for the write-watch import change, closing the loop on my report above. - Apple M4 (Mac mini), macOS 27.0.1 (26A434), x86-64 under Rosetta 2; Apple clang 21, CMake 4.4.4, Ninja 1.13.2. - `macos-port` at `b7eb6b6b` with @Zheorgyan's `ImportWatched` change from #5101 applied verbatim. - LunarG Vulkan SDK 1.4.363.0 (MoltenVK); `DYLD_LIBRARY_PATH` and `VK_DRIVER_FILES` exported before `ctest`. Device: Apple M4, subgroup 32. - Build: 2382 targets, 0 errors; 124 `.prx`, each `Mach-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_ancillary` fails 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.
011010 commented 2026-10-14 16:43:45 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-14T16:43:45Z.


I'd like to take the VK_KHR_portability_enumeration availability check @yripper suggested. On __APPLE__ the instance currently pushes the extension and sets VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR without checking that the extension is advertised, so a loader or driver that does not expose it fails vkCreateInstance; the fix mirrors the availability test already done for the window extensions.

The block is not on main yet, so this belongs with the MoltenVK device piece: I can open it as a small PR with Depends on: that one, or leave it for you to fold in — your call. I will follow the order you set for the series.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6173436433 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6173436433). Originally posted by [011010](https://github.com/011010) on 2026-10-14T16:43:45Z. --- I'd like to take the `VK_KHR_portability_enumeration` availability check @yripper suggested. On `__APPLE__` the instance currently pushes the extension and sets `VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR` without checking that the extension is advertised, so a loader or driver that does not expose it fails `vkCreateInstance`; the fix mirrors the availability test already done for the window extensions. The block is not on `main` yet, so this belongs with the MoltenVK device piece: I can open it as a small PR with `Depends on:` that one, or leave it for you to fold in — your call. I will follow the order you set for the series.
jotitadev commented 2026-10-14 17:18:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T17:18:29Z.


M2 Max result for @Zheorgyan's ImportWatched change. My report above only had APS5_NO_WRITE_WATCH=1 (22 → 14); this is the change itself.

  • Apple M2 Max, macOS 27.2 (26B5091g), x86-64 under Rosetta; LunarG Vulkan SDK 1.4.363.0 (MoltenVK 1.4.2, Vulkan 1.4.357), DYLD_LIBRARY_PATH and VK_DRIVER_FILES exported before ctest.
  • macos-port at b7eb6b6b plus the snippet from this comment, applied as it is. This is the full diff:
--- a/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
+++ b/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
@@ -1260,7 +1260,14 @@ bool ImportWatched(std::uint64_t address, std::size_t bytes, const std::function
     const bool before = covered && walkWrites(tracker, first, stop, StampKind::Cpu, true);
-    if (!import()) return false;
+    bool imported = false;
+    {
+#ifdef __APPLE__
+        const GuestArena::HostWrite open(reinterpret_cast<void*>(first), static_cast<std::size_t>(stop - first));
+#endif
+        imported = import();
+    }
+    if (!imported) return false;

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_position passes, while with APS5_NO_WRITE_WATCH=1 it fails. dcc_keys_first_write still fails, as expected.

I also tried merging current main (f3b5daaf) into b7eb6b6b before 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 them VulkanDevice.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 current main.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6174103628 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6174103628). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-14T17:18:29Z. --- M2 Max result for @Zheorgyan's `ImportWatched` change. My report above only had `APS5_NO_WRITE_WATCH=1` (22 → 14); this is the change itself. - Apple M2 Max, macOS 27.2 (26B5091g), x86-64 under Rosetta; LunarG Vulkan SDK 1.4.363.0 (MoltenVK 1.4.2, Vulkan 1.4.357), `DYLD_LIBRARY_PATH` and `VK_DRIVER_FILES` exported before `ctest`. - `macos-port` at `b7eb6b6b` plus the snippet from [this comment](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6154411391), applied as it is. This is the full diff: ```diff --- a/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp +++ b/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp @@ -1260,7 +1260,14 @@ bool ImportWatched(std::uint64_t address, std::size_t bytes, const std::function const bool before = covered && walkWrites(tracker, first, stop, StampKind::Cpu, true); - if (!import()) return false; + bool imported = false; + { +#ifdef __APPLE__ + const GuestArena::HostWrite open(reinterpret_cast<void*>(first), static_cast<std::size_t>(stop - first)); +#endif + imported = import(); + } + if (!imported) return false; ``` `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_position` passes, while with `APS5_NO_WRITE_WATCH=1` it fails. `dcc_keys_first_write` still fails, as expected. I also tried merging current `main` (`f3b5daaf`) into `b7eb6b6b` before 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 them `VulkanDevice.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 current `main`. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
jotitadev commented 2026-10-14 17:21:56 +00:00 (Migrated from github.com)
Author
Contributor

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 + the ImportWatched change 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_selectors is confirmed, and agc_driver_mad_f32 from #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).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6174170382 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6174170382). Originally posted by [jotitadev](https://github.com/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` + the `ImportWatched` change 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_selectors` is confirmed, and `agc_driver_mad_f32` from #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).
011010 commented 2026-10-14 17:24:18 +00:00 (Migrated from github.com)
Author
Contributor

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 Layer stage input, and the recompiler then emits CapabilityGeometry (SpirvModuleSetup.cpp), which Metal does not have, so ValidateShaders refuses it with unsupported device capability 2. SPIR-V 1.5 lets the same read use CapabilityShaderLayer instead, without a geometry shader, and MoltenVK advertises shaderOutputLayer = true.

I tried it on the M4 against macos-port at b7eb6b6b with the #5101 change: with the module emitting CapabilityShaderLayer and SPIR-V 1.5 for that input when the device has no geometry shaders, the validator accepting CapabilityShaderLayer, and the validator's SPIR-V ceiling raised to 1.5, agc_driver_relative_ancillary passes. The real change would gate all of that on the device feature — use ShaderLayer only when shaderOutputLayer is 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.cpp and the device capability list. Tell me if the place in the series is wrong.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6174215668 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6174215668). Originally posted by [011010](https://github.com/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 `Layer` stage input, and the recompiler then emits `CapabilityGeometry` (`SpirvModuleSetup.cpp`), which Metal does not have, so `ValidateShaders` refuses it with `unsupported device capability 2`. SPIR-V 1.5 lets the same read use `CapabilityShaderLayer` instead, without a geometry shader, and MoltenVK advertises `shaderOutputLayer = true`. I tried it on the M4 against `macos-port` at `b7eb6b6b` with the #5101 change: with the module emitting `CapabilityShaderLayer` and SPIR-V 1.5 for that input when the device has no geometry shaders, the validator accepting `CapabilityShaderLayer`, and the validator's SPIR-V ceiling raised to 1.5, `agc_driver_relative_ancillary` passes. The real change would gate all of that on the device feature — use `ShaderLayer` only when `shaderOutputLayer` is 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.cpp` and the device capability list. Tell me if the place in the series is wrong.
011010 commented 2026-10-14 17:37:44 +00:00 (Migrated from github.com)
Author
Contributor

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_layer is already handled on main: the device pushes CapabilityShaderViewportIndexLayerEXT and the validator accepts it, and its extension, under the same flag. MoltenVK advertises the extension. So the Layer read can be lowered through that instead of CapabilityGeometry, with no SPIR-V version change: when a Layer stage input is present and the device has no geometry shaders but does have CapabilityShaderViewportIndexLayerEXT, the module emits SPV_EXT_shader_viewport_index_layer and that capability instead of CapabilityGeometry.

I tested that on the M4 (macos-port at b7eb6b6b with the #5101 change): agc_driver_relative_ancillary passes. It stays a single file (SpirvModuleSetup.cpp), and it keeps CapabilityGeometry whenever 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6174467782 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6174467782). Originally posted by [011010](https://github.com/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_layer` is already handled on `main`: the device pushes `CapabilityShaderViewportIndexLayerEXT` and the validator accepts it, and its extension, under the same flag. MoltenVK advertises the extension. So the `Layer` read can be lowered through that instead of `CapabilityGeometry`, with no SPIR-V version change: when a `Layer` stage input is present and the device has no geometry shaders but does have `CapabilityShaderViewportIndexLayerEXT`, the module emits `SPV_EXT_shader_viewport_index_layer` and that capability instead of `CapabilityGeometry`. I tested that on the M4 (`macos-port` at `b7eb6b6b` with the #5101 change): `agc_driver_relative_ancillary` passes. It stays a single file (`SpirvModuleSetup.cpp`), and it keeps `CapabilityGeometry` whenever 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.
jotitadev commented 2026-10-14 18:01:48 +00:00 (Migrated from github.com)
Author
Contributor

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", spvFMul used fma(l, r, T(0)), now T(-0.0)) accounts for.

Setup:

  • Apple M2 Max, macOS 27.2, Xcode 27.0, x86-64 AnyPS5 build under Rosetta. Loader from LunarG Vulkan SDK 1.4.363.0; the driver is selected with VK_DRIVER_FILES pointing at an ICD json with an absolute library_path. DYLD_LIBRARY_PATH points at a directory with only libvulkan*: with the SDK's lib/ there, dyld loads the SDK's libMoltenVK.dylib whatever the ICD says. I checked the loaded driver for every run with VK_LOADER_DEBUG=driver.
  • MoltenVK built from source with ./fetchDependencies --macos && make macos (universal, lipo -archs = x86_64 arm64), changing only ExternalRevisions/SPIRV-Cross_repo_revision:
    • B: MoltenVK main @ 5189f8de with SPIRV-Cross aa217aeb (the revision main pins, and the parent of 300681bb).
    • A: same MoltenVK with SPIRV-Cross 300681bb (#2704; it changes only the four fma addends in spirv_msl.cpp).
    • I repeated both on MoltenVK 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::Options warning, so I report main.
  • AnyPS5: macos-port at b7eb6b6b plus the ImportWatched change 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 (without docs/) on the same tree, with the Require in Check changed to print every mismatch.

Test SDK MoltenVK 1.4.2 B (without #2704) A (with #2704) First error with A
dpp16_operands fail fail pass
f32_output_modifier fail fail pass
float16_fma_rounding fail fail pass
float16_rounding fail fail pass
packed_alu fail fail pass
sdwa_float_selectors fail fail pass
f32_denormal_flush fail fail fail lane 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_tininess fail fail fail lane 2 no float mode v_mul_f32 0x3f7ffffe is 0x00000000, expected 0x00800000
f32_dot2_rounding fail fail fail 64-bit float instructions need the Float64 capability, which the device lacks
dcc_keys_first_write fail fail fail an unchanged pending image was uploaded again
ngg_vertex_wave_info fail fail fail subgroup capability 61 is unsupported for shader stage 1
pixel_interlock fail fail fail MSL compile: type 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'
relative_ancillary fail fail fail SPIR-V requires unsupported device capability 2
suite failures 13 13 7
mad_f32 (#5782) mismatches 76 76 36 the 36 left are the tiny-product case, 9 per float mode: 0x3f7ffffe * 0x00800001 gives 0
  • The SDK's MoltenVK and B give the same 13 failures with the same messages and the same 76 mad_f32 mismatches. Nothing here comes from MoltenVK version differences.
  • With #2704, 6 of the 13 pass. The 40 mad_f32 mismatches that go away are exactly the ones expecting 0x80000000 (10 per float mode). No new failures or mismatches appear.
  • f32_denormal_flush still fails, but on the tininess case: its signed-zero failure is gone.
  • The remaining 7 fail for other reasons: tininess after rounding (2), missing Float64, missing subgroup capability in that stage, an MSL compile error, an unsupported capability, and dcc_keys_first_write.

So on this machine, an SDK/MoltenVK release built with SPIRV-Cross at or after 300681bb should take the list from 13 to 7, and mad_f32 from #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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6174923905 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6174923905). Originally posted by [jotitadev](https://github.com/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", `spvFMul` used `fma(l, r, T(0))`, now `T(-0.0)`) accounts for. Setup: - Apple M2 Max, macOS 27.2, Xcode 27.0, x86-64 AnyPS5 build under Rosetta. Loader from LunarG Vulkan SDK 1.4.363.0; the driver is selected with `VK_DRIVER_FILES` pointing at an ICD json with an absolute `library_path`. `DYLD_LIBRARY_PATH` points at a directory with only `libvulkan*`: with the SDK's `lib/` there, dyld loads the SDK's `libMoltenVK.dylib` whatever the ICD says. I checked the loaded driver for every run with `VK_LOADER_DEBUG=driver`. - MoltenVK built from source with `./fetchDependencies --macos && make macos` (universal, `lipo -archs` = `x86_64 arm64`), changing only `ExternalRevisions/SPIRV-Cross_repo_revision`: - **B**: MoltenVK `main` @ `5189f8de` with SPIRV-Cross `aa217aeb` (the revision `main` pins, and the parent of `300681bb`). - **A**: same MoltenVK with SPIRV-Cross `300681bb` (#2704; it changes only the four `fma` addends in `spirv_msl.cpp`). - I repeated both on MoltenVK `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::Options` warning, so I report `main`. - AnyPS5: `macos-port` at `b7eb6b6b` plus the `ImportWatched` change 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 (without `docs/`) on the same tree, with the `Require` in `Check` changed to print every mismatch. | Test | SDK MoltenVK 1.4.2 | B (without #2704) | A (with #2704) | First error with A | |---|---|---|---|---| | `dpp16_operands` | fail | fail | **pass** | | | `f32_output_modifier` | fail | fail | **pass** | | | `float16_fma_rounding` | fail | fail | **pass** | | | `float16_rounding` | fail | fail | **pass** | | | `packed_alu` | fail | fail | **pass** | | | `sdwa_float_selectors` | fail | fail | **pass** | | | `f32_denormal_flush` | fail | fail | fail | `lane 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_tininess` | fail | fail | fail | `lane 2 no float mode v_mul_f32 0x3f7ffffe is 0x00000000, expected 0x00800000` | | `f32_dot2_rounding` | fail | fail | fail | `64-bit float instructions need the Float64 capability, which the device lacks` | | `dcc_keys_first_write` | fail | fail | fail | `an unchanged pending image was uploaded again` | | `ngg_vertex_wave_info` | fail | fail | fail | `subgroup capability 61 is unsupported for shader stage 1` | | `pixel_interlock` | fail | fail | fail | MSL compile: `type 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'` | | `relative_ancillary` | fail | fail | fail | `SPIR-V requires unsupported device capability 2` | | **suite failures** | 13 | 13 | **7** | | | `mad_f32` (#5782) mismatches | 76 | 76 | **36** | the 36 left are the tiny-product case, 9 per float mode: `0x3f7ffffe * 0x00800001` gives `0` | - The SDK's MoltenVK and B give the same 13 failures with the same messages and the same 76 `mad_f32` mismatches. Nothing here comes from MoltenVK version differences. - With #2704, 6 of the 13 pass. The 40 `mad_f32` mismatches that go away are exactly the ones expecting `0x80000000` (10 per float mode). No new failures or mismatches appear. - `f32_denormal_flush` still fails, but on the tininess case: its signed-zero failure is gone. - The remaining 7 fail for other reasons: tininess after rounding (2), missing Float64, missing subgroup capability in that stage, an MSL compile error, an unsupported capability, and `dcc_keys_first_write`. So on this machine, an SDK/MoltenVK release built with SPIRV-Cross at or after `300681bb` should take the list from 13 to 7, and `mad_f32` from #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.
011010 commented 2026-10-14 18:12:32 +00:00 (Migrated from github.com)
Author
Contributor

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_ancillary fails on SPIR-V requires unsupported device capability 2 because the shader reads the Layer input and the recompiler asks for CapabilityGeometry, which Metal cannot use. With the one-file change from that comment (emit SPV_EXT_shader_viewport_index_layer and CapabilityShaderViewportIndexLayerEXT when the device has no geometry shaders), agc_driver_relative_ancillary passes 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175125772 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6175125772). Originally posted by [011010](https://github.com/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_ancillary` fails on `SPIR-V requires unsupported device capability 2` because the shader reads the `Layer` input and the recompiler asks for `CapabilityGeometry`, which Metal cannot use. With the one-file change from that comment (emit `SPV_EXT_shader_viewport_index_layer` and `CapabilityShaderViewportIndexLayerEXT` when the device has no geometry shaders), `agc_driver_relative_ancillary` passes 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.
krishalivaibhav commented 2026-10-14 19:23:14 +00:00 (Migrated from github.com)
Author
Contributor

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

  • Original fma(a, b, +0) loses the negative-zero sign in 6/16 cases for both float and half.
  • Corrected fma(a, b, -0.0) passes 16/16 for float and half; the float helper also passes after removing optnone with contraction disabled. The half check does not separately establish optimized-helper equivalence.
  • I updated our private captured-fragment replay to compare the corrected helper with the optimization candidate. All 29 synthetic 768x432 replay pairs match bitwise. The sampler is explicitly enabled for argument-buffer use; earlier harness results without that setting are superseded.

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-port suite), 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. optnone and compile options are preserved. Both synchronous/asynchronous compilation hooks were installed and replacement counters confirmed the four helper patterns were encountered.

  • Recovered: agc_driver_f32_output_modifier, agc_driver_float16_fma_rounding, agc_driver_packed_alu, agc_driver_sdwa_float_selectors.
  • agc_driver_float16_rounding already passed without the hook.
  • agc_driver_dpp16_operands still fails identically: row_shr_pk_fmac_f16 actual 0x2e660000, expected 0x2e668000. This differs from the M2 Max report; we have not isolated whether the cause is the runtime/test revisions or another difference.
  • Reversion control: unsetting the hook makes f32_output_modifier and float16_fma_rounding fail 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6176473764 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6176473764). Originally posted by [krishalivaibhav](https://github.com/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}. - Original `fma(a, b, +0)` loses the negative-zero sign in 6/16 cases for both float and half. - Corrected `fma(a, b, -0.0)` passes 16/16 for float and half; the float helper also passes after removing `optnone` with contraction disabled. The half check does not separately establish optimized-helper equivalence. - I updated our private captured-fragment replay to compare the corrected helper with the optimization candidate. All 29 synthetic 768x432 replay pairs match bitwise. The sampler is explicitly enabled for argument-buffer use; earlier harness results without that setting are superseded. 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-port` suite), 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. `optnone` and compile options are preserved. Both synchronous/asynchronous compilation hooks were installed and replacement counters confirmed the four helper patterns were encountered. - Recovered: `agc_driver_f32_output_modifier`, `agc_driver_float16_fma_rounding`, `agc_driver_packed_alu`, `agc_driver_sdwa_float_selectors`. - `agc_driver_float16_rounding` already passed without the hook. - `agc_driver_dpp16_operands` still fails identically: `row_shr_pk_fmac_f16` actual `0x2e660000`, expected `0x2e668000`. This differs from the M2 Max report; we have not isolated whether the cause is the runtime/test revisions or another difference. - Reversion control: unsetting the hook makes `f32_output_modifier` and `float16_fma_rounding` fail 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.
jotitadev commented 2026-10-14 21:07:28 +00:00 (Migrated from github.com)
Author
Contributor

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, then ninja -k 0 and ninja -k 0 libs). Base: main 41cc655b8. The PRs were merged cumulatively with git merge --no-ff --no-commit at heads #4627 dba6a02b7, #4629 facc03ae9, #4630 cc064ec78 and #5735 14e62d45d.

Step Configures Objects failing Distinct errors
main yes 44 89
+ #4627 yes 25 68
+ #4629 yes 22 62
+ #4630 yes (conflict in the test, see #4630) 20 41
+ #5735 yes 19 40

Each PR removes the errors its description names and adds none. libc.dylib still 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 base 2a5eca11c, so I assume a later PR of the series covers it (macos-port has the __APPLE__ branch).
  • libc/src/Threads.cpp:248: new on main since your base, from #5037 (_Cnd_timedwait). system_clock::time_point(seconds + nanoseconds) does not compile with libc++, whose system_clock counts microseconds; it needs a duration_cast/time_point_cast.

Other code that main gained after 2a5eca11c, which no open PR covers and which macos-port predates:

File:line Error on macOS From
libkernel_sys/Export.cpp:543,569 ::rmdir, ::unlink undeclared: <unistd.h> is under #ifdef __linux__, the code under #else #4870
libSceLibcInternal/PathStatistics.cpp:103 O_PATH undeclared #4653
libkernel/DirectMemory/Jit.cpp:143 MFD_CLOEXEC undeclared #3787
tests/GuestGenericCategory.cpp:56 reinterpret_cast from const void * to a function pointer casts away qualifiers #5102

The rest are the libkernel host APIs you listed as next:

  • link.h in DynamicLoader, ModuleInfo and Rtld.
  • st_atim, MFD_CLOEXEC in SharedMemory, and sys/vfs.h.
  • windows.h in DirectMemory.cpp.
  • pthread_getattr_np, ppoll and sched_getcpu.
  • Resolver.cpp gethostbyname_r, and ThreadPriority.cpp RLIMIT_RTTIME.
  • libguest_module_fixture.dylib fails with ld: unknown options: --no-as-needed (libkernel/CMakeLists.txt:178 has NOT WIN32, macos-port has NOT WIN32 AND NOT APPLE).

Written with AI assistance (Claude Code). I ran the builds above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6178527997 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6178527997). Originally posted by [jotitadev](https://github.com/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`, then `ninja -k 0` and `ninja -k 0 libs`). Base: `main` 41cc655b8. The PRs were merged cumulatively with `git merge --no-ff --no-commit` at heads #4627 dba6a02b7, #4629 facc03ae9, #4630 cc064ec78 and #5735 14e62d45d. | Step | Configures | Objects failing | Distinct errors | |---|---|---|---| | `main` | yes | 44 | 89 | | + #4627 | yes | 25 | 68 | | + #4629 | yes | 22 | 62 | | + #4630 | yes (conflict in the test, see #4630) | 20 | 41 | | + #5735 | yes | 19 | 40 | Each PR removes the errors its description names and adds none. `libc.dylib` still 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 base 2a5eca11c, so I assume a later PR of the series covers it (`macos-port` has the `__APPLE__` branch). - `libc/src/Threads.cpp:248`: new on `main` since your base, from #5037 (`_Cnd_timedwait`). `system_clock::time_point(seconds + nanoseconds)` does not compile with libc++, whose `system_clock` counts microseconds; it needs a `duration_cast`/`time_point_cast`. Other code that `main` gained after 2a5eca11c, which no open PR covers and which `macos-port` predates: | File:line | Error on macOS | From | |---|---|---| | `libkernel_sys/Export.cpp:543,569` | `::rmdir`, `::unlink` undeclared: `<unistd.h>` is under `#ifdef __linux__`, the code under `#else` | #4870 | | `libSceLibcInternal/PathStatistics.cpp:103` | `O_PATH` undeclared | #4653 | | `libkernel/DirectMemory/Jit.cpp:143` | `MFD_CLOEXEC` undeclared | #3787 | | `tests/GuestGenericCategory.cpp:56` | `reinterpret_cast` from `const void *` to a function pointer casts away qualifiers | #5102 | The rest are the libkernel host APIs you listed as next: - `link.h` in `DynamicLoader`, `ModuleInfo` and `Rtld`. - `st_atim`, `MFD_CLOEXEC` in `SharedMemory`, and `sys/vfs.h`. - `windows.h` in `DirectMemory.cpp`. - `pthread_getattr_np`, `ppoll` and `sched_getcpu`. - `Resolver.cpp` `gethostbyname_r`, and `ThreadPriority.cpp` `RLIMIT_RTTIME`. - `libguest_module_fixture.dylib` fails with `ld: unknown options: --no-as-needed` (`libkernel/CMakeLists.txt:178` has `NOT WIN32`, `macos-port` has `NOT WIN32 AND NOT APPLE`). Written with AI assistance (Claude Code). I ran the builds above on my machine.
krishalivaibhav commented 2026-10-14 21:10:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-14T21:10:15Z.


@jotitadev @Zheorgyan I isolated why agc_driver_dpp16_operands still 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 your macos-port revision or a full rebuilt MoltenVK comparison.

  1. Captured the test's generated MSL after the signed-zero edits. Its row-shift source check combines lane-in-row >= 1 with a spvSubgroupBallot(true) membership check using short-circuit &&.
  2. Replayed the captured compute kernel directly in Metal with the public test's exact 32 input rows and compared every output against its 512 expected words. There are two mismatches: lane 1/result 5 is 0x2e660000 instead of 0x2e668000; lane 17/result 5 is 0xb8004a3d instead of 0x49fd4a3d.
  3. A diagnostic kernel records the correctly shuffled/widened negative source, but the guarded operand path produces zero. Direct FMA with the same negative operand and a -0 addend gives the expected -0. This supports the explanation that short-circuit evaluation excludes row-head lanes 0/16 from the ballot before lanes 1/17 test source membership.
  4. In a private experiment only, replaced four occurrences of that specific generated guard's boolean && 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.
  5. Applied the same exact-text transformation through the temporary compile hook and reran the original Vulkan 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6178576997 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6178576997). Originally posted by [krishalivaibhav](https://github.com/krishalivaibhav) on 2026-10-14T21:10:15Z. --- @jotitadev @Zheorgyan I isolated why `agc_driver_dpp16_operands` still 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 your `macos-port` revision or a full rebuilt MoltenVK comparison. 1. Captured the test's generated MSL after the signed-zero edits. Its row-shift source check combines `lane-in-row >= 1` with a `spvSubgroupBallot(true)` membership check using short-circuit `&&`. 2. Replayed the captured compute kernel directly in Metal with the public test's exact 32 input rows and compared every output against its 512 expected words. There are two mismatches: lane 1/result 5 is `0x2e660000` instead of `0x2e668000`; lane 17/result 5 is `0xb8004a3d` instead of `0x49fd4a3d`. 3. A diagnostic kernel records the correctly shuffled/widened negative source, but the guarded operand path produces zero. Direct FMA with the same negative operand and a -0 addend gives the expected -0. This supports the explanation that short-circuit evaluation excludes row-head lanes 0/16 from the ballot before lanes 1/17 test source membership. 4. In a private experiment only, replaced four occurrences of that specific generated guard's boolean `&&` 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. 5. Applied the same exact-text transformation through the temporary compile hook and reran the original Vulkan `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.
jotitadev commented 2026-10-14 21:21:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T21:21:04Z.


@mugurc on the code main gained 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++'s system_clock (microseconds) rejects. I have a one-line fix ready, rounding up with ceil<system_clock::duration> so the deadline never comes before the requested time; libstdc++ is unchanged. Checked on Apple clang 21 with -fsyntax-only on the ninja command line.
  • libkernel_sys/Export.cpp rmdir/unlink (#4870), PathStatistics.cpp O_PATH (#4653), Jit.cpp MFD_CLOEXEC (#3787) and the GuestGenericCategory.cpp cast (#5102).

Tell me which ones you want me to take, if any. I'll leave the libkernel host APIs and the --no-as-needed fixture to the series.

Written with AI assistance (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6178768457 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6178768457). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-14T21:21:04Z. --- @mugurc on the code `main` gained 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++'s `system_clock` (microseconds) rejects. I have a one-line fix ready, rounding up with `ceil<system_clock::duration>` so the deadline never comes before the requested time; libstdc++ is unchanged. Checked on Apple clang 21 with `-fsyntax-only` on the ninja command line. - `libkernel_sys/Export.cpp` `rmdir`/`unlink` (#4870), `PathStatistics.cpp` `O_PATH` (#4653), `Jit.cpp` `MFD_CLOEXEC` (#3787) and the `GuestGenericCategory.cpp` cast (#5102). Tell me which ones you want me to take, if any. I'll leave the libkernel host APIs and the `--no-as-needed` fixture to the series. Written with AI assistance (Claude Code).
jotitadev commented 2026-10-14 21:30:24 +00:00 (Migrated from github.com)
Author
Contributor

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 (not main). Driver checked with VK_LOADER_DEBUG=driver and MSL captured with MVK_CONFIG_SHADER_DUMP_DIR. Require was turned into a print to list every mismatch.

MoltenVK SPIRV-Cross agc_driver_dpp16_operands
SDK 1.4.363.0 (v1.4.2) SDK's 2 mismatches: lane 1 0x2e660000 vs 0x2e668000, lane 11 0x0000402b vs 0x8000402b
v1.4.2 / main 5189f8de aa217aeb same 2
v1.4.2 / main 5189f8de 300681bb (#2704) pass, 0 mismatches
  • Same SPIR-V on all drivers. Between aa217aeb and 300681bb, the MSL differs only in the four -0.0 helper edits.
  • Our lane 1 failure matches yours, but it goes away with #2704 alone. I don't get your lane 17 (0xb8004a3d vs 0x49fd4a3d).
  • In our MSL the ballot is not inside the &&. It is a separate statement in uniform control flow, and the guard only tests a bit of its result:
    _484 = spvSubgroupBallot(true);
    uint _1225 = (extract_bits(((_1205 >= 1u) && (((_484.x & (1u << (_1207 & 31u))) != 0u) && (_1207 < 32u))) ? _480 : 0u, 0u, 16u) & 65535u);
    
    So short-circuiting cannot skip the ballot for lanes 0/16 here. That guard text is identical with all three drivers. If your MSL has spvSubgroupBallot inside the && operand, your SPIR-V (from a different recompiler revision) is probably what differs. Comparing the two .spv would settle it.
  • One pitfall I hit while checking this. The AGC pipeline cache file is keyed by driverVersion + pipelineCacheUUID, and MoltenVK's UUID does not change with the SPIRV-Cross revision. Running the test binary directly without ANYPS5_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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6178933798 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6178933798). Originally posted by [jotitadev](https://github.com/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 (not `main`). Driver checked with `VK_LOADER_DEBUG=driver` and MSL captured with `MVK_CONFIG_SHADER_DUMP_DIR`. `Require` was turned into a print to list every mismatch. | MoltenVK | SPIRV-Cross | `agc_driver_dpp16_operands` | |---|---|---| | SDK 1.4.363.0 (v1.4.2) | SDK's | 2 mismatches: lane 1 `0x2e660000` vs `0x2e668000`, lane 11 `0x0000402b` vs `0x8000402b` | | v1.4.2 / main 5189f8de | aa217aeb | same 2 | | v1.4.2 / main 5189f8de | 300681bb (#2704) | pass, 0 mismatches | - **Same SPIR-V on all drivers.** Between aa217aeb and 300681bb, the MSL differs only in the four `-0.0` helper edits. - **Our lane 1 failure matches yours, but it goes away with #2704 alone.** I don't get your lane 17 (`0xb8004a3d` vs `0x49fd4a3d`). - **In our MSL the ballot is not inside the `&&`.** It is a separate statement in uniform control flow, and the guard only tests a bit of its result: ``` _484 = spvSubgroupBallot(true); uint _1225 = (extract_bits(((_1205 >= 1u) && (((_484.x & (1u << (_1207 & 31u))) != 0u) && (_1207 < 32u))) ? _480 : 0u, 0u, 16u) & 65535u); ``` So short-circuiting cannot skip the ballot for lanes 0/16 here. That guard text is identical with all three drivers. If your MSL has `spvSubgroupBallot` inside the `&&` operand, your SPIR-V (from a different recompiler revision) is probably what differs. Comparing the two `.spv` would settle it. - **One pitfall I hit while checking this.** The AGC pipeline cache file is keyed by `driverVersion` + `pipelineCacheUUID`, and MoltenVK's UUID does not change with the SPIRV-Cross revision. Running the test binary directly without `ANYPS5_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.
krishalivaibhav commented 2026-10-14 21:33:22 +00:00 (Migrated from github.com)
Author
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6178982689 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6178982689). Originally posted by [krishalivaibhav](https://github.com/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.
yripper commented 2026-10-14 22:00:46 +00:00 (Migrated from github.com)
Author
Contributor

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:

  • It is the same Arena class and constants as on Linux. Only two host primitives differ:
    • Host mappings: a mach_vm_region walk from ArenaStart to ApplicationAreaEnd, in place of /proc/self/maps.
    • Reservation without replacing: mach_vm_map with VM_FLAGS_FIXED, VM_PROT_NONE and max protection VM_PROT_ALL, in the same 1 GiB chunks. KERN_NO_SPACE maps to EEXIST, so the loop that skips occupied chunks is unchanged.
  • The commit and protection paths (PlaceAt, GuestArenaSetProtection) are the Linux POSIX ones, enabled for __APPLE__ as well.
  • Holes: the kernel keeps 0x10_0000_0000–0x70_0000_0000 unmappable (max protection none) for every process, and dyld and the Rosetta runtime sit near 0x2_0200_0000 and 0x3_0400_0000. A fixed guest mapping inside those ranges fails; mappings without a fixed address are placed around them. This is recorded as debt in docs/dev/debt/libc.md.
  • Direct memory on top of it: physical memory is an unlinked shared-memory object, hinted mappings are placed with mach_vm_map, and VirtualQuery answers from mach_vm_region.
  • JIT backing: Rosetta can't execute pages mapped from a shm_open object (bus error), so on macOS the JIT backing is an unlinked mkostemp file in the temp directory, where Linux uses memfd_create.
  • There is a standalone guest_arena test, which passes as x86-64 under Rosetta and as arm64.

Two orders would work:

  1. The arena first, as a small PR against main that touches only GuestArena.cpp, its test and the debt entry, with your direct memory on top.
  2. Your direct-memory branch first, and I rebase the arena onto it.

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_enumeration check, thanks. I'll open the write-watch protection query for the AGC page query after #5619, to keep one open PR at a time.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6179438307 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6179438307). Originally posted by [yripper](https://github.com/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: - It is the same `Arena` class and constants as on Linux. Only two host primitives differ: - **Host mappings**: a `mach_vm_region` walk from `ArenaStart` to `ApplicationAreaEnd`, in place of `/proc/self/maps`. - **Reservation without replacing**: `mach_vm_map` with `VM_FLAGS_FIXED`, `VM_PROT_NONE` and max protection `VM_PROT_ALL`, in the same 1 GiB chunks. `KERN_NO_SPACE` maps to `EEXIST`, so the loop that skips occupied chunks is unchanged. - The commit and protection paths (`PlaceAt`, `GuestArenaSetProtection`) are the Linux POSIX ones, enabled for `__APPLE__` as well. - **Holes**: the kernel keeps 0x10_0000_0000–0x70_0000_0000 unmappable (max protection none) for every process, and dyld and the Rosetta runtime sit near 0x2_0200_0000 and 0x3_0400_0000. A fixed guest mapping inside those ranges fails; mappings without a fixed address are placed around them. This is recorded as debt in `docs/dev/debt/libc.md`. - **Direct memory** on top of it: physical memory is an unlinked shared-memory object, hinted mappings are placed with `mach_vm_map`, and `VirtualQuery` answers from `mach_vm_region`. - **JIT backing**: Rosetta can't execute pages mapped from a `shm_open` object (bus error), so on macOS the JIT backing is an unlinked `mkostemp` file in the temp directory, where Linux uses `memfd_create`. - There is a standalone `guest_arena` test, which passes as x86-64 under Rosetta and as arm64. Two orders would work: 1. The arena first, as a small PR against `main` that touches only `GuestArena.cpp`, its test and the debt entry, with your direct memory on top. 2. Your direct-memory branch first, and I rebase the arena onto it. 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_enumeration` check, thanks. I'll open the write-watch protection query for the AGC page query after #5619, to keep one open PR at a time.
yripper commented 2026-10-14 22:00:47 +00:00 (Migrated from github.com)
Author
Contributor

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_MOLTENVK it drops NoContraction from 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6179438739 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6179438739). Originally posted by [yripper](https://github.com/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_MOLTENVK` it drops `NoContraction` from 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.
011010 commented 2026-10-14 22:26:56 +00:00 (Migrated from github.com)
Author
Contributor

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 on macos-port, not on main, so it belongs with the device piece @mugurc is landing. I will send it as a small PR with Depends 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 when vkEnumerateInstanceExtensionProperties lists it, like the window extensions already do) and can check it on the M4.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6179893576 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6179893576). Originally posted by [011010](https://github.com/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 on `macos-port`, not on `main`, so it belongs with the device piece @mugurc is landing. I will send it as a small PR with `Depends 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 when `vkEnumerateInstanceExtensionProperties` lists it, like the window extensions already do) and can check it on the M4.
mugurc commented 2026-10-14 22:37:22 +00:00 (Migrated from github.com)
Author
Contributor

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 in GuestRaiseException.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.cpp rmdir/unlink (#4870), PathStatistics.cpp O_PATH (#4653), Jit.cpp MFD_CLOEXEC (#3787) and the GuestGenericCategory.cpp cast (#5102). I will not carry them. The libkernel host APIs and the --no-as-needed fixture 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6180063305 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6180063305). Originally posted by [mugurc](https://github.com/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 in `GuestRaiseException.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.cpp` `rmdir`/`unlink` (#4870), `PathStatistics.cpp` `O_PATH` (#4653), `Jit.cpp` `MFD_CLOEXEC` (#3787) and the `GuestGenericCategory.cpp` cast (#5102). I will not carry them. The libkernel host APIs and the `--no-as-needed` fixture 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.
yripper commented 2026-10-14 22:51:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by yripper on 2026-10-14T22:51:01Z.


@mugurc the arena PR is open: #6124 (GuestArena.cpp, the standalone guest_arena test and the debt entry, against current main). The JIT backing will follow as its own PR once this one is in.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6180248007 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6180248007). Originally posted by [yripper](https://github.com/yripper) on 2026-10-14T22:51:01Z. --- @mugurc the arena PR is open: #6124 (`GuestArena.cpp`, the standalone `guest_arena` test and the debt entry, against current `main`). The JIT backing will follow as its own PR once this one is in.
011010 commented 2026-10-14 22:58:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-14T22:58:40Z.


@mugurc the relative_ancillary fix I described above is separate from the MoltenVK device branch: the module it changes (SpirvModuleSetup.cpp, the emit of the Layer input's capability) already lives on main, and the validator there already accepts CapabilityShaderViewportIndexLayerEXT when the device advertises VK_EXT_shader_viewport_index_layer, so nothing changes on NVIDIA or lavapipe. It also carries a unit test that forces supportedCapabilities, so it runs on Linux CI.

Should it go against main now, or do you want it after the series too?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6180348495 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6180348495). Originally posted by [011010](https://github.com/011010) on 2026-10-14T22:58:40Z. --- @mugurc the `relative_ancillary` fix I described above is separate from the MoltenVK device branch: the module it changes (`SpirvModuleSetup.cpp`, the emit of the `Layer` input's capability) already lives on `main`, and the validator there already accepts `CapabilityShaderViewportIndexLayerEXT` when the device advertises `VK_EXT_shader_viewport_index_layer`, so nothing changes on NVIDIA or lavapipe. It also carries a unit test that forces `supportedCapabilities`, so it runs on Linux CI. Should it go against `main` now, or do you want it after the series too?
jotitadev commented 2026-10-14 23:26:03 +00:00 (Migrated from github.com)
Author
Contributor

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-libcxx
  • libkernel_sys/Export.cpp rmdir/unlink (#4870): jotitadev:fix/macos-libkernel-sys-unistd
  • PathStatistics.cpp O_PATH (#4653): jotitadev:fix/macos-path-statistics-o-path
  • GuestGenericCategory.cpp cast (#5102): jotitadev:fix/macos-generic-category-test-cast

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6180723887 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6180723887). Originally posted by [jotitadev](https://github.com/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-libcxx` - `libkernel_sys/Export.cpp` `rmdir`/`unlink` (#4870): `jotitadev:fix/macos-libkernel-sys-unistd` - `PathStatistics.cpp` `O_PATH` (#4653): `jotitadev:fix/macos-path-statistics-o-path` - `GuestGenericCategory.cpp` cast (#5102): `jotitadev:fix/macos-generic-category-test-cast` One 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).
mugurc commented 2026-10-14 23:30:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-14T23:30:23Z.


@011010 against main now, please: it only touches SpirvModuleSetup.cpp, which none of my branches change, so it does not need to wait for the series.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6180779193 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6180779193). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-14T23:30:23Z. --- @011010 against `main` now, please: it only touches `SpirvModuleSetup.cpp`, which none of my branches change, so it does not need to wait for the series.
jotitadev commented 2026-10-15 00:17:32 +00:00 (Migrated from github.com)
Author
Contributor

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 the MFD_CLOEXEC compile error is the one @yripper described above, an unlinked mkostemp file in the temporary directory, because shm_open pages cannot be made executable. It is on jotitadev:fix/macos-jit-mfd-cloexec (one #ifdef __APPLE__ in CreateBacking; 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: mmap with PROT_EXEC of this file, or of any regular file, returns EPERM, while mapping it PROT_READ and then mprotect to read-execute works and runs code written through a shared read-write view. With an anonymous shm_open object that mprotect fails with EACCES.

Written with AI assistance (Claude Code). I ran the checks above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6181393697 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6181393697). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-15T00:17:32Z. --- @yripper @mugurc about `Jit.cpp` (#3787): the macOS backing I prepared for the `MFD_CLOEXEC` compile error is the one @yripper described above, an unlinked `mkostemp` file in the temporary directory, because `shm_open` pages cannot be made executable. It is on `jotitadev:fix/macos-jit-mfd-cloexec` (one `#ifdef __APPLE__` in `CreateBacking`; 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: `mmap` with `PROT_EXEC` of this file, or of any regular file, returns `EPERM`, while mapping it `PROT_READ` and then `mprotect` to read-execute works and runs code written through a shared read-write view. With an anonymous `shm_open` object that `mprotect` fails with `EACCES`. Written with AI assistance (Claude Code). I ran the checks above on my machine.
yripper commented 2026-10-15 02:11:19 +00:00 (Migrated from github.com)
Author
Contributor

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 (mkostemp with O_CLOEXEC, then unlink), so I'll review yours rather than send a duplicate.

Thanks for the DoMapShared data point. It matches what I see in DirectMemory.cpp: on macOS the non-Windows path calls mmap with 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 calling mprotect up 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6182812735 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6182812735). Originally posted by [yripper](https://github.com/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 (`mkostemp` with `O_CLOEXEC`, then `unlink`), so I'll review yours rather than send a duplicate. Thanks for the `DoMapShared` data point. It matches what I see in `DirectMemory.cpp`: on macOS the non-Windows path calls `mmap` with 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 calling `mprotect` up 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.
jotitadev commented 2026-10-15 02:25:17 +00:00 (Migrated from github.com)
Author
Contributor

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 DoMapShared change (map without PROT_EXEC, then mprotect up to the requested protection) I'll send as a separate follow-up, since it touches DirectMemory.cpp and the guest mapping path rather than the JIT backing.

Written with AI assistance (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6182984499 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6182984499). Originally posted by [jotitadev](https://github.com/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 `DoMapShared` change (map without `PROT_EXEC`, then `mprotect` up to the requested protection) I'll send as a separate follow-up, since it touches `DirectMemory.cpp` and the guest mapping path rather than the JIT backing. Written with AI assistance (Claude Code).
mugurc commented 2026-10-15 06:47:33 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-15T06:47:33Z.


@jotitadev @yripper one more data point for the DoMapShared follow-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:

  • An unlinked regular file (the JIT backing, and what my files branch, not open yet, uses for anonymous shm_open objects on macOS): mmap with PROT_EXEC fails with EPERM; mapping without it and then calling mprotect up to read-execute works. mprotect up to read-write-execute also works under Rosetta, but fails with EACCES as native arm64.
  • A shm_open object: mmap with PROT_EXEC works, but an mprotect that adds execute fails with EACCES, even on a mapping that started read-write-execute and was lowered to read-write.

So mapping first and then calling mprotect is right for guest shared memory objects. My direct-memory branch backs direct memory with shm_open, so there a guest mprotect that makes direct memory executable fails; I'll fix that in that branch.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6186241342 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6186241342). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-15T06:47:33Z. --- @jotitadev @yripper one more data point for the `DoMapShared` follow-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: - An unlinked regular file (the JIT backing, and what my files branch, not open yet, uses for anonymous `shm_open` objects on macOS): `mmap` with `PROT_EXEC` fails with `EPERM`; mapping without it and then calling `mprotect` up to read-execute works. `mprotect` up to read-write-execute also works under Rosetta, but fails with `EACCES` as native arm64. - A `shm_open` object: `mmap` with `PROT_EXEC` works, but an `mprotect` that adds execute fails with `EACCES`, even on a mapping that started read-write-execute and was lowered to read-write. So mapping first and then calling `mprotect` is right for guest shared memory objects. My direct-memory branch backs direct memory with `shm_open`, so there a guest `mprotect` that makes direct memory executable fails; I'll fix that in that branch.
mugurc commented 2026-10-15 07:05:13 +00:00 (Migrated from github.com)
Author
Contributor

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:

  • For a shm_open object, mmap with PROT_EXEC succeeds, but calling code in that mapping ends with SIGBUS, so shm_open cannot back guest code at all. My direct-memory branch now uses a named Mach memory entry instead (mach_make_memory_entry_64 with MAP_MEM_NAMED_CREATE): its mappings can be aliased, made executable with mprotect, and the code in them runs.
  • Rosetta does not see code rewritten through a second view. I mapped an unlinked file read-write at one address and read-execute at another, called through the executable view, wrote new code through the read-write view and called again: the old code ran. sys_icache_invalidate on the executable view does not help. Changing the executable view to read-only and back to read-execute with mprotect does, and code written at an offset that has not run yet is picked up without it. A memory entry behaves the same way. For sceKernelJitCreateSharedMemory and 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: sceSystemServiceLoadExec on macOS (the running executable from _NSGetExecutablePath, the process replaced with posix_spawn and POSIX_SPAWN_SETEXEC). It touches libSceSystemService and GuestSystemExit.cpp, next to #6237 and #5699.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6186498683 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6186498683). Originally posted by [mugurc](https://github.com/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: - For a `shm_open` object, `mmap` with `PROT_EXEC` succeeds, but calling code in that mapping ends with `SIGBUS`, so `shm_open` cannot back guest code at all. My direct-memory branch now uses a named Mach memory entry instead (`mach_make_memory_entry_64` with `MAP_MEM_NAMED_CREATE`): its mappings can be aliased, made executable with `mprotect`, and the code in them runs. - Rosetta does not see code rewritten through a second view. I mapped an unlinked file read-write at one address and read-execute at another, called through the executable view, wrote new code through the read-write view and called again: the old code ran. `sys_icache_invalidate` on the executable view does not help. Changing the executable view to read-only and back to read-execute with `mprotect` does, and code written at an offset that has not run yet is picked up without it. A memory entry behaves the same way. For `sceKernelJitCreateSharedMemory` and 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: `sceSystemServiceLoadExec` on macOS (the running executable from `_NSGetExecutablePath`, the process replaced with `posix_spawn` and `POSIX_SPAWN_SETEXEC`). It touches `libSceSystemService` and `GuestSystemExit.cpp`, next to #6237 and #5699.
DavidSamir commented 2026-10-16 03:51:30 +00:00 (Migrated from github.com)
Author
Contributor

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 main ce991f1ec with #4627, #4630, #6124, the four macOS relinker PRs and mugurc's libkernel-files, sockets, process-clock, module-info, direct-memory, macos-main-thread, macho-tls, agc-macos-* and audio-macos-single-sdl branches merged; run from a directory with libs/ beside the executable.

  • As built, ccleste logs No device with Vulkan support found and exits with a segfault 4 s in. Its RADV (mihawk-99/PS5_Mesa dc82d010, src/amd/vulkan/winsys/ps5/radv_ps5_platform.c) maps its 16 MiB ring with sceKernelMapDirectMemory and 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, from MapPlaced's plain mmap(nullptr, ...): the arena paths in DirectMemory.cpp (ArenaAvailable/ArenaCommit/ArenaForget, and the GuestArenaAllocateFromHint and GuestArenaAllocate branches of MapPlaced) are __linux__ only.
  • With only those three guards widened to __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 on AGC 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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6207674678 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6207674678). Originally posted by [DavidSamir](https://github.com/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 `main` ce991f1ec with #4627, #4630, #6124, the four macOS relinker PRs and mugurc's `libkernel-files`, `sockets`, `process-clock`, `module-info`, `direct-memory`, `macos-main-thread`, `macho-tls`, `agc-macos-*` and `audio-macos-single-sdl` branches merged; run from a directory with `libs/` beside the executable. - As built, ccleste logs `No device with Vulkan support found` and exits with a segfault 4 s in. Its RADV (mihawk-99/PS5_Mesa `dc82d010`, `src/amd/vulkan/winsys/ps5/radv_ps5_platform.c`) maps its 16 MiB ring with `sceKernelMapDirectMemory` and 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, from `MapPlaced`'s plain `mmap(nullptr, ...)`: the arena paths in `DirectMemory.cpp` (`ArenaAvailable`/`ArenaCommit`/`ArenaForget`, and the `GuestArenaAllocateFromHint` and `GuestArenaAllocate` branches of `MapPlaced`) are `__linux__` only. - With only those three guards widened to `__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 on `AGC 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
Cloud-Multiplayer commented 2026-10-16 04:59:09 +00:00 (Migrated from github.com)
Author
Contributor

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 W stop: I hit the same one after merging current main into 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 writes gl_ClipDistance (DefineOutputs in SpirvMemory/SpirvEmitterHelpers.cpp, zeroPositionClipIndex). A rect-list draw runs the generated tessellation control stage from RectListShaders.cpp after the guest vertex program. With the extra clip distance in the vertex outputs, MoltenVK hands that control stage zero positions: I wrote the three gl_in[i].gl_Position values 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:

  • zero-position clip left out of the vertex programs: no rect-list faults, and the screen clears correctly;
  • zero-position clip on: about 2,200 faults in 40 s, one per clear, and the cleared area keeps the previous frames.

Workaround I am using. Skip the zero-position clip on __APPLE__ (an #ifdef around the zeroPositionClipIndex block in DefineOutputs, 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_ClipDistance in the control stage's gl_in block, so that both sides of the interface match. That run used a stale vk-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 delete shader_cache/vk-pipelines-*.bin along with the shader cache when you test this (@jotitadev noted the same for a rebuilt MoltenVK); and the generated control stage only gets past ShaderValidation.cpp with ClipDistance allowed as a tessellation-control input.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6208433225 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6208433225). Originally posted by [Cloud-Multiplayer](https://github.com/Cloud-Multiplayer) on 2026-10-16T04:59:09Z. --- @DavidSamir the `rect-list requires finite nondegenerate axis-aligned positions with equal positive W` stop: I hit the same one after merging current `main` into 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 writes `gl_ClipDistance` (`DefineOutputs` in `SpirvMemory/SpirvEmitterHelpers.cpp`, `zeroPositionClipIndex`). A rect-list draw runs the generated tessellation control stage from `RectListShaders.cpp` after the guest vertex program. With the extra clip distance in the vertex outputs, MoltenVK hands that control stage zero positions: I wrote the three `gl_in[i].gl_Position` values 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: - zero-position clip left out of the vertex programs: no rect-list faults, and the screen clears correctly; - zero-position clip on: about 2,200 faults in 40 s, one per clear, and the cleared area keeps the previous frames. **Workaround I am using.** Skip the zero-position clip on `__APPLE__` (an `#ifdef` around the `zeroPositionClipIndex` block in `DefineOutputs`, 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_ClipDistance` in the control stage's `gl_in` block, so that both sides of the interface match. That run used a stale `vk-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 delete `shader_cache/vk-pipelines-*.bin` along with the shader cache when you test this (@jotitadev noted the same for a rebuilt MoltenVK); and the generated control stage only gets past `ShaderValidation.cpp` with `ClipDistance` allowed as a tessellation-control input. AI-assisted: yes.
Zheorgyan commented 2026-10-16 07:54:36 +00:00 (Migrated from github.com)
Author
Contributor

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6210810751 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6210810751). Originally posted by [Zheorgyan](https://github.com/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
DavidSamir commented 2026-10-16 09:51:31 +00:00 (Migrated from github.com)
Author
Contributor

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 prints re-exec: Operation not supported and exits with status 1 within 14 s. Its runtime (runtime/main.c, reserve_guest_space) reserves 0x7000000000+0x320000000 with sceKernelReserveVirtualRange as a hint (flags 0). It requires the result at exactly that address; otherwise it re-execs itself. With APS5_TRACE_MEMORY=1, three runs:

  • As built: the hint lands at 0x10000000000. MapAtOrAbove searches above the hint, and the arena's reservation of the application area covers it, so the search ends past 0xFC00000000.
  • With the three arena guards widened to __APPLE__: the title's first hinted reservation (0x2000000000+0x400000000) is placed at 0x7000000000, so the second one lands at 0x7400000000. 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 with EACCES. That still happens after mach_vm_deallocate of the region reports success, and mach_vm_map(VM_FLAGS_FIXED) then returns KERN_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 at 0x2000000000, and 0x7000000000 is 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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6212858227 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6212858227). Originally posted by [DavidSamir](https://github.com/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 prints `re-exec: Operation not supported` and exits with status 1 within 14 s. Its runtime ([`runtime/main.c`](https://github.com/mshivam019/la-ps5/blob/main/runtime/main.c), `reserve_guest_space`) reserves `0x7000000000`+`0x320000000` with `sceKernelReserveVirtualRange` as a hint (flags 0). It requires the result at exactly that address; otherwise it re-execs itself. With `APS5_TRACE_MEMORY=1`, three runs: - **As built:** the hint lands at `0x10000000000`. `MapAtOrAbove` searches above the hint, and the arena's reservation of the application area covers it, so the search ends past `0xFC00000000`. - **With the three arena guards widened to `__APPLE__`:** the title's first hinted reservation (`0x2000000000`+`0x400000000`) is placed at `0x7000000000`, so the second one lands at `0x7400000000`. 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 with `EACCES`. That still happens after `mach_vm_deallocate` of the region reports success, and `mach_vm_map(VM_FLAGS_FIXED)` then returns `KERN_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 at `0x2000000000`, and `0x7000000000` is 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
xsyetopz commented 2026-10-16 22:56:10 +00:00 (Migrated from github.com)
Author
Contributor

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_amd64 and darwin_arm64.

If anyone has the necessary tester builds, send it to me, and I'll report back with information you need, alright?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6226233718 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6226233718). Originally posted by [xsyetopz](https://github.com/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_amd64` and `darwin_arm64`. If anyone has the necessary tester builds, send it to me, and I'll report back with information you need, alright?
MarcZX10 commented 2026-10-16 23:47:40 +00:00 (Migrated from github.com)
Author
Contributor

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_arena test 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6226838173 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6226838173). Originally posted by [MarcZX10](https://github.com/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_arena` test 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.
Alexius0815 commented 2026-10-17 07:49:33 +00:00 (Migrated from github.com)
Author
Contributor

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

  • vkQuake (PPSA99010): SPIR-V requires unsupported device capability 2, the generated barycentric geometry stage;
  • ccleste (PPSA59322): 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_TessCoord as 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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6231389890 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6231389890). Originally posted by [Alexius0815](https://github.com/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): - vkQuake (PPSA99010): `SPIR-V requires unsupported device capability 2`, the generated barycentric geometry stage; - ccleste (PPSA59322): `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_TessCoord` as 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
Alexius0815 commented 2026-10-17 11:50:47 +00:00 (Migrated from github.com)
Author
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6233545859 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6233545859). Originally posted by [Alexius0815](https://github.com/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.
mugurc commented 2026-10-17 14:08:31 +00:00 (Migrated from github.com)
Author
Contributor

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 before main on both architectures, while the same segment at 0x7100000000 loads, slid by ASLR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234880351 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6234880351). Originally posted by [mugurc](https://github.com/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 before `main` on both architectures, while the same segment at 0x7100000000 loads, slid by ASLR.
DavidSamir commented 2026-10-17 21:14:52 +00:00 (Migrated from github.com)
Author
Contributor

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6241212621 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6241212621). Originally posted by [DavidSamir](https://github.com/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
DavidSamir commented 2026-10-17 21:18:05 +00:00 (Migrated from github.com)
Author
Contributor

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_TessCoord as 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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6241246808 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6241246808). Originally posted by [DavidSamir](https://github.com/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_TessCoord` as 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
Alexius0815 commented 2026-10-17 21:24:51 +00:00 (Migrated from github.com)
Author
Contributor

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6241330441 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6241330441). Originally posted by [Alexius0815](https://github.com/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
DavidSamir commented 2026-10-17 22:32:03 +00:00 (Migrated from github.com)
Author
Contributor

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 unavailable stop. 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 (no VK_EXT_provoking_vertex on Apple). I'll try that next, in the generated stages, the way #7251 does it for rect lists.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6242327072 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6242327072). Originally posted by [DavidSamir](https://github.com/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 unavailable` stop. 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 (no `VK_EXT_provoking_vertex` on Apple). I'll try that next, in the generated stages, the way #7251 does it for rect lists. AI-assisted: yes
Alexius0815 commented 2026-10-18 06:12:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Alexius0815 on 2026-10-18T06:12:52Z.


@DavidSamir thanks for #7308, and for carrying the lastVertexControl fix 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_mesh and agc_rect_list_position_invariant pass. The barycentric emulation test goes through the tessellation route.
  • vkQuake (PPSA99010): the log no longer shows the geometry shaders are unavailable / SPIR-V requires unsupported device capability 2 stop. 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.
  • ccleste (PPSA59322): with #6528's mesh fallback it still stops at the mesh-path draw (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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6246439911 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6246439911). Originally posted by [Alexius0815](https://github.com/Alexius0815) on 2026-10-18T06:12:52Z. --- @DavidSamir thanks for #7308, and for carrying the `lastVertexControl` fix 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_mesh` and `agc_rect_list_position_invariant` pass. The barycentric emulation test goes through the tessellation route. - **vkQuake (PPSA99010):** the log no longer shows the `geometry shaders are unavailable` / `SPIR-V requires unsupported device capability 2` stop. 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. - **ccleste (PPSA59322):** with #6528's mesh fallback it still stops at the mesh-path draw (`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
mugurc commented 2026-10-18 13:59:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-18T13:59:49Z.


Next from me, two small fixes for tests that main now 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 with EINVAL (guest_path_lifetime).
  • fix(libkernel): recognize listening sockets on macOS hosts. macOS has no getsockopt(SO_ACCEPTCONN), so guest_socket_options, #6950's guest_socket_connect_listening and #7140's guest_socket_events fail; proc_pidfdinfo reports the flag.

#7332 makes both changes too, among its other fixes; these are the two on their own.

precise_wait fails on macOS too. #6620 already moves its clock to CLOCK_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 main 385ed71f2 on my fork, and ci/macos-series-2 there is main with all of them.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6250791041 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6250791041). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-18T13:59:49Z. --- Next from me, two small fixes for tests that `main` now 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 with `EINVAL` (`guest_path_lifetime`). - `fix(libkernel): recognize listening sockets on macOS hosts`. macOS has no `getsockopt(SO_ACCEPTCONN)`, so `guest_socket_options`, #6950's `guest_socket_connect_listening` and #7140's `guest_socket_events` fail; `proc_pidfdinfo` reports the flag. #7332 makes both changes too, among its other fixes; these are the two on their own. `precise_wait` fails on macOS too. #6620 already moves its clock to `CLOCK_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 `main` 385ed71f2 on my fork, and `ci/macos-series-2` there is `main` with all of them.
mugurc commented 2026-10-18 14:43:20 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-18T14:43:20Z.


Four tests that main gained since yesterday fail on macOS, and #7332 already fixes each of them:

  • guest_ssl_transport_kernel and guest_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 and mbedtls_ssl_setup got no memory. #7332 hides it (a5c41edb8).
  • guest_hmd2 (#7323), and application_heap_lazy before it, give the test program process parameters by rewriting its own headers, which had no macOS path. #7332 fills the __APS5DATA,__meta section that the emulated dl_iterate_phdr reads (c6504f5ff).
  • guest_kqueue (#7092): on macOS FIONREAD on a datagram socket also counts each datagram's sender address (17 for a 1-byte datagram on an AF_UNIX pair), where SO_NREAD gives the first datagram's length as Linux's FIONREAD does. #7332 reads SO_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_hmd2 and application_heap_lazy pass 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's feat/libc-macho-image-registration, where macOS reads the process parameters, carries the same change so that its tests pass.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6251231314 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6251231314). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-18T14:43:20Z. --- Four tests that `main` gained since yesterday fail on macOS, and #7332 already fixes each of them: - `guest_ssl_transport_kernel` and `guest_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 and `mbedtls_ssl_setup` got no memory. #7332 hides it (a5c41edb8). - `guest_hmd2` (#7323), and `application_heap_lazy` before it, give the test program process parameters by rewriting its own headers, which had no macOS path. #7332 fills the `__APS5DATA,__meta` section that the emulated `dl_iterate_phdr` reads (c6504f5ff). - `guest_kqueue` (#7092): on macOS `FIONREAD` on a datagram socket also counts each datagram's sender address (17 for a 1-byte datagram on an `AF_UNIX` pair), where `SO_NREAD` gives the first datagram's length as Linux's `FIONREAD` does. #7332 reads `SO_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_hmd2` and `application_heap_lazy` pass 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's `feat/libc-macho-image-registration`, where macOS reads the process parameters, carries the same change so that its tests pass.
jotitadev commented 2026-10-18 15:57:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-18T15:57:01Z.


Two Apple GPU notes for anyone comparing macos-port GPU baselines. Setup: M2 Max, macOS 27.2 (26B5112a), x86-64 under Rosetta, macos-port @ b7eb6b6b + ImportWatched (not main), SDK MoltenVK 1.4.2 unless noted, ANYPS5_NO_SHADER_CACHE=1.

agc_driver_cross_workgroup_flag is 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.

  • It doesn't look like store visibility. In the MSL the GLC read is already atomic_load_explicit and the GLC store is a plain store. I made the coherent dword store an OpAtomicStore at 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.
  • In a local copy of the test, the reader stores the iteration at which it saw the flag. In good streaks it sees the flag after about 500-6000 iterations, sometimes 160k-900k. In bad streaks it doesn't see it even with the limit raised from 1M to 6M. The flag is always 1 at the end.
  • So the writing workgroup is sometimes not scheduled while the other one spins. The test relies on forward progress between workgroups, which neither Vulkan nor Metal guarantees. I'd count it as a flaky test on Apple, not as a regression from a PR.

agc_driver_pixel_interlock has a second blocker after the argument-buffer one. With MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=0 the raster_order_group compile 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).

  • In that draw the counters are read and written through BDA pointers. SPIRV-Cross only puts raster_order_group on descriptor-bound buffers, so the fault shader's MSL has no raster_order_group at all, and Metal doesn't order its read-modify-writes.
  • The plain draw's counter buffer is descriptor-bound. It gets raster_order_group(0) and passes.
  • So fixing the argument-buffer case alone (@shanto462) won't make the test pass on Apple: the BDA half needs device memory that Metal can order, or a skip on MoltenVK.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6251974545 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6251974545). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-18T15:57:01Z. --- Two Apple GPU notes for anyone comparing `macos-port` GPU baselines. Setup: M2 Max, macOS 27.2 (26B5112a), x86-64 under Rosetta, `macos-port` @ `b7eb6b6b` + ImportWatched (not `main`), SDK MoltenVK 1.4.2 unless noted, `ANYPS5_NO_SHADER_CACHE=1`. **`agc_driver_cross_workgroup_flag` is 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. - It doesn't look like store visibility. In the MSL the GLC read is already `atomic_load_explicit` and the GLC store is a plain store. I made the coherent dword store an `OpAtomicStore` at 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. - In a local copy of the test, the reader stores the iteration at which it saw the flag. In good streaks it sees the flag after about 500-6000 iterations, sometimes 160k-900k. In bad streaks it doesn't see it even with the limit raised from 1M to 6M. The flag is always 1 at the end. - So the writing workgroup is sometimes not scheduled while the other one spins. The test relies on forward progress between workgroups, which neither Vulkan nor Metal guarantees. I'd count it as a flaky test on Apple, not as a regression from a PR. **`agc_driver_pixel_interlock` has a second blocker after the argument-buffer one.** With `MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=0` the `raster_order_group` compile 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). - In that draw the counters are read and written through BDA pointers. SPIRV-Cross only puts `raster_order_group` on descriptor-bound buffers, so the fault shader's MSL has no `raster_order_group` at all, and Metal doesn't order its read-modify-writes. - The plain draw's counter buffer is descriptor-bound. It gets `raster_order_group(0)` and passes. - So fixing the argument-buffer case alone (@shanto462) won't make the test pass on Apple: the BDA half needs device memory that Metal can order, or a skip on MoltenVK. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
DavidSamir commented 2026-10-18 19:30:28 +00:00 (Migrated from github.com)
Author
Contributor

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) on main 13e48ed29.

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 at 0x200200000 and the title creates its device. On macOS, the unhinted path in the series' MapPlaced ends in mmap(nullptr, ...), which puts it at 0x151000000, 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 before sceAgcInit.

Check. A local, env-gated change (not proposed) sends the unhinted macOS case to MapAtOrAbove(0x200000000, ...). The map then lands at 0x200000000, and seven of the ten titles select the Apple M2 device. 25 s runs, before → after:

Title Before After
Porpoise, Mario 64, SoH PPSA99320 no device device; stop at barycentric emulation on the mesh path (path=1)
Wind Waker no device device; subgroup capability 61 is unsupported for shader stage 128 (mesh)
RommPS, PSSwanStation no device device; MoltenVK output of type float4 is not compatible with a MTLPixelFormatR8Uint color attachment
Twilight Princess no device device; title's own fatal error
vkQuake, SoH PPSA99620, 2Ship no device still no device (another cause)

So 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 0x200000000 in 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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254181383 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6254181383). Originally posted by [DavidSamir](https://github.com/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`) on `main` 13e48ed29. **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 at `0x200200000` and the title creates its device. On macOS, the unhinted path in the series' `MapPlaced` ends in `mmap(nullptr, ...)`, which puts it at `0x151000000`, 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 before `sceAgcInit`. **Check.** A local, env-gated change (not proposed) sends the unhinted macOS case to `MapAtOrAbove(0x200000000, ...)`. The map then lands at `0x200000000`, and seven of the ten titles select the Apple M2 device. 25 s runs, before → after: | Title | Before | After | |---|---|---| | Porpoise, Mario 64, SoH PPSA99320 | no device | device; stop at barycentric emulation on the mesh path (`path=1`) | | Wind Waker | no device | device; `subgroup capability 61 is unsupported for shader stage 128` (mesh) | | RommPS, PSSwanStation | no device | device; MoltenVK `output of type float4 is not compatible with a MTLPixelFormatR8Uint color attachment` | | Twilight Princess | no device | device; title's own fatal error | | vkQuake, SoH PPSA99620, 2Ship | no device | still no device (another cause) | So 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 `0x200000000` in 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)
mugurc commented 2026-10-18 20:48:34 +00:00 (Migrated from github.com)
Author
Contributor

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 MapPlaced only on Linux, so on macOS a mapping without an address fell through to mmap(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-2 has had it since 18:13Z (e64c3fe9c). The heads before it (fa6d8ae0b and earlier) still have the Linux-only paths. In my runs a 16 MiB sceKernelMapDirectMemory without an address landed at 0x2_0000_0000 in five of six launches and at 0x2_00CB_0000 in the other.

The series is on main 218aa8f00. On a main that has #6160 (c34e9d855), libSceAgcDriver does not compile on macOS (MAP_FIXED_NOREPLACE in MapDriverMemory); #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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254969667 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6254969667). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-18T20:48:34Z. --- @DavidSamir thanks, that is the placement #7631 changes. Until today the series took the arena paths of `MapPlaced` only on Linux, so on macOS a mapping without an address fell through to `mmap(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-2` has had it since 18:13Z (e64c3fe9c). The heads before it (fa6d8ae0b and earlier) still have the Linux-only paths. In my runs a 16 MiB `sceKernelMapDirectMemory` without an address landed at 0x2_0000_0000 in five of six launches and at 0x2_00CB_0000 in the other. The series is on `main` 218aa8f00. On a `main` that has #6160 (c34e9d855), `libSceAgcDriver` does not compile on macOS (`MAP_FIXED_NOREPLACE` in `MapDriverMemory`); #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.
mugurc commented 2026-10-18 22:09:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-18T22:09:34Z.


Follow-up: ci/macos-series-2 is now on main ff2fc5715 (91e4eccaf, a fast-forward from e64c3fe9c, which stays reachable). For the MapDriverMemory compile error since #6160 it carries #7332's macOS case in one commit, until a fix lands on main. 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6255762211 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6255762211). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-18T22:09:34Z. --- Follow-up: `ci/macos-series-2` is now on `main` ff2fc5715 (91e4eccaf, a fast-forward from e64c3fe9c, which stays reachable). For the `MapDriverMemory` compile error since #6160 it carries #7332's macOS case in one commit, until a fix lands on `main`. 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.
jotitadev commented 2026-10-19 01:29:08 +00:00 (Migrated from github.com)
Author
Contributor

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 current main (a373e85e5), plus #6667, #6668, #6969, #7524 and the Jit.cpp / GuestMemoryLifetimeSupport.hpp parts of #7332: the full x86-64 tree builds and links on macOS with 0 errors (Apple M2 Max, Rosetta 2). ^agc with -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_f16 sign, EmitConvergentResult): ldexp_f16 ×5 and dpp16_operands.
  • 58fe1ed16 (barrier between image store and image atomic): image_cache_bits and image_texel_status. With just those 3 lines applied, both pass.

One more macOS gap outside the series: ReadProcessPrivateBytes in PerformanceOverlay.cpp reads /proc/self/status on every non-Windows host, so agc_performance_overlay_statistics fails on macOS ("the process's private memory cannot be read"). task_info(TASK_VM_INFO).phys_footprint works 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6257721201 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6257721201). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-19T01:29:08Z. --- @mugurc a data point from building your `ci/macos-series-2` (91e4eccaf) on top of current `main` (a373e85e5), plus #6667, #6668, #6969, #7524 and the `Jit.cpp` / `GuestMemoryLifetimeSupport.hpp` parts of #7332: the full x86-64 tree builds and links on macOS with 0 errors (Apple M2 Max, Rosetta 2). `^agc` with `-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_f16` sign, `EmitConvergentResult`): `ldexp_f16` ×5 and `dpp16_operands`. - 58fe1ed16 (barrier between image store and image atomic): `image_cache_bits` and `image_texel_status`. With just those 3 lines applied, both pass. One more macOS gap outside the series: `ReadProcessPrivateBytes` in `PerformanceOverlay.cpp` reads `/proc/self/status` on every non-Windows host, so `agc_performance_overlay_statistics` fails on macOS ("the process's private memory cannot be read"). `task_info(TASK_VM_INFO).phys_footprint` works 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.
jotitadev commented 2026-10-19 03:55:15 +00:00 (Migrated from github.com)
Author
Contributor

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 current main, 9 more fixtures load libvulkan.so.1 directly without VK_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/status read I mentioned) and agc_driver_pooled_buffer_range, where MoltenVK reports robustBufferAccess but 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6259295125 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6259295125). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-19T03:55:15Z. --- @mugurc another piece in the same area as your 20ee39de9a (Vulkan loader in AGC test fixtures): on current `main`, 9 more fixtures load `libvulkan.so.1` directly without `VK_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/status` read I mentioned) and `agc_driver_pooled_buffer_range`, where MoltenVK reports `robustBufferAccess` but 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.
mugurc commented 2026-10-19 07:10:03 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mugurc on 2026-10-19T07:10:03Z.


@jotitadev thanks for both runs.

  • The fixture loader branch: please open it yourself. Its nine fixtures are not among the ones feat/agc-moltenvk-device changes, and it does not need the series, so it can go to main on its own.
  • ReadProcessPrivateBytes, and the v_ldexp_f16 sign and image store/atomic barrier workarounds: #7332 has all three (phys_footprint through TASK_VM_INFO in PerformanceOverlay.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-2 is now on main c1ca83479 (0d43cff93, a fast-forward from 91e4eccaf). That main needed these changes on macOS:

  • Stdio.cpp conflicted with #6234 in sceKernelWritev and sceKernelPwritev, and GuestShmOpen.cpp with #6542; the merges keep both sides.
  • DirectMemory.cpp calls the Linux-only MapUnmappedPages from #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.
  • The new main thread stack checks of guest_kernel_stack_protect (/proc/self/exe, fork) stay Linux-only.
  • agc_shader_table_snapshot_reuse failed: 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 in Texture.cpp comes 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 on main, and guest_shm_open, which now maps a shared memory object and needs file-backed mappings, not implemented on macOS yet.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6261736076 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6261736076). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-19T07:10:03Z. --- @jotitadev thanks for both runs. - The fixture loader branch: please open it yourself. Its nine fixtures are not among the ones `feat/agc-moltenvk-device` changes, and it does not need the series, so it can go to `main` on its own. - `ReadProcessPrivateBytes`, and the `v_ldexp_f16` sign and image store/atomic barrier workarounds: #7332 has all three (`phys_footprint` through `TASK_VM_INFO` in `PerformanceOverlay.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-2` is now on `main` c1ca83479 (0d43cff93, a fast-forward from 91e4eccaf). That `main` needed these changes on macOS: - `Stdio.cpp` conflicted with #6234 in `sceKernelWritev` and `sceKernelPwritev`, and `GuestShmOpen.cpp` with #6542; the merges keep both sides. - `DirectMemory.cpp` calls the Linux-only `MapUnmappedPages` from #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. - The new main thread stack checks of `guest_kernel_stack_protect` (`/proc/self/exe`, `fork`) stay Linux-only. - `agc_shader_table_snapshot_reuse` failed: 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 in `Texture.cpp` comes 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 on `main`, and `guest_shm_open`, which now maps a shared memory object and needs file-backed mappings, not implemented on macOS yet.
imellag commented 2026-10-19 12:35:03 +00:00 (Migrated from github.com)
Author
Contributor

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 at a243f0c93, section 3 was added), and with an alternated gameplay measurement of section 3 on d0fdf30ed.

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 Release under Rosetta 2, #7332 at cac5b49c0 with the title relinked by that head's tools/macos/setup-game.sh, run-profile.sh and profile_summary.py over 10 s windows.

1. Page states on macOS: every AGC verify asks 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 at cac5b49c0.

Instruments' Time Profiler, attached with xctrace record --template 'Time Profiler' --attach <pid>, shows the x86 frames under Rosetta (sample only sees Rosetta JIT). In the menu, the queue worker (Driver::run) spent 24.3% of its samples in mach_vm_region and 2.8% in GuestWriteWatchProtection; the draw pipeline thread spent 13.6% in mach_vm_region. The callers are CheckRange from GuestShaderFields and GuestMemory::Read, CompareMapped from validateCaptured, and Accessible from MovedReadOnlyBuffers. 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 describePages never 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 before mach_vm_region, and record forgets the run if either moved. The value recorded is the protection after GuestWriteWatchProtection, so the write watch arming and disarming pages does not change it. Guest mmap, munmap and mprotect change it through GuestAllocations::Mutation and the arena's access observer, which already call ForgetPages and ForgetInaccessiblePages on macOS, because PageStates::initialize registers them whenever the arena exists.

Menu, steady windows cac5b49c0 with the change
fps 41.2 44.9
GPU ms per frame 19.4 19.4
us per draw packet 60.7 38.2
of which key/lookup/validate 29.3 15.0
of which decode 9.0 3.2
of which precheck 4.1 0.6
mach_vm_region share of all samples 10.0% 0.0%
physical footprint 7.0 GB 7.0 GB

The 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:

Gameplay cac5b49c0 with the change
fps, 16 windows with more than 200 draws per frame 19.1 22.3
fps, the same 8 windows of the route, same load 18.0 21.9
fps, heaviest window (about 1,050 to 1,100 draws per frame) 13.5 16.6
GPU ms per frame 27.4 27.5
us per draw packet 50 39
of which decode 10.8 4.2
of which key/lookup/validate 9.2 7.1
of which precheck 3.3 0.6
mach_vm_region share of all samples 6.9% 0.0%
physical footprint 10 to 12 GB 10 to 12 GB

On 54845a456 the 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' -j8 has the same 12 failures out of 787 (the 11 listed in my last comment on #7332 and agc_driver_pooled_buffer_range), and ctest -E '^agc|video_?out|flip|display' -j4 passes 798 of 798.

The change (on top of cac5b49c0; the macOS branch is the same in 845ab8c34)
diff --git a/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp b/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
index 2d7a6e0cc..c9c663263 100644
--- a/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
+++ b/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
@@ -599,7 +599,14 @@ bool describePages(std::uintptr_t address, std::size_t bytes, Emit&& emit) {
         const auto next = std::min(end, regionEnd);
         if (!emit(PageRun{cursor, next, readable, writable})) return true;
         cursor = next;
-#elif defined(__APPLE__)
+#else
+        const auto generation = GuestAllocations::GuestAllocationsGeneration_nid_postfix();
+        const auto access = pages.accessSerial.load(std::memory_order_acquire);
+        const auto recordRun = [&](std::uintptr_t next, bool readable, bool writable) {
+            constexpr auto mask = static_cast<std::uintptr_t>(PageBytes - 1);
+            pages.record(cursor & ~mask, (next + mask) & ~mask, readable, writable, generation, access);
+        };
+#ifdef __APPLE__
         auto regionBase = static_cast<mach_vm_address_t>(cursor);
         mach_vm_size_t regionSize = 0;
         vm_region_basic_info_data_64_t info{};
@@ -613,6 +620,7 @@ bool describePages(std::uintptr_t address, std::size_t bytes, Emit&& emit) {
         if (result != KERN_SUCCESS || regionSize == 0) return false;
         if (regionBase > cursor) {
             const auto gapEnd = std::min<std::uintptr_t>(end, regionBase);
+            recordRun(gapEnd, false, false);
             if (!emit(PageRun{cursor, gapEnd, false, false})) return true;
             cursor = gapEnd;
             continue;
@@ -626,15 +634,10 @@ bool describePages(std::uintptr_t address, std::size_t bytes, Emit&& emit) {
             readable = (logical & PROT_READ) != 0;
             writable = readable && (logical & PROT_WRITE) != 0;
         }
+        recordRun(next, readable, writable);
         if (!emit(PageRun{cursor, next, readable, writable})) return true;
         cursor = next;
 #else
-        const auto generation = GuestAllocations::GuestAllocationsGeneration_nid_postfix();
-        const auto access = pages.accessSerial.load(std::memory_order_acquire);
-        const auto recordRun = [&](std::uintptr_t next, bool readable, bool writable) {
-            constexpr auto mask = static_cast<std::uintptr_t>(PageBytes - 1);
-            pages.record(cursor & ~mask, (next + mask) & ~mask, readable, writable, generation, access);
-        };
         if (const int fd = HostMapping::QueryFd(); fd >= 0) {
             procmap_query query{};
             query.size = sizeof(query);
@@ -696,6 +699,7 @@ bool describePages(std::uintptr_t address, std::size_t bytes, Emit&& emit) {
             static_cast<void>(emit(PageRun{cursor, end, false, false}));
             return true;
         }
+#endif
 #endif
     }
     return true;

2. @yripper @krishalivaibhav: the strict replacement for the NoContraction helpers is in #7332

On 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, EmitFPAdd32 and EmitFPSub32 emit Fma(a, b, -0.0), Fma(1.0, a, b) and Fma(-1.0, b, a) without the decoration. Each rounds once, so it gives the plain operation's result, and the -0.0 addend 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 ^agc tests 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 cac5b49c0 against your build without NoContraction, same scenes? @krishalivaibhav, Balatro too, if you still have it set up.

3. Small allocations under Rosetta: MallocNanoZone=1

With the change from section 1, the queue worker spends 31% of its gameplay samples in malloc and free (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 unless MallocNanoZone=1 is set at launch; with it, the samples move to nanov2_*. In a loop, x86-64 under Rosetta:

default MallocNanoZone=1 native arm64, default
free + malloc, 32 to 128 bytes 21 to 22 ns 15 ns 15 to 20 ns
free + malloc, 256 bytes 41 ns 16 ns 13 ns
freed on another thread, 32 to 256 bytes 35 to 85 ns 10 to 16 ns 7 to 19 ns

Lana 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.py presses 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):

without with
gameplay on d0fdf30ed, fps 24.76, 24.79 26.60, 26.69
same runs: us per draw packet on the queue worker 36.6, 36.1 30.7, 31.1
same runs: us per draw on the draw pipeline thread 23.9, 23.4 22.6, 22.5
same runs: physical footprint 9.9 GB 9.9 GB
menu on cac5b49c0, two traced runs: queue worker in the allocator 25.3% 21.3%
same traces: draw pipeline thread in the allocator 18.2% 9.6%

On cac5b49c0, ctest -R '^agc' and ctest -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 is tools/macos/run.sh (export MallocNanoZone=1, which run-profile.sh inherits) and a line in docs/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 recordRun above 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 on cac5b49c0; MallocNanoZone=1 while 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 rewrites fma(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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6267332738 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6267332738). Originally posted by [imellag](https://github.com/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 at `a243f0c93`, section 3 was added), and with an alternated gameplay measurement of section 3 on `d0fdf30ed`.* 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 `Release` under Rosetta 2, #7332 at `cac5b49c0` with the title relinked by that head's `tools/macos/setup-game.sh`, `run-profile.sh` and `profile_summary.py` over 10 s windows. ### 1. Page states on macOS: every AGC `verify` asks 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 at `cac5b49c0`. Instruments' Time Profiler, attached with `xctrace record --template 'Time Profiler' --attach <pid>`, shows the x86 frames under Rosetta (`sample` only sees `Rosetta JIT`). In the menu, the queue worker (`Driver::run`) spent 24.3% of its samples in `mach_vm_region` and 2.8% in `GuestWriteWatchProtection`; the draw pipeline thread spent 13.6% in `mach_vm_region`. The callers are `CheckRange` from `GuestShaderFields` and `GuestMemory::Read`, `CompareMapped` from `validateCaptured`, and `Accessible` from `MovedReadOnlyBuffers`. 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 `describePages` never 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 before `mach_vm_region`, and `record` forgets the run if either moved. The value recorded is the protection after `GuestWriteWatchProtection`, so the write watch arming and disarming pages does not change it. Guest `mmap`, `munmap` and `mprotect` change it through `GuestAllocations::Mutation` and the arena's access observer, which already call `ForgetPages` and `ForgetInaccessiblePages` on macOS, because `PageStates::initialize` registers them whenever the arena exists. | Menu, steady windows | `cac5b49c0` | with the change | |---|---|---| | fps | 41.2 | 44.9 | | GPU ms per frame | 19.4 | 19.4 | | us per draw packet | 60.7 | 38.2 | | of which `key/lookup/validate` | 29.3 | 15.0 | | of which `decode` | 9.0 | 3.2 | | of which `precheck` | 4.1 | 0.6 | | `mach_vm_region` share of all samples | 10.0% | 0.0% | | physical footprint | 7.0 GB | 7.0 GB | The 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: | Gameplay | `cac5b49c0` | with the change | |---|---|---| | fps, 16 windows with more than 200 draws per frame | 19.1 | 22.3 | | fps, the same 8 windows of the route, same load | 18.0 | 21.9 | | fps, heaviest window (about 1,050 to 1,100 draws per frame) | 13.5 | 16.6 | | GPU ms per frame | 27.4 | 27.5 | | us per draw packet | 50 | 39 | | of which `decode` | 10.8 | 4.2 | | of which `key/lookup/validate` | 9.2 | 7.1 | | of which `precheck` | 3.3 | 0.6 | | `mach_vm_region` share of all samples | 6.9% | 0.0% | | physical footprint | 10 to 12 GB | 10 to 12 GB | On `54845a456` the 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' -j8` has the same 12 failures out of 787 (the 11 listed in my last comment on #7332 and `agc_driver_pooled_buffer_range`), and `ctest -E '^agc|video_?out|flip|display' -j4` passes 798 of 798. <details><summary>The change (on top of cac5b49c0; the macOS branch is the same in 845ab8c34)</summary> ```diff diff --git a/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp b/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp index 2d7a6e0cc..c9c663263 100644 --- a/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp +++ b/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp @@ -599,7 +599,14 @@ bool describePages(std::uintptr_t address, std::size_t bytes, Emit&& emit) { const auto next = std::min(end, regionEnd); if (!emit(PageRun{cursor, next, readable, writable})) return true; cursor = next; -#elif defined(__APPLE__) +#else + const auto generation = GuestAllocations::GuestAllocationsGeneration_nid_postfix(); + const auto access = pages.accessSerial.load(std::memory_order_acquire); + const auto recordRun = [&](std::uintptr_t next, bool readable, bool writable) { + constexpr auto mask = static_cast<std::uintptr_t>(PageBytes - 1); + pages.record(cursor & ~mask, (next + mask) & ~mask, readable, writable, generation, access); + }; +#ifdef __APPLE__ auto regionBase = static_cast<mach_vm_address_t>(cursor); mach_vm_size_t regionSize = 0; vm_region_basic_info_data_64_t info{}; @@ -613,6 +620,7 @@ bool describePages(std::uintptr_t address, std::size_t bytes, Emit&& emit) { if (result != KERN_SUCCESS || regionSize == 0) return false; if (regionBase > cursor) { const auto gapEnd = std::min<std::uintptr_t>(end, regionBase); + recordRun(gapEnd, false, false); if (!emit(PageRun{cursor, gapEnd, false, false})) return true; cursor = gapEnd; continue; @@ -626,15 +634,10 @@ bool describePages(std::uintptr_t address, std::size_t bytes, Emit&& emit) { readable = (logical & PROT_READ) != 0; writable = readable && (logical & PROT_WRITE) != 0; } + recordRun(next, readable, writable); if (!emit(PageRun{cursor, next, readable, writable})) return true; cursor = next; #else - const auto generation = GuestAllocations::GuestAllocationsGeneration_nid_postfix(); - const auto access = pages.accessSerial.load(std::memory_order_acquire); - const auto recordRun = [&](std::uintptr_t next, bool readable, bool writable) { - constexpr auto mask = static_cast<std::uintptr_t>(PageBytes - 1); - pages.record(cursor & ~mask, (next + mask) & ~mask, readable, writable, generation, access); - }; if (const int fd = HostMapping::QueryFd(); fd >= 0) { procmap_query query{}; query.size = sizeof(query); @@ -696,6 +699,7 @@ bool describePages(std::uintptr_t address, std::size_t bytes, Emit&& emit) { static_cast<void>(emit(PageRun{cursor, end, false, false})); return true; } +#endif #endif } return true; ``` </details> ### 2. @yripper @krishalivaibhav: the strict replacement for the `NoContraction` helpers is in #7332 On 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`, `EmitFPAdd32` and `EmitFPSub32` emit `Fma(a, b, -0.0)`, `Fma(1.0, a, b)` and `Fma(-1.0, b, a)` without the decoration. Each rounds once, so it gives the plain operation's result, and the `-0.0` addend 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 `^agc` tests 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 `cac5b49c0` against your build without `NoContraction`, same scenes? @krishalivaibhav, Balatro too, if you still have it set up. ### 3. Small allocations under Rosetta: `MallocNanoZone=1` With the change from section 1, the queue worker spends 31% of its gameplay samples in `malloc` and `free` (`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 unless `MallocNanoZone=1` is set at launch; with it, the samples move to `nanov2_*`. In a loop, x86-64 under Rosetta: | | default | `MallocNanoZone=1` | native arm64, default | |---|---|---|---| | `free` + `malloc`, 32 to 128 bytes | 21 to 22 ns | 15 ns | 15 to 20 ns | | `free` + `malloc`, 256 bytes | 41 ns | 16 ns | 13 ns | | freed on another thread, 32 to 256 bytes | 35 to 85 ns | 10 to 16 ns | 7 to 19 ns | Lana 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.py` presses 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): | | without | with | |---|---|---| | gameplay on `d0fdf30ed`, fps | 24.76, 24.79 | 26.60, 26.69 | | same runs: us per draw packet on the queue worker | 36.6, 36.1 | 30.7, 31.1 | | same runs: us per draw on the draw pipeline thread | 23.9, 23.4 | 22.6, 22.5 | | same runs: physical footprint | 9.9 GB | 9.9 GB | | menu on `cac5b49c0`, two traced runs: queue worker in the allocator | 25.3% | 21.3% | | same traces: draw pipeline thread in the allocator | 18.2% | 9.6% | On `cac5b49c0`, `ctest -R '^agc'` and `ctest -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 is `tools/macos/run.sh` (`export MallocNanoZone=1`, which `run-profile.sh` inherits) and a line in `docs/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 `recordRun` above 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 on `cac5b49c0`; `MallocNanoZone=1` while 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 rewrites `fma(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.
011010 commented 2026-10-19 17:42:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-19T17:42:08Z.


Taking the pixel_interlock case 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_interlock case up and will open a PR to main; this is the announcement, per the practice in this thread.

Environment

  • Apple M4 (Mac mini, 24 GB), macOS 27.0.1 (26A434), x86-64 under Rosetta 2.
  • Apple clang 21.0.0, CMake 4.4.4, Ninja 1.13.2.
  • LunarG Vulkan SDK 1.4.363.0 (MoltenVK 1.4.2), with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LAYER_PATH set so the layer is really inserted (the loader silently ignores a missing layer otherwise).
  • mugurc/ci/macos-series-2 at a0a9e8398, plus the Jit.cpp and GuestMemoryLifetimeSupport.hpp parts of #7332, as @jotitadev did on 2026-10-19: the series does not build on macOS without them (MFD_CLOEXEC is Linux-only in libkernel/DirectMemory/Jit.cpp).

What I measure with ctest --test-dir build -R agc_driver_pixel_interlock -V on the port tree

  • Before the change: it fails. AGC graphics: vkCreateGraphicsPipelines: Vulkan result -3, after MoltenVK reports
    type '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. 0 VUID- errors from the validation layer.
  • After the change: it skips, with skipped, the device does not support atomics on buffer device addresses. 0 VUID- 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 (OpConvertUToPtr over a PhysicalStorageBuffer pointer), 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 excludes VK_DRIVER_ID_MOLTENVK in a BdaAtomicsUsable helper, the same shape as RobustBufferAccess2Usable and FragmentShaderBarycentricUsable, and agc_driver_pixel_interlock skips there instead of failing. The technical-debt entry records the limitation.

Why no other test catches it. agc_driver_global_atomics gives 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_interlock is 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_group is 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::Range carries 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 main and the change measurements side by side.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6273443618 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6273443618). Originally posted by [011010](https://github.com/011010) on 2026-10-19T17:42:08Z. --- **Taking the `pixel_interlock` case 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_interlock` case up and will open a PR to `main`; this is the announcement, per the practice in this thread. **Environment** - Apple M4 (Mac mini, 24 GB), macOS 27.0.1 (26A434), x86-64 under Rosetta 2. - Apple clang 21.0.0, CMake 4.4.4, Ninja 1.13.2. - LunarG Vulkan SDK 1.4.363.0 (MoltenVK 1.4.2), with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and `VK_LAYER_PATH` set so the layer is really inserted (the loader silently ignores a missing layer otherwise). - `mugurc/ci/macos-series-2` at `a0a9e8398`, plus the `Jit.cpp` and `GuestMemoryLifetimeSupport.hpp` parts of #7332, as @jotitadev did on 2026-10-19: the series does not build on macOS without them (`MFD_CLOEXEC` is Linux-only in `libkernel/DirectMemory/Jit.cpp`). **What I measure with `ctest --test-dir build -R agc_driver_pixel_interlock -V` on the port tree** - **Before the change: it fails.** `AGC graphics: vkCreateGraphicsPipelines: Vulkan result -3`, after MoltenVK reports `type '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. 0 `VUID-` errors from the validation layer. - **After the change: it skips**, with `skipped, the device does not support atomics on buffer device addresses`. 0 `VUID-` 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 (`OpConvertUToPtr` over a `PhysicalStorageBuffer` pointer), 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 excludes `VK_DRIVER_ID_MOLTENVK` in a `BdaAtomicsUsable` helper, the same shape as `RobustBufferAccess2Usable` and `FragmentShaderBarycentricUsable`, and `agc_driver_pixel_interlock` skips there instead of failing. The technical-debt entry records the limitation. **Why no other test catches it.** `agc_driver_global_atomics` gives 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_interlock` is 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_group` is 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::Range` carries 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 `main` and the change measurements side by side.
mugurc commented 2026-10-19 20:55:57 +00:00 (Migrated from github.com)
Author
Contributor

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-pages now records the macOS page runs in the page-state table as you proposed (b73bddb1a, with you as co-author). ci/macos-series-2 has it (b84909f34, a fast-forward from a0a9e8398) and is now on main 9127ea36d.

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 ^agc and Lana runs are the evidence for it.

For anyone building the series on today's main:

  • #6914's QueuedIndexReadOrder.cpp does not compile on macOS. It applies reinterpret_cast<std::uint64_t> to a std::uintptr_t, which are different types there (unsigned long and unsigned long long). static_cast compiles; ci/macos-series-2 carries that as its own commit (b84909f34) until main has a fix.
  • Five tests that main added 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_backtrace and unwind_callback_abi_forced_unwind (#6851): "_Unwind_Backtrace stops when the callback asks" and "_Unwind_ForcedUnwind calls the stop function once".
    • guest_bad_optional_access (#7872): the exception reaches terminate.
  • #6928 was closed, so the JIT shared memory change that macOS needs to build is now #7937.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6277132790 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6277132790). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-19T20:55:57Z. --- @imellag thank you for the profile and the change. `feat/agc-macos-guest-pages` now records the macOS page runs in the page-state table as you proposed (b73bddb1a, with you as co-author). `ci/macos-series-2` has it (b84909f34, a fast-forward from a0a9e8398) and is now on `main` 9127ea36d. 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 `^agc` and Lana runs are the evidence for it. For anyone building the series on today's `main`: - #6914's `QueuedIndexReadOrder.cpp` does not compile on macOS. It applies `reinterpret_cast<std::uint64_t>` to a `std::uintptr_t`, which are different types there (`unsigned long` and `unsigned long long`). `static_cast` compiles; `ci/macos-series-2` carries that as its own commit (b84909f34) until `main` has a fix. - Five tests that `main` added 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_backtrace` and `unwind_callback_abi_forced_unwind` (#6851): "`_Unwind_Backtrace` stops when the callback asks" and "`_Unwind_ForcedUnwind` calls the stop function once". - `guest_bad_optional_access` (#7872): the exception reaches `terminate`. - #6928 was closed, so the JIT shared memory change that macOS needs to build is now #7937.
Cloud-Multiplayer commented 2026-10-20 01:43:13 +00:00 (Migrated from github.com)
Author
Contributor

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 SIGSEGV and SIGBUS blocked 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 current main merged (the libkernel and write watch code involved is the same as on main).

Symptom. A title stopped after about 30 submits with no frame. Its render thread sat on one store into guest memory (a memcpy into its constant ring, another time Agc::Command::PatchIndirectCount). com.apple.rosetta.exceptionserver was 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. scePthreadCreate blocks every signal around pthread_create (sigfillset, SIG_BLOCK, then SIG_SETMASK back to the creator's mask), and the new thread restores the creator's mask in RunThread. In my runs the title's main thread ended up with all signals blocked (0xfffefeff), and every thread it created afterwards inherited that mask through creatorMask: the render thread, and the AGC driver thread that Driver::enqueue starts 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:

  • Rosetta opens the page itself and the store completes without a signal. The watch never records the write, and the GPU keeps the old bytes. I checked this directly: a store of the same value back into an armed constant-buffer page delivered 0 faults and left the page read/write. (macOS reports these faults as SIGBUS, not SIGSEGV.)
  • Or the exception server retries the store forever, which is the stall above.

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

@@ RunThread
-    pthread_sigmask(SIG_SETMASK, &signalMask, nullptr);
+#ifdef __APPLE__
+    sigset_t hostMask = signalMask;
+    for (const int fault : {SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP}) sigdelset(&hostMask, fault);
+    pthread_sigmask(SIG_SETMASK, &hostMask, nullptr);
+#else
+    pthread_sigmask(SIG_SETMASK, &signalMask, nullptr);
+#endif
@@ scePthreadCreate
         sigfillset(&allSignals);
+#ifdef __APPLE__
+        for (const int fault : {SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP}) sigdelset(&allSignals, fault);
+#endif
         pthread_sigmask(SIG_BLOCK, &allSignals, nullptr);

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6281355607 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6281355607). Originally posted by [Cloud-Multiplayer](https://github.com/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 `SIGSEGV` and `SIGBUS` blocked 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 current `main` merged (the libkernel and write watch code involved is the same as on `main`). **Symptom.** A title stopped after about 30 submits with no frame. Its render thread sat on one store into guest memory (a `memcpy` into its constant ring, another time `Agc::Command::PatchIndirectCount`). `com.apple.rosetta.exceptionserver` was 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.** `scePthreadCreate` blocks every signal around `pthread_create` (`sigfillset`, `SIG_BLOCK`, then `SIG_SETMASK` back to the creator's mask), and the new thread restores the creator's mask in `RunThread`. In my runs the title's main thread ended up with all signals blocked (`0xfffefeff`), and every thread it created afterwards inherited that mask through `creatorMask`: the render thread, and the AGC driver thread that `Driver::enqueue` starts 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: - Rosetta opens the page itself and the store completes without a signal. The watch never records the write, and the GPU keeps the old bytes. I checked this directly: a store of the same value back into an armed constant-buffer page delivered 0 faults and left the page read/write. (macOS reports these faults as `SIGBUS`, not `SIGSEGV`.) - Or the exception server retries the store forever, which is the stall above. 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): ```diff @@ RunThread - pthread_sigmask(SIG_SETMASK, &signalMask, nullptr); +#ifdef __APPLE__ + sigset_t hostMask = signalMask; + for (const int fault : {SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP}) sigdelset(&hostMask, fault); + pthread_sigmask(SIG_SETMASK, &hostMask, nullptr); +#else + pthread_sigmask(SIG_SETMASK, &signalMask, nullptr); +#endif @@ scePthreadCreate sigfillset(&allSignals); +#ifdef __APPLE__ + for (const int fault : {SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP}) sigdelset(&allSignals, fault); +#endif pthread_sigmask(SIG_BLOCK, &allSignals, nullptr); ``` **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.
krishalivaibhav commented 2026-10-20 17:53:21 +00:00 (Migrated from github.com)
Author
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6297477946 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6297477946). Originally posted by [krishalivaibhav](https://github.com/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.
Mauro42K commented 2026-10-20 19:08:48 +00:00 (Migrated from github.com)
Author
Contributor

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:

  • Reproducing and validating macOS issues on M1 hardware.
  • Testing focused pull requests and identifying regressions.
  • Helping with automated tests, build problems, and smaller code fixes.

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!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6298998113 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6298998113). Originally posted by [Mauro42K](https://github.com/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: - Reproducing and validating macOS issues on M1 hardware. - Testing focused pull requests and identifying regressions. - Helping with automated tests, build problems, and smaller code fixes. 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!
imellag commented 2026-10-20 19:31:46 +00:00 (Migrated from github.com)
Author
Contributor

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.

  • #8578 runs the existing f32 denormal flush probe on MoltenVK too. At startup it compares 5472 results of the GPU's own flush with the emulated one and switches the shaders to the GPU's flush only if none differ. On the M4 Pro: hardware (0 of 5472 probe results differ from the emulated flush).
  • #8612 emits exact f32 add, subtract and multiply as fma on MoltenVK instead of SPIRV-Cross's optnone helper calls. The new agc_driver_f32_separate_rounding fails if Metal fuses a multiply into the add after it.

main does not build the libraries on macOS yet, so the branch imellag:test/m1-probe-fma has both on top of mugurc's ci/macos-series-2 plus #7937 (needed for libkernel) and #8477, as three commits to test in turn:

commit what
2bfbc2fcf base
a4a16a6f8 + #8578
42c3fd09a + #8612 (ported to the series' older request serialization; not for merging)

Steps (Vulkan SDK from LunarG installed under ~/VulkanSDK):

git clone --branch test/m1-probe-fma https://github.com/imellag/AnyPS5.git && cd AnyPS5
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DBUILD_TESTING=ON
sdk=$(ls -d ~/VulkanSDK/*/macOS | tail -1)
for c in 2bfbc2fcf a4a16a6f8 42c3fd09a; do
  git checkout -q $c && ninja -C build -k 0 > build-$c.log 2>&1
  DYLD_LIBRARY_PATH=$sdk/lib VK_DRIVER_FILES=$sdk/share/vulkan/icd.d/MoltenVK_icd.json \
    ctest --test-dir build -R '^(agc|shader)' -j8 --timeout 600 > ctest-$c.log 2>&1
  cp build/Testing/Temporary/LastTest.log lasttest-$c.log
done

guest_math_tests does not compile on macOS (libc++ has no std::cyl_bessel_j); that one build failure is expected. Set DYLD_LIBRARY_PATH in front of the command as above, not through env, which macOS strips it from.

What would help, posted on #8578 and #8612:

  • the list of failed tests at each commit (the end of ctest-<commit>.log);
  • the [float-controls] lines in lasttest-a4a16a6f8.log (grep float-controls);
  • whether agc_driver_f32_separate_rounding, agc_driver_f32_arithmetic_nan and agc_driver_f32_denormal_flush pass at 42c3fd09a, 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 commit f32_separate_rounding and f32_arithmetic_nan pass and f32_denormal_flush stops at lane 8 (v_fma_f32), a case neither PR touches.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6299537843 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6299537843). Originally posted by [imellag](https://github.com/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. - #8578 runs the existing f32 denormal flush probe on MoltenVK too. At startup it compares 5472 results of the GPU's own flush with the emulated one and switches the shaders to the GPU's flush only if none differ. On the M4 Pro: `hardware (0 of 5472 probe results differ from the emulated flush)`. - #8612 emits exact f32 add, subtract and multiply as `fma` on MoltenVK instead of SPIRV-Cross's `optnone` helper calls. The new `agc_driver_f32_separate_rounding` fails if Metal fuses a multiply into the add after it. `main` does not build the libraries on macOS yet, so the branch [`imellag:test/m1-probe-fma`](https://github.com/imellag/AnyPS5/tree/test/m1-probe-fma) has both on top of mugurc's `ci/macos-series-2` plus #7937 (needed for libkernel) and #8477, as three commits to test in turn: | commit | what | |---|---| | `2bfbc2fcf` | base | | `a4a16a6f8` | + #8578 | | `42c3fd09a` | + #8612 (ported to the series' older request serialization; not for merging) | Steps (Vulkan SDK from LunarG installed under `~/VulkanSDK`): ```sh git clone --branch test/m1-probe-fma https://github.com/imellag/AnyPS5.git && cd AnyPS5 git submodule update --init --recursive cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DBUILD_TESTING=ON sdk=$(ls -d ~/VulkanSDK/*/macOS | tail -1) for c in 2bfbc2fcf a4a16a6f8 42c3fd09a; do git checkout -q $c && ninja -C build -k 0 > build-$c.log 2>&1 DYLD_LIBRARY_PATH=$sdk/lib VK_DRIVER_FILES=$sdk/share/vulkan/icd.d/MoltenVK_icd.json \ ctest --test-dir build -R '^(agc|shader)' -j8 --timeout 600 > ctest-$c.log 2>&1 cp build/Testing/Temporary/LastTest.log lasttest-$c.log done ``` `guest_math_tests` does not compile on macOS (libc++ has no `std::cyl_bessel_j`); that one build failure is expected. Set `DYLD_LIBRARY_PATH` in front of the command as above, not through `env`, which macOS strips it from. What would help, posted on #8578 and #8612: - the list of failed tests at each commit (the end of `ctest-<commit>.log`); - the `[float-controls]` lines in `lasttest-a4a16a6f8.log` (`grep float-controls`); - whether `agc_driver_f32_separate_rounding`, `agc_driver_f32_arithmetic_nan` and `agc_driver_f32_denormal_flush` pass at `42c3fd09a`, 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 commit `f32_separate_rounding` and `f32_arithmetic_nan` pass and `f32_denormal_flush` stops at lane 8 (`v_fma_f32`), a case neither PR touches. AI-assisted: yes
Alexius0815 commented 2026-10-20 20:59:39 +00:00 (Migrated from github.com)
Author
Contributor

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. sample on the guest during the "frozen" first start shows the AGC driver thread in vkCreateComputePipelines → MVKMetalCompiler::compile for 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 through MTLDevice (the same MTLCompilerService MoltenVK uses, no Xcode needed):

phase time
newLibraryWithSource 11.0 s (cold)
newFunctionWithName:constantValues: 4.5–5.1 s
newComputePipelineStateWithFunction 64–81 s

On 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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6301362283 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6301362283). Originally posted by [Alexius0815](https://github.com/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. `sample` on the guest during the "frozen" first start shows the AGC driver thread in `vkCreateComputePipelines` → `MVKMetalCompiler::compile` for 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 through `MTLDevice` (the same `MTLCompilerService` MoltenVK uses, no Xcode needed): | phase | time | | --- | --- | | `newLibraryWithSource` | 11.0 s (cold) | | `newFunctionWithName:constantValues:` | 4.5–5.1 s | | `newComputePipelineStateWithFunction` | 64–81 s | On 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
Mauro42K commented 2026-10-21 00:34:44 +00:00 (Migrated from github.com)
Author
Contributor

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!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6305008174 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6305008174). Originally posted by [Mauro42K](https://github.com/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: - **#8578:** [[M1 probe results](https://github.com/boykopovar/AnyPS5/pull/8578#issuecomment-6304807982)](https://github.com/boykopovar/AnyPS5/pull/8578#issuecomment-6304807982) - **#8612:** [[M1 shader test results](https://github.com/boykopovar/AnyPS5/pull/8612#issuecomment-6304811351)](https://github.com/boykopovar/AnyPS5/pull/8612#issuecomment-6304811351) 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!
tkcm01 commented 2026-10-21 06:14:02 +00:00 (Migrated from github.com)
Author
Contributor

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-2 at 53db0badb with #7524, the code commits of #7937 and the libSceSsl change from #7332: ctest -j4 gives 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_wait and guest_refused_connect (pass alone). All of these are on the list in #7631; guest_jit_shared_memory, guest_socket_read_write and guest_kqueue from that list pass here.

guest_standard_streams is fixed by #8920 (the macOS fflush guard, split out of #7201). I'm not taking any of the others without asking here first.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309407867 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6309407867). Originally posted by [tkcm01](https://github.com/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-2` at 53db0badb with #7524, the code commits of #7937 and the libSceSsl change from #7332: `ctest -j4` gives 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_wait` and `guest_refused_connect` (pass alone). All of these are on the list in #7631; `guest_jit_shared_memory`, `guest_socket_read_write` and `guest_kqueue` from that list pass here. `guest_standard_streams` is fixed by #8920 (the macOS `fflush` guard, split out of #7201). I'm not taking any of the others without asking here first. AI-assisted: yes
krishalivaibhav commented 2026-10-21 07:57:35 +00:00 (Migrated from github.com)
Author
Contributor

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6311022405 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6311022405). Originally posted by [krishalivaibhav](https://github.com/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.
krishalivaibhav commented 2026-10-21 08:22:04 +00:00 (Migrated from github.com)
Author
Contributor

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 nonempty DRAW_INDEX_2 (count=max_size=6) at misaligned base 0x2c4eb7c6a, 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 advertised VK_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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6311453542 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6311453542). Originally posted by [krishalivaibhav](https://github.com/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 nonempty `DRAW_INDEX_2` (count=max_size=6) at misaligned base `0x2c4eb7c6a`, 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 advertised `VK_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.
Gonic0 commented 2026-10-21 17:08:30 +00:00 (Migrated from github.com)
Author
Contributor

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_net as a stable failure. I hit the same thing and traced it to two spots where XNU behaves differently from FreeBSD:

  • macOS's inet_pton accepts "01.2.3.4", while FreeBSD refuses a leading zero.
  • socket(AF_INET, SOCK_STREAM, IPPROTO_UDP) fails with EPROTOTYPE on XNU instead of EPROTONOSUPPORT.

#9231 fixes both behind #ifdef __APPLE__. Here guest_sce_net passes 5 runs out of 5 with it, and without each commit it fails at GuestSceNet.cpp:786 and :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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6321881044 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6321881044). Originally posted by [Gonic0](https://github.com/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_net` as a stable failure. I hit the same thing and traced it to two spots where XNU behaves differently from FreeBSD: - macOS's `inet_pton` accepts `"01.2.3.4"`, while FreeBSD refuses a leading zero. - `socket(AF_INET, SOCK_STREAM, IPPROTO_UDP)` fails with `EPROTOTYPE` on XNU instead of `EPROTONOSUPPORT`. #9231 fixes both behind `#ifdef __APPLE__`. Here `guest_sce_net` passes 5 runs out of 5 with it, and without each commit it fails at `GuestSceNet.cpp:786` and `: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
Mauro42K commented 2026-10-21 19:38:03 +00:00 (Migrated from github.com)
Author
Contributor

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_net five 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.

  • Run times: 4.39, 1.34, 1.29, 1.31, 1.33 seconds.
  • Tested commit: e0a3ccec02434abbd104a3c7a6141cece68b1533 from #8658.
  • Vulkan SDK 1.4.363.0 / MoltenVK 1.4.2 were available and verified, although this network test does not use Vulkan.

This commit already includes both libSceNet fixes 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!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6324860970 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6324860970). Originally posted by [Mauro42K](https://github.com/Mauro42K) on 2026-10-21T19:38:03Z. --- Hi @Gonic0 — thanks for suggesting this M1 check! I ran `guest_sce_net` five 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. - Run times: 4.39, 1.34, 1.29, 1.31, 1.33 seconds. - Tested commit: `e0a3ccec02434abbd104a3c7a6141cece68b1533` from #8658. - Vulkan SDK 1.4.363.0 / MoltenVK 1.4.2 were available and verified, although this network test does not use Vulkan. This commit already includes both `libSceNet` fixes 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!
Alexius0815 commented 2026-10-21 20:51:59 +00:00 (Migrated from github.com)
Author
Contributor

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), newComputePipelineStateWithFunction for 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. With MTLLibraryOptimizationLevelSize it takes 66.2 s. In a guarded title run with warm AnyPS5 shader and pipeline caches (16 of 17 shaders hit), sample at 15 s still shows the AGC driver thread in VulkanDevice::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 reports the 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 to vkWaitForFences returning -4 (device lost). The game then shows Quake Error: vkWaitForFences failed with code -4 and exits with status 1. The host process itself can end with status 0, which hides this unless you read trace.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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6326288284 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6326288284). Originally posted by [Alexius0815](https://github.com/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), `newComputePipelineStateWithFunction` for 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. With `MTLLibraryOptimizationLevelSize` it takes 66.2 s. In a guarded title run with warm AnyPS5 shader and pipeline caches (16 of 17 shaders hit), `sample` at 15 s still shows the AGC driver thread in `VulkanDevice::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 reports `the 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 to `vkWaitForFences` returning `-4` (device lost). The game then shows `Quake Error: vkWaitForFences failed with code -4` and exits with status 1. The host process itself can end with status 0, which hides this unless you read `trace.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
011010 commented 2026-10-21 23:53:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-21T23:53:08Z.


Taking guest_poll on 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 53db0badb plus the Jit.cpp part of #7937 (the series still does not build on macOS without it), Apple M4, macOS 27.0.1, x86-64 under Rosetta:

  • Of mugurc's five, three pass now: guest_floating_point, guest_time_conversion and guest_bad_optional_access. The remaining two are guest_itimer and guest_poll.
  • guest_poll fails at its out-of-band case: a peer sends one byte with MSG_OOB, the guest polls for POLLPRI, and the poll returns 0 with no events. The same test passes on Linux with lavapipe.
  • guest_itimer fails 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 poll never reports POLLPRI for out-of-band data: with a byte pending, poll(POLLPRI) returns 0 and revents stays 0, while select's exception set reports the socket once the segment has arrived. SIOCATMARK is 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, POLLPRI comes from select'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 from poll, and Linux and Windows are untouched.

Verified

  • macOS, series head + #7937's Jit.cpp + this change: guest_poll passes, and the other fifteen socket, TCP, UDP and poll tests pass. guest_socket_pair fails with and without the change, which is the pre-existing SOCK_SEQPACKET gap the technical-debt entry already records.
  • Linux, lavapipe: guest_poll passes 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 main and the change measurements side by side. It overlaps poll_nid_postfix textually with #7605 (kqueue polling, which restructures the same wait) and #8483 (a Windows collect change), so the order is the maintainers' call and I will rebase on whichever lands first.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329190558 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6329190558). Originally posted by [011010](https://github.com/011010) on 2026-10-21T23:53:08Z. --- **Taking `guest_poll` on 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 `53db0badb` plus the `Jit.cpp` part of #7937 (the series still does not build on macOS without it), Apple M4, macOS 27.0.1, x86-64 under Rosetta: - Of mugurc's five, three pass now: `guest_floating_point`, `guest_time_conversion` and `guest_bad_optional_access`. The remaining two are `guest_itimer` and `guest_poll`. - `guest_poll` fails at its out-of-band case: a peer sends one byte with `MSG_OOB`, the guest polls for `POLLPRI`, and the poll returns 0 with no events. The same test passes on Linux with lavapipe. - `guest_itimer` fails 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 `poll` never reports `POLLPRI` for out-of-band data: with a byte pending, `poll(POLLPRI)` returns 0 and `revents` stays 0, while `select`'s exception set reports the socket once the segment has arrived. `SIOCATMARK` is 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, `POLLPRI` comes from `select`'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 from `poll`, and Linux and Windows are untouched. **Verified** - macOS, series head + #7937's `Jit.cpp` + this change: `guest_poll` passes, and the other fifteen socket, TCP, UDP and poll tests pass. `guest_socket_pair` fails with and without the change, which is the pre-existing `SOCK_SEQPACKET` gap the technical-debt entry already records. - Linux, lavapipe: `guest_poll` passes 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 `main` and the change measurements side by side. It overlaps `poll_nid_postfix` textually with #7605 (kqueue polling, which restructures the same wait) and #8483 (a Windows `collect` change), so the order is the maintainers' call and I will rebase on whichever lands first.
Gonic0 commented 2026-10-21 23:54:39 +00:00 (Migrated from github.com)
Author
Contributor

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 in core/libs/prx/libSceNet/Export.cpp (the leading-zero check in sceNetInetPton and the EPROTOTYPE mapping in sceNetSocket) and run guest_sce_net again. On my M5 Pro it aborts at GuestSceNet.cpp:786 without the first and at :151 without 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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329210520 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6329210520). Originally posted by [Gonic0](https://github.com/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 in `core/libs/prx/libSceNet/Export.cpp` (the leading-zero check in `sceNetInetPton` and the `EPROTOTYPE` mapping in `sceNetSocket`) and run `guest_sce_net` again. On my M5 Pro it aborts at `GuestSceNet.cpp:786` without the first and at `:151` without 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
rooklz commented 2026-10-22 04:41:36 +00:00 (Migrated from github.com)
Author
Contributor

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-2 at 53db0badb with #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, via VK_DRIVER_FILES. ctest -j6: 1648 tests, 87 failed, 93 skipped. The non-GPU failures are @tkcm01's list plus guest_interfaces, guest_getrlimit, guest_jit_shared_memory and guest_standard_streams (#8920).

guest_interfaces: fixed in #9619. macOS's getifaddrs returns IPv4 netmasks cut down routing-socket style (sa_len 5 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 only sa_len bytes makes the test pass.

Where the others stop, found with lldb (it debugs x86_64 processes under Rosetta here):

  • guest_math: the rand_r(nullptr) case at GuestMath.cpp:1031 throws through libc, and the test binary has only compact unwind, so it ends in terminate. With @mugurc's configure_macos_unwind (#8311) applied to guest_math_tests it gets past that and then fails at CheckAcosfErrno: Apple's libm gives acosf(0.5f) = 0x3f860a91, one ulp below the 0x3f860a92 the test expects. @mugurc, would you rather extend #8311 to the test executables (for example in add_test_executable on Apple), or should that be a follow-up once #8311 is in?
  • guest_getrlimit: RequireDescriptorsEndAt (GuestGetrlimit.cpp:76), the pipe loop does not end with EMFILE.
  • guest_socket_pair: GuestSocketPair.cpp:238, after shutdown(SHUT_WR) fstat does not report mode 0140444.
  • guest_host_standard_error: the waitpid at GuestHostStandardError.cpp:80 does not return the child.
  • guest_shm_open: the shared mmap at GuestShmOpen.cpp:43, the file-backed mapping @mugurc already pointed out in #7631.
  • guest_math_exact, guest_interfaces (before #9619), guest_getrlimit, guest_shm_open and guest_socket_pair fail at their own checks with or without configure_macos_unwind, so the unwind tables only matter for guest_math and guest_host_standard_error.

Taking guest_getrlimit and guest_socket_pair next, announcing before the PRs. Nobody has claimed them here that I can see; say so if you have one in progress.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6332879507 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6332879507). Originally posted by [rooklz](https://github.com/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-2` at `53db0badb` with #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, via `VK_DRIVER_FILES`. `ctest -j6`: 1648 tests, 87 failed, 93 skipped. The non-GPU failures are @tkcm01's list plus `guest_interfaces`, `guest_getrlimit`, `guest_jit_shared_memory` and `guest_standard_streams` (#8920). **`guest_interfaces`:** fixed in #9619. macOS's `getifaddrs` returns IPv4 netmasks cut down routing-socket style (`sa_len` 5 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 only `sa_len` bytes makes the test pass. **Where the others stop**, found with lldb (it debugs x86_64 processes under Rosetta here): - `guest_math`: the `rand_r(nullptr)` case at `GuestMath.cpp:1031` throws through libc, and the test binary has only compact unwind, so it ends in `terminate`. With @mugurc's `configure_macos_unwind` (#8311) applied to `guest_math_tests` it gets past that and then fails at `CheckAcosfErrno`: Apple's libm gives `acosf(0.5f)` = `0x3f860a91`, one ulp below the `0x3f860a92` the test expects. @mugurc, would you rather extend #8311 to the test executables (for example in `add_test_executable` on Apple), or should that be a follow-up once #8311 is in? - `guest_getrlimit`: `RequireDescriptorsEndAt` (`GuestGetrlimit.cpp:76`), the `pipe` loop does not end with `EMFILE`. - `guest_socket_pair`: `GuestSocketPair.cpp:238`, after `shutdown(SHUT_WR)` `fstat` does not report mode `0140444`. - `guest_host_standard_error`: the `waitpid` at `GuestHostStandardError.cpp:80` does not return the child. - `guest_shm_open`: the shared `mmap` at `GuestShmOpen.cpp:43`, the file-backed mapping @mugurc already pointed out in #7631. - `guest_math_exact`, `guest_interfaces` (before #9619), `guest_getrlimit`, `guest_shm_open` and `guest_socket_pair` fail at their own checks with or without `configure_macos_unwind`, so the unwind tables only matter for `guest_math` and `guest_host_standard_error`. **Taking `guest_getrlimit` and `guest_socket_pair` next**, announcing before the PRs. Nobody has claimed them here that I can see; say so if you have one in progress.
rooklz commented 2026-10-22 04:53:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-22T04:53:26Z.


Follow-up to my note above:

  • guest_socket_pair is fixed in #9625. On a connected AF_UNIX pair, XNU's soshutdownlock_final answers ENOTCONN for a direction that is already shut, where FreeBSD's soshutdown returns 0, so shutdown(SHUT_RD) after the peer's SHUT_WR failed. #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 the pipe loop stops with ENFILE, not EMFILE, because the system-wide table runs out first: kern.maxfiles is 122880 with about 70000 already open, and libkernel raises the guest's limit to kern.maxfilesperproc (61440). ENFILE is 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_files during the run would show it.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6333029952 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6333029952). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-22T04:53:26Z. --- Follow-up to my note above: - `guest_socket_pair` is fixed in #9625. On a connected `AF_UNIX` pair, XNU's `soshutdownlock_final` answers `ENOTCONN` for a direction that is already shut, where FreeBSD's `soshutdown` returns 0, so `shutdown(SHUT_RD)` after the peer's `SHUT_WR` failed. #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 the `pipe` loop stops with `ENFILE`, not `EMFILE`, because the system-wide table runs out first: `kern.maxfiles` is 122880 with about 70000 already open, and libkernel raises the guest's limit to `kern.maxfilesperproc` (61440). `ENFILE` is 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_files` during the run would show it.
rooklz commented 2026-10-22 06:23:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-22T06:23:53Z.


Two more, and a correction:

  • guest_host_standard_error is #9654, a test-only change. Its last check looks for libstdc++'s what(): report kept, and on macOS libc++abi words the same report libc++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. The waitpid failure I saw was EINTR from running it under lldb; outside the debugger it only ever failed at the wording.
  • guest_math_exact passes here when the test is built at -O0 and fails at the optimised build, with the same libc. Every check in it compares 80-bit long double bits (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.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6334258223 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6334258223). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-22T06:23:53Z. --- Two more, and a correction: - `guest_host_standard_error` is #9654, a test-only change. Its last check looks for libstdc++'s ` what(): report kept`, and on macOS libc++abi words the same report `libc++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. The `waitpid` failure I saw was `EINTR` from running it under lldb; outside the debugger it only ever failed at the wording. - `guest_math_exact` passes here when the test is built at `-O0` and fails at the optimised build, with the same libc. Every check in it compares 80-bit `long double` bits (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.
krishalivaibhav commented 2026-10-22 06:30:54 +00:00 (Migrated from github.com)
Author
Contributor

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_interp pairs, 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 from BaryCoordKHR on 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_cos computes 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_present in the trace summary is the reliable number.

AI-assisted: yes (Claude Code). Measurements are from my M2; gameplay observations are mine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6334360689 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6334360689). Originally posted by [krishalivaibhav](https://github.com/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_interp` pairs, 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 from `BaryCoordKHR` on 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_cos` computes 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_present` in the trace summary is the reliable number. AI-assisted: yes (Claude Code). Measurements are from my M2; gameplay observations are mine.
imellag commented 2026-10-22 07:05:32 +00:00 (Migrated from github.com)
Author
Contributor

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::nanResultF32 wraps 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 becomes 0xffc00000. In MSL that is three or four (x & 0x7fffffff) > 0x7f800000 tests and selects per operation. Apple GPUs return 0x7fc00000 for 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:

Same scene, warm caches, 10 s windows NaN emulation on off GPU per frame
God of War Sons of Sparta, Cyclops fight 39.45 / 39.47 fps 46.59 fps, one run so far (+18%) 22.8 → 18.8 ms
Planet of Lana, village 29.40 / 30.04 fps 31.69 / 31.48 fps (+6%) CPU-bound here

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.

Variant no NaN 0.1% of threads NaN 5% of threads NaN
A: plain operations (not exact) 1.01 ms 1.01 ms 1.01 ms
B: today's select chain (as SPIRV-Cross emits it) 5.81 ms 6.01 ms 5.78 ms
C: per-operation if (isnan(r)) r = chain 4.53 ms 4.70 ms 4.53 ms
D: plain region, exact re-run if any result was NaN 1.03 ms 1.12 ms 4.85 ms

A 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):

  1. Split each block into regions of emulated f32 operations: a region ends at a side effect (store, export, atomic, barrier), a cross-lane operation and a size cap.
  2. Fast path: the region's operations without the NaN selects.
  3. Check: OR together isnan of 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.
  4. If the check is true, run the region again from its inputs with today's exact nanResultF32 chains 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:

  • Region inputs stay live until the check, so register pressure goes up; the size cap bounds it.
  • The re-run doubles the region's code size.
  • Shaders that hit NaNs often (rare in practice) pay about what they pay today.

Tests: the existing f32_arithmetic_nan, f32_separate_rounding and 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:

  • Is an IR pass that clones a region under a branch acceptable in the recompiler, or should the split happen in the SPIR-V backend, which already emits inline selections (SpirvBdaFault.cpp)?
  • Is anyone already working on the NaN selects?
  • @krishalivaibhav, would this cover the NaN part of your opt-in experiment without giving up exactness?

AI-assisted: yes (Claude Code). The measurements are from my M4 Pro.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6334890745 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6334890745). Originally posted by [imellag](https://github.com/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::nanResultF32` wraps 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 becomes `0xffc00000`. In MSL that is three or four `(x & 0x7fffffff) > 0x7f800000` tests and selects per operation. Apple GPUs return `0x7fc00000` for 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: | Same scene, warm caches, 10 s windows | NaN emulation on | off | GPU per frame | |---|---|---|---| | God of War Sons of Sparta, Cyclops fight | 39.45 / 39.47 fps | 46.59 fps, one run so far (+18%) | 22.8 → 18.8 ms | | Planet of Lana, village | 29.40 / 30.04 fps | 31.69 / 31.48 fps (+6%) | CPU-bound here | 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. | Variant | no NaN | 0.1% of threads NaN | 5% of threads NaN | |---|---|---|---| | A: plain operations (not exact) | 1.01 ms | 1.01 ms | 1.01 ms | | B: today's select chain (as SPIRV-Cross emits it) | 5.81 ms | 6.01 ms | 5.78 ms | | C: per-operation `if (isnan(r)) r = chain` | 4.53 ms | 4.70 ms | 4.53 ms | | D: plain region, exact re-run if any result was NaN | 1.03 ms | 1.12 ms | 4.85 ms | A 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):** 1. Split each block into regions of emulated f32 operations: a region ends at a side effect (store, export, atomic, barrier), a cross-lane operation and a size cap. 2. Fast path: the region's operations without the NaN selects. 3. Check: OR together `isnan` of 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. 4. If the check is true, run the region again from its inputs with today's exact `nanResultF32` chains 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:** - Region inputs stay live until the check, so register pressure goes up; the size cap bounds it. - The re-run doubles the region's code size. - Shaders that hit NaNs often (rare in practice) pay about what they pay today. **Tests:** the existing `f32_arithmetic_nan`, `f32_separate_rounding` and 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:** - Is an IR pass that clones a region under a branch acceptable in the recompiler, or should the split happen in the SPIR-V backend, which already emits inline selections (`SpirvBdaFault.cpp`)? - Is anyone already working on the NaN selects? - @krishalivaibhav, would this cover the NaN part of your opt-in experiment without giving up exactness? AI-assisted: yes (Claude Code). The measurements are from my M4 Pro.
krishalivaibhav commented 2026-10-22 08:07:39 +00:00 (Migrated from github.com)
Author
Contributor

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; main doesn't build on macOS), Balatro (PPSA21402) main menu, which is dominated by two full-screen 1080p shaders: a procedural background (27 v_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 from TranslationContext::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:

Shader MSL lines selects > 0x7f800000 NaN tests
background (27 sin/cos) 1190 → 901 (−24%) 708 → 419 (−41%) 289 → 48
CRT (51 samples, 23 sin/cos) 2255 → 1918 (−15%) 1642 → 1287 (−22%) 588 → 287
third (12 sin/cos) 978 → 854 (−13%) 386 → 249 (−35%) 127 → 21

GPU time per frame (fence-based gpu_busy_ms_per_present; the menu is vsync-locked, so FPS stays at 60 either way):

runs GPU busy per present
NaN emulation on 4 12.73, 12.77, 13.63, 13.81 ms (the last with other load on the machine)
nanResultF32 off 4 11.83, 11.85, 11.89, 11.96 ms

So 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_mac as 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 fused v_mac were within noise.

What your design would not reach, from the dumps: the NaN tests left after dropping nanResultF32 come from other paths: the signaling-NaN quieting around FPMin/Max/Med3 (ieeeMinMaxF32), conversions, and the range handling inside the v_sin/v_cos emulation (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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6335932802 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6335932802). Originally posted by [krishalivaibhav](https://github.com/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; `main` doesn't build on macOS), Balatro (PPSA21402) main menu, which is dominated by two full-screen 1080p shaders: a procedural background (27 `v_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 from `TranslationContext::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: | Shader | MSL lines | selects | `> 0x7f800000` NaN tests | |---|---|---|---| | background (27 sin/cos) | 1190 → 901 (−24%) | 708 → 419 (−41%) | 289 → 48 | | CRT (51 samples, 23 sin/cos) | 2255 → 1918 (−15%) | 1642 → 1287 (−22%) | 588 → 287 | | third (12 sin/cos) | 978 → 854 (−13%) | 386 → 249 (−35%) | 127 → 21 | **GPU time per frame** (fence-based `gpu_busy_ms_per_present`; the menu is vsync-locked, so FPS stays at 60 either way): | | runs | GPU busy per present | |---|---|---| | NaN emulation on | 4 | 12.73, 12.77, 13.63, 13.81 ms (the last with other load on the machine) | | `nanResultF32` off | 4 | 11.83, 11.85, 11.89, 11.96 ms | So 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_mac` as 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 fused `v_mac` were within noise. **What your design would not reach, from the dumps:** the NaN tests left after dropping `nanResultF32` come from other paths: the signaling-NaN quieting around `FPMin/Max/Med3` (`ieeeMinMaxF32`), conversions, and the range handling inside the `v_sin`/`v_cos` emulation (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.
mugurc commented 2026-10-22 09:55:38 +00:00 (Migrated from github.com)
Author
Contributor

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) the rand_r(nullptr) case passes with the test binary as it is, and the first check that fails is acosf(0.5f) (0x3f860a91), which your #9668 covers. rand_r throws a host std::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 in guest_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_r case still ends in terminate on your machine, could you post what it prints, and whether your libc.prx shows __eh_frame under size -m? If it reproduces, I'll add guest_math_tests to #8311.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6337944101 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6337944101). Originally posted by [mugurc](https://github.com/mugurc) on 2026-10-22T09:55:38Z. --- @rooklz on `guest_math`: here (M5 Max, macOS 26.5.1, the series at 53db0badb) the `rand_r(nullptr)` case passes with the test binary as it is, and the first check that fails is `acosf(0.5f)` (`0x3f860a91`), which your #9668 covers. `rand_r` throws a host `std::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 in `guest_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_r` case still ends in `terminate` on your machine, could you post what it prints, and whether your `libc.prx` shows `__eh_frame` under `size -m`? If it reproduces, I'll add `guest_math_tests` to #8311.
jotitadev commented 2026-10-22 10:25:09 +00:00 (Migrated from github.com)
Author
Contributor

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_flag didn'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):

driver GLC store of the flag wave32 gave up wave32 seen on 1st poll wave64 gave up wave64 seen on 1st poll
MoltenVK 1.4.2 plain (current) 21/240 0/240 15/240 0/240
MoltenVK 1.4.2 OpAtomicStore device scope 1/240 236/240 22/240 134/240
MoltenVK main + #2704 plain (current) 25/240 0/240 30/240 0/240
MoltenVK main + #2704 OpAtomicStore device scope 6/240 224/240 12/240 119/240
  • Visibility. #2259 made the GLC load an OpAtomicLoad, but the GLC store is still OpStore ... Volatile in EmitBdaStoreAt. 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 an OpAtomicStore at device scope, it sees the flag on the first poll in about 95% of wave32 dispatches.
  • Forward progress. The atomic store still leaves gave-ups, mostly in wave64. To check, I had the writing workgroup do one GLC load of the result word before it stores the flag. With that change the reader gives up in about 95% of dispatches, and the writer read 0 every time. So the writer started before the reader gave up, but its store did not land within 1M polls even as an atomic. The writing workgroup stalls while the other one spins, and neither Vulkan nor Metal guarantees forward progress between workgroups.

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_target fails in 19 of 150 runs on MoltenVK 1.4.2 and 23 of 150 on MoltenVK main. The _no_resident variant 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 the Z_X one): the target still holds the fill byte (0x5a), so the draw never reached guest memory. In 100 runs each on MoltenVK 1.4.2:

run failures
default (the probe says host imports resolve write protection: no ... imported ranges stay watched) 14-16
APS5_WRITE_WATCH_IMPORTS=watch 11
APS5_WRITE_WATCH_IMPORTS=unwatch 0 (also 0/100 on MoltenVK main)
APS5_NO_HOST_IMPORT=1 0
APS5_NO_WRITE_WATCH=1 0
APS5_PACKET_EPOCH=1 14
no address reuse between cases (blocks leaked) 11

So 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 ^agc set with unwatch gives the same 18 failures as the default, so unwatch costs 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6338488012 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6338488012). Originally posted by [jotitadev](https://github.com/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_flag` didn'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): | driver | GLC store of the flag | wave32 gave up | wave32 seen on 1st poll | wave64 gave up | wave64 seen on 1st poll | |---|---|---|---|---|---| | MoltenVK 1.4.2 | plain (current) | 21/240 | 0/240 | 15/240 | 0/240 | | MoltenVK 1.4.2 | `OpAtomicStore` device scope | 1/240 | 236/240 | 22/240 | 134/240 | | MoltenVK main + #2704 | plain (current) | 25/240 | 0/240 | 30/240 | 0/240 | | MoltenVK main + #2704 | `OpAtomicStore` device scope | 6/240 | 224/240 | 12/240 | 119/240 | - **Visibility.** #2259 made the GLC load an `OpAtomicLoad`, but the GLC store is still `OpStore ... Volatile` in `EmitBdaStoreAt`. 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 an `OpAtomicStore` at device scope, it sees the flag on the first poll in about 95% of wave32 dispatches. - **Forward progress.** The atomic store still leaves gave-ups, mostly in wave64. To check, I had the writing workgroup do one GLC load of the result word before it stores the flag. With that change the reader gives up in about 95% of dispatches, and the writer read 0 every time. So the writer started before the reader gave up, but its store did not land within 1M polls even as an atomic. The writing workgroup stalls while the other one spins, and neither Vulkan nor Metal guarantees forward progress between workgroups. 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_target`** fails in 19 of 150 runs on MoltenVK 1.4.2 and 23 of 150 on MoltenVK main. The `_no_resident` variant 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 the `Z_X` one): the target still holds the fill byte (0x5a), so the draw never reached guest memory. In 100 runs each on MoltenVK 1.4.2: | run | failures | |---|---| | default (the probe says `host imports resolve write protection: no ... imported ranges stay watched`) | 14-16 | | `APS5_WRITE_WATCH_IMPORTS=watch` | 11 | | `APS5_WRITE_WATCH_IMPORTS=unwatch` | 0 (also 0/100 on MoltenVK main) | | `APS5_NO_HOST_IMPORT=1` | 0 | | `APS5_NO_WRITE_WATCH=1` | 0 | | `APS5_PACKET_EPOCH=1` | 14 | | no address reuse between cases (blocks leaked) | 11 | So 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 `^agc` set with `unwatch` gives the same 18 failures as the default, so `unwatch` costs 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.
tkcm01 commented 2026-10-22 10:39:21 +00:00 (Migrated from github.com)
Author
Contributor

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. Here kern.maxfiles is 184320, kern.maxfilesperproc 92160 and kern.num_files about 8550 before and after the runs, so the per-process limit is reached long before the system table and the pipe loop ends with EMFILE. On your machine 122880 − ~70000 open leaves fewer than the 61440 per-process limit, hence ENFILE.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6338742767 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6338742767). Originally posted by [tkcm01](https://github.com/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. Here `kern.maxfiles` is 184320, `kern.maxfilesperproc` 92160 and `kern.num_files` about 8550 before and after the runs, so the per-process limit is reached long before the system table and the `pipe` loop ends with `EMFILE`. On your machine 122880 − ~70000 open leaves fewer than the 61440 per-process limit, hence `ENFILE`. AI-assisted: yes
Mauro42K commented 2026-10-22 12:37:16 +00:00 (Migrated from github.com)
Author
Contributor

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:

  • Both fixes present: guest_sce_net 5/5 PASS.
  • Leading-zero IPv4 check removed: Subprocess aborted.
  • EPROTOTYPE mapping removed: Subprocess aborted.
  • Both fixes restored: guest_sce_net 5/5 PASS again.

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340916181 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6340916181). Originally posted by [Mauro42K](https://github.com/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: e0a3ccec02434abbd104a3c7a6141cece68b1533. I used a separate worktree and build, reverting each of the two macOS-specific blocks in core/libs/prx/libSceNet/Export.cpp independently. Results: * Both fixes present: guest_sce_net 5/5 PASS. * Leading-zero IPv4 check removed: Subprocess aborted. * EPROTOTYPE mapping removed: Subprocess aborted. * Both fixes restored: guest_sce_net 5/5 PASS again. 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.
rooklz commented 2026-10-22 14:46:28 +00:00 (Migrated from github.com)
Author
Contributor

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-2 at 53db0badb with #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:

Stop Titles
AGC graphics: device does not support mesh shaders (this MoltenVK reports no mesh-shader feature) PPSA99641 Wind Waker HD, PPSA69424 Wave Race 64, PPSA69423 Rush 2, PPSA99640 Twilight Princess, PPSA99305 Dusklight, PPSA99314 Eternal Darkness
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) PPSA98511 ReKHCoM, PPSA99310 Mario 64 (Ghostship), PPSA99320 Ship of Harkinian (Vulkan)
AGC graphics: last provoking vertex requires VK_EXT_provoking_vertex with provokingVertexLast enabled (listed, feature false; MVK_CONFIG_USE_METAL_PRIVATE_API=1 does not change it on this build) PPSA98001 PokeMMO, PPSA99993 Pulse
vkCreateGraphicsPipelines: Vulkan result -3, Metal refusing a float4 output on a UINT attachment: #9783 PPSA99313 Doom 3 BFG, PPSA59322 ccleste
Guest TLS access without a non-empty PT_TLS from the tree's relinker (empty PT_TLS plus fs: accesses); main's relinker converts all five, so this is already fixed there PPSA59322, PPSA99305, PPSA99309, PPSA99630, PPSA99314
Forbidden syscall instruction; converts with --trap-sdk-syscall-stubs PPSA99004 ProsperoAI, PPSA99360 PS5-ECAM, PPSA69421 SuperTuxKart

The rest stop in their own code: PPSA99620 and PPSA99621 (Ship of Harkinian, 2 Ship 2 Harkinian) crash in a guest thread reading 0x20(%r12) with r12 null (EXC_BAD_ACCESS, all frames in the title until libkernel's RunGuest), 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 flip counters 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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6343620098 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6343620098). Originally posted by [rooklz](https://github.com/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-2` at `53db0badb` with #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: | Stop | Titles | | --- | --- | | `AGC graphics: device does not support mesh shaders` (this MoltenVK reports no mesh-shader feature) | PPSA99641 Wind Waker HD, PPSA69424 Wave Race 64, PPSA69423 Rush 2, PPSA99640 Twilight Princess, PPSA99305 Dusklight, PPSA99314 Eternal Darkness | | `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) | PPSA98511 ReKHCoM, PPSA99310 Mario 64 (Ghostship), PPSA99320 Ship of Harkinian (Vulkan) | | `AGC graphics: last provoking vertex requires VK_EXT_provoking_vertex with provokingVertexLast enabled` (listed, feature false; `MVK_CONFIG_USE_METAL_PRIVATE_API=1` does not change it on this build) | PPSA98001 PokeMMO, PPSA99993 Pulse | | `vkCreateGraphicsPipelines: Vulkan result -3`, Metal refusing a `float4` output on a UINT attachment: #9783 | PPSA99313 Doom 3 BFG, PPSA59322 ccleste | | `Guest TLS access without a non-empty PT_TLS` from the tree's relinker (empty `PT_TLS` plus `fs:` accesses); `main`'s relinker converts all five, so this is already fixed there | PPSA59322, PPSA99305, PPSA99309, PPSA99630, PPSA99314 | | `Forbidden syscall instruction`; converts with `--trap-sdk-syscall-stubs` | PPSA99004 ProsperoAI, PPSA99360 PS5-ECAM, PPSA69421 SuperTuxKart | The rest stop in their own code: PPSA99620 and PPSA99621 (Ship of Harkinian, 2 Ship 2 Harkinian) crash in a guest thread reading `0x20(%r12)` with `r12` null (`EXC_BAD_ACCESS`, all frames in the title until libkernel's `RunGuest`), 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 flip` counters 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
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#1
No description provided.