Repository navigation
Description
Summary
The GPU process dies with signal 11 about 40 seconds into every launch, while PsoCache::WriterLoop writes the Metal pipeline binary archive. The fault is inside Metal, not in the port's own code: _platform_strlen is called with a null pointer from -[MTLBinaryArchive getArchiveIDWithErrorInternal:], reached from addComputePipelineFunctionsWithDescriptor:.
This is 100% reproducible on my machine (2/2 launches). Disabling the archive lets the game run normally past this point — it reached character creation with no crash.
Environment
| Mac | Mac17,7 — Apple M5 Max, 36 GB |
| macOS | 27.2 (build 26B123) |
| GPU family | AGXMetalG17X |
| Port | mac-v0.5.12 prebuilt (BBCommit 50274ee); also reproduces when building master (a88dd8a) |
| Game | Bloodborne CUSA03173, update 1.09 merged (game_check.py passes) |
| Launch | 1920x1080, 120 FPS limit, default settings |
The project's validated hardware appears to be M4 Max on macOS 26, so I suspect this is a Metal regression on macOS 27 / newer AGX family rather than something that would show up on the tested combinations.
Log
Crash: the GPU process crashed (signal 11 in _platform_strlen)
bbgpu-host: fatal fault (signal 11) at /usr/lib/system/libsystem_platform.dylib+0xb44 (_platform_strlen), address 0x0
0 bbgpu-host-macos27 0x000000010457145c fault + 344
1 libsystem_platform.dylib 0x000003c01740a144 _sigtramp + 56
2 Metal 0x000003c025f81940 -[MTLCompiler createBinaryArchiveAsRecompileTarget:compilerTask:completionHandler:] + 168
3 Metal 0x000003c025ec58b8 __77-[_MTLBinaryArchive(MTLBinaryArchiveInternal) getArchiveIDWithErrorInternal:]_block_invoke + 204
4 libdispatch.dylib 0x000003c0173da5a0 _dispatch_client_callout + 16
5 libdispatch.dylib 0x000003c0173d0490 _dispatch_lane_barrier_sync_invoke_and_complete + 56
6 Metal 0x000003c025ec576c -[_MTLBinaryArchive(MTLBinaryArchiveInternal) getArchiveIDWithErrorInternal:] + 184
7 Metal 0x000003c025f84eec -[MTLCompiler compileFunctionRequestInternal:frameworkLinking:linkDataSize:reflectionOnly:compilerTask:completionHandler:] + 7212
8 AGXMetalG17X 0x000003c0e3d945c4 ... createComputeProgramVariant(MTLComputePipelineDescriptor*, ...AGXG17XFamilyBinaryArchive*, ...) + 3912
9 AGXMetalG17X 0x000003c0e3d6899c -[AGXG17XFamilyBinaryArchive addComputePipelineFunctionsWithDescriptor:options:error:] + 536
10 libbbgpu.dylib 0x000000010606383c _ZN5Metal8PsoCache12WriteArchiveEv + 500
11 libbbgpu.dylib 0x00000001060635b4 _ZN5Metal8PsoCache10WriterLoopEv + 340
12 libbbgpu.dylib 0x000000010606e51c std::__thread_proxy<...PsoCache::PsoCache(Device&, std::filesystem::path)::$_0...> + 52
GPU process: host lost (host process killed by signal 11) while rendering; exiting
Crash: the GPU process stopped unexpectedly (host process killed by signal 11)
What I ruled out
MTL_SHADER_VALIDATION=1(which makesPsoCacheskip the archive,mtl_pso_cache.mm:225) → no crash. The game loads, mountsSPRJ0005, plays the intro, reaches character creation. So the renderer itself is fine on this GPU.BB_PIPELINE_CACHE=0does not help — it only gates the SPIR-V shader DB (FreePermIndex), notPsoCache.
Suggested fix
The failing call is specifically addComputePipelineFunctionsWithDescriptor:, in this loop in PsoCache::WriteArchive():
const BOOL added =
[descriptor isKindOfClass:[MTLRenderPipelineDescriptor class]]
? [fresh addRenderPipelineFunctionsWithDescriptor:descriptor error:&ns_error]
: [fresh addComputePipelineFunctionsWithDescriptor:descriptor error:&ns_error];Two options, in order of preference:
- Skip compute descriptors when adding to the archive (or guard them on the OS version), keeping render-pipeline caching — if the crash really is compute-only, this preserves almost all of the "2 compiles per session" win.
- An explicit opt-out, mirroring the existing
MTL_SHADER_VALIDATIONearly return:
if (const char* env = std::getenv("BB_METAL_ARCHIVE"); env && env[0] == '0') {
LOG_WARNING(Render, "Metal binary archive off (BB_METAL_ARCHIVE=0)");
return;
}I'm running a local build with option 2 and it's stable through character creation; the cost is the ~500 shader compiles per launch that the archive normally avoids.
Happy to test either approach, or a build that only skips compute, if that's useful.
Activity
Wooloomooloo2 commentedon Nov 5, 2026
Thanks @runty, that's an excellent report: the trace pointed straight at it.
There's a fix on branch
fix-129-archive(9bb8d56), close to your option 1. On an M5 (Apple10 GPU family) with macOS 27.2 or later, the archive now keeps compute pipelines out and still caches render pipelines. Every other Mac is unchanged, since M2s on 27.2 and M5s on 27.0.1 write the archive without trouble. It also adds your opt-out asBB_METAL_ARCHIVE=0(no archive) andBB_METAL_ARCHIVE=render(render pipelines only, any Mac). The archive now gets a label as well, in case the missing ID comes from an unnamed archive 8000 .Here, a cold start with
BB_METAL_ARCHIVE=renderwrote 412 render pipelines, and the next start loaded them and compiled 61 compute pipelines. I can't reproduce the crash itself (no M5 here), so could you build that branch and check that it runs past the 40-second mark with no environment variable set? The log should say "Metal binary archive: render pipelines only".runty commentedon Nov 6, 2026
Built
9bb8d56and ran it with nothing set —env -u BB_METAL_ARCHIVE -u MTL_SHADER_VALIDATION,so neither variable could force a mode. Yes: it runs past the 40-second mark, and the log says
exactly that line.
That was a cold start with no archive on disk. It went on to mount
SPRJ0005and open the namedialog, with the window live the whole time — zero crashes, and the writer ran ten times
during the session without faulting, which is the path that killed 0.5.12 at ~40 s.
Second start, same data folder, still nothing set:
So the render pipelines come back from disk and only the compute ones compile.
Mac17,7 (M5 Max, 36 GB), macOS 27.2 (26B123), Apple10 family,
CUSA03173v1.09.README: 0.5.13 (#76 Mac Settings, #117, #79, #121); known #127, #129
README, findings, backlog: 0.5.14 (#127 fixed, #129)
Wooloomooloo2 commentedon Nov 7, 2026
@runty could you try 0.5.14? On M5 Macs with macOS 27.2 or later, it keeps compute pipelines out of the Metal binary archive. Writing them is where the crash was. The log should say "Metal binary archive: render pipelines only". If it still crashes,
BB_METAL_ARCHIVE=0turns the archive off completely, and the new crash report would help.runty commentedon Nov 7, 2026
Confirmed on the M5 with 0.5.14:
it runs past the 40-second mark with nothing set in the environment, and the log says exactly
that line.
Metal binary archive: render pipelines only, on to character creation, zero crashes.d6bb3966…, bundleee35a51) rather than a local build.So #129 looks fixed from my side.
runty commentedon Nov 7, 2026
One thing worth a line in the release notes, if it has not come up: I had
BB_METAL_ARCHIVE=0sitting in
launch.conffrom the workaround, and that silently overrides the new default —the archive stays off and you get the old recompile-every-start behaviour with no crash to
explain it. Anyone upgrading from a workaround build should delete that line. I hit it, and
would not have noticed without the log line.
Metal archive: keep compute pipelines out on M5 + macOS 27.2 (Wooloom…
Wooloomooloo2 commentedon Nov 8, 2026
Thanks @runty for testing the release zip so carefully, and for the
launch.confcatch. I've added a note to the 0.5.14 release notes: anyone who used theBB_METAL_ARCHIVE=0workaround should delete that line, or the archive stays off. Closing as fixed in 0.5.14.Build on macOS 15 with Xcode 16 (std::jthread, MTLGPUFamilyApple10)