Skip to content

Conversation

@danbev
Copy link
Member

@danbev danbev commented Mar 14, 2025

This commit adds the GGML_USE_CPU=ON flag to the whisper.objc project in order to enable the CPU backend for the whisper.objc project.

The motivation for this change is that currently the following error is generated when running the example:

ggml_backend_buffer_type_t ggml_backend_get_default_buffer_type(ggml_backend_t backend) {
    return ggml_backend_dev_buffer_type(backend->device); <- Thread 1: EXC_BAD_ACCESS (code=1, address=0x70)
}

If we inspect the backend variable we can see that it is a nullptr.

(lldb) p backend
(ggml_backend_t) nullptr

When running in a simulator and that automatically means that there will be no gpu as there is a check for this in the code. But the CPU backend should still be present.

The objective-c code will compile the whisper sources including the ggml sources. And if -DGGMLL_USE_CPU is not defined then there will be no CPU backend, and in this particular case of backend at all.

Resolves: #2870

This commit adds the GGML_USE_CPU=ON flag to the whisper.objc project in
order to enable the CPU backend for the whisper.objc project.

The motivation for this change is that currently the following error
is generated when running the example:
```console
ggml_backend_buffer_type_t ggml_backend_get_default_buffer_type(ggml_backend_t backend) {
    return ggml_backend_dev_buffer_type(backend->device); <- Thread 1: EXC_BAD_ACCESS (code=1, address=0x70)
}
```
If we inspect the `backend` variable we can see that it is a `nullptr`.
```console
(lldb) p backend
(ggml_backend_t) nullptr
```
When running in a simulator and that automatically means that there will
be no gpu as there is a check for this in the code. But the CPU backend
should still be present.

The objective-c code will compile the whisper sources including the ggml
sources. And if `-DGGMLL_USE_CPU` is not defined then there will be no
CPU backend, and in this particular case of backend at all.

Resolves: ggml-org#2870
@danbev danbev force-pushed the objc-cpu-backend branch from 19b4beb to 08fc787 Compare March 14, 2025 09:42
@danbev danbev merged commit e0f3c9d into ggml-org:master Mar 14, 2025
45 checks passed
buxuku pushed a commit to buxuku/whisper.cpp that referenced this pull request Mar 26, 2025
This commit adds the GGML_USE_CPU=ON flag to the whisper.objc project in
order to enable the CPU backend for the whisper.objc project.

The motivation for this change is that currently the following error
is generated when running the example:
```console
ggml_backend_buffer_type_t ggml_backend_get_default_buffer_type(ggml_backend_t backend) {
    return ggml_backend_dev_buffer_type(backend->device); <- Thread 1: EXC_BAD_ACCESS (code=1, address=0x70)
}
```
If we inspect the `backend` variable we can see that it is a `nullptr`.
```console
(lldb) p backend
(ggml_backend_t) nullptr
```
When running in a simulator and that automatically means that there will
be no gpu as there is a check for this in the code. But the CPU backend
should still be present.

The objective-c code will compile the whisper sources including the ggml
sources. And if `-DGGMLL_USE_CPU` is not defined then there will be no
CPU backend, and in this particular case of backend at all.

Resolves: ggml-org#2870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Thread 1: EXC_BAD_ACCESS (code=1, address=0x70) With Swiftui-example

2 participants