We started having crashes since version 1.7.1 (didn't check 1.7.0 though) when using Whisper.cpp on Simulator or Preview.
It crashes in ggml-metal.m on line 3283:
I'm not familiar with Metal too much but it looks like it tries to work with a GPU device while Simulator doesn't have one? Explicitly setting context_parameters.use_gpu = false solves the issue. But it switched to CPU-only automatically on versions prior to 1.7.1 (or 1.7.0).
Tested on iOS 17.5 and 18.x simulator runtimes. Xcode 16.0, macOS 15.0.1.
Stack trace:
Thread 12 Queue : com.apple.root.user-initiated-qos.cooperative (concurrent)
#0 0x00000001800dd63c in _xpc_api_misuse ()
#1 0x00000001800d3cd4 in _xpc_shmem_create_with_prot ()
#2 0x0000000226ef63f8 in -[MTLSimDevice newBufferWithLength:options:pointer:copyBytes:deallocator:] ()
#3 0x00000001c5127c48 in -[MTLDebugDevice newBufferWithBytesNoCopy:length:options:deallocator:] ()
#4 0x000000010424b824 in ggml_backend_metal_buffer_type_alloc_buffer at ggml-metal.m:3283
#5 0x0000000104243b80 in alloc_tensor_range at ggml-alloc.c:940
#6 0x0000000104243ab8 in ggml_backend_alloc_ctx_tensors_from_buft at ggml-alloc.c:1018
#7 0x00000001042d26a0 in whisper_model_load at whisper.cpp:1799
#8 0x00000001042cea54 in ::whisper_init_with_params_no_state(whisper_model_loader *, whisper_context_params) at whisper.cpp:3659
#9 0x00000001042ce7cc in ::whisper_init_from_file_with_params_no_state(const char *, whisper_context_params) at whisper.cpp:3597
#10 0x00000001042d34a4 in ::whisper_init_from_file_with_params(const char *, whisper_context_params) at whisper.cpp:3672
#11 0x00000001038a5508 in <redacted>
#12 0x00000001039e9be4 in <redacted>
#13 0x00000001039f0558 in <redacted>
#14 0x000000010393503c in <redacted>
#15 0x0000000103932ab4 in <redacted>
#16 0x0000000103b12784 in closure #1 in <redacted>
#17 0x0000000103b258f4 in partial apply for closure #1 in <redacted> ()
#18 0x0000000103777b40 in thunk for @escaping @isolated(any) @callee_guaranteed @async () -> (@out A) ()
#19 0x0000000103779728 in partial apply for thunk for @escaping @isolated(any) @callee_guaranteed @async () -> (@out A) ()
We started having crashes since version 1.7.1 (didn't check 1.7.0 though) when using Whisper.cpp on Simulator or Preview. It crashes in
ggml-metal.m
on line 3283:I'm not familiar with Metal too much but it looks like it tries to work with a GPU device while Simulator doesn't have one? Explicitly setting
context_parameters.use_gpu = false
solves the issue. But it switched to CPU-only automatically on versions prior to 1.7.1 (or 1.7.0).Tested on iOS 17.5 and 18.x simulator runtimes. Xcode 16.0, macOS 15.0.1.
Stack trace: