Skip to content

Fix crash when ggml_backend_metal_init() fails on old Apple device. #1582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

bjnortier
Copy link
Contributor

If ggml_backend_metal_init() fails (e.g. iPad Pro M1 2nd Gen), a valid struct is still returned but ctx is null.
A subsequent call to ggml_backend_metal_supports_family() crashes because is ctx is null.

So this PR implements:
Return NULL from ggml_backend_metal_init() when context is NULL.
Don't call ggml_backend_metal_supports_family() when backend_gpu is NULL;

…t call ggml_backend_metal_supports_family() when backend_gpu in NULL;
@slaren
Copy link
Member

slaren commented Dec 1, 2023

I think some of this was fixed in ggml-org/ggml#620

@bobqianic
Copy link
Collaborator

bobqianic commented Jan 6, 2024

I found out that this issue seems to have been fixed in a certain update, thanks for your work. Since the issue has been resolved, I'm now closing this PR.

https://github.com/ggerganov/whisper.cpp/blob/0b9af32a8b3fa7e2ae5f15a9a08f5b10394993f5/whisper.cpp#L1075-L1081

@bobqianic bobqianic closed this Jan 6, 2024
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.

3 participants