Skip to content
New issue

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

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

Already on GitHub? # to your account

GGML_USE_METAL=1 fails on iPadOS running iOS 15/16 (and 17 perhaps) #1387

Open
ronyfadel opened this issue Oct 22, 2023 · 9 comments
Open

GGML_USE_METAL=1 fails on iPadOS running iOS 15/16 (and 17 perhaps) #1387

ronyfadel opened this issue Oct 22, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@ronyfadel
Copy link

Error is:

ggml_metal_init: load pipeline error: Error Domain=AGXMetalA12 Code=3 "Encountered unlowered function call to air.simd_max.f32" UserInfo={NSLocalizedDescription=Encountered unlowered function call to air.simd_max.f32}

If I remove calls to simd_max, it still fails with:

ggml_metal_init: load pipeline error: Error Domain=AGXMetalA12 Code=3 "Encountered unlowered function call to air.simd_sum.f32" UserInfo={NSLocalizedDescription=Encountered unlowered function call to air.simd_sum.f32}

etc.. i.e. all simd func calls are failing.

@ronyfadel ronyfadel changed the title GGML_USE_METAL fails on iPadOS running iOS 15/16 (and 17 perhaps) GGML_USE_METAL=1 fails on iPadOS running iOS 15/16 (and 17 perhaps) Oct 22, 2023
@ronyfadel
Copy link
Author

@ggerganov what do you think?

This has been mentioned here as well: ggml-org/llama.cpp#2564 (cc @jhen0409)

@bobqianic bobqianic added bug Something isn't working help wanted Extra attention is needed labels Oct 22, 2023
@jhen0409
Copy link
Contributor

jhen0409 commented Oct 22, 2023

Related ggml-org/llama.cpp#2550

The A-chip models A12Z and before not supported some SIMD operations like simd_max and simd_sum we used in Metal. To fix this, need some works to write new kernels or patch.

I was thinking to do this but not very urgency, and now I think it not worthy to do because it may make affect for future works and neglected maintenance, so I choice to do #1293 for disable Metal in unsupported devices.

@bobqianic bobqianic removed the help wanted Extra attention is needed label Nov 12, 2023
@ronyfadel
Copy link
Author

@bobqianic how is this completed?

Can you please link the related PR or issue?

@bobqianic
Copy link
Collaborator

The A-chip models A12Z and before not supported some SIMD operations like simd_max and simd_sum we used in Metal. To fix this, need some works to write new kernels or patch.

#1293 was merged last week. Therefore, even when using GGML_USE_METAL=1 during compilation, the -ng flag can prevent device failures. It's worth noting that the Metal performance on Apple2 to Apple6 family devices is relatively low. Running on ANE might result in faster transcription speeds. If you prefer to keep this issue open, I'm happy to do that for you.

#1270 (comment)

@sindresorhus
Copy link
Contributor

This limitation is not documented anywhere, so it's impossible to know that it doesn't work on some devices without scouring the issue tracker.

I think Whisper should simply detect the unsupported devices and not activate GPU mode even if instructed to on those devices.

Whisper could use https://developer.apple.com/documentation/metal/mtldevice/3143473-supportsfamily?language=objc to detect the supported GPUs.

@ronyfadel
Copy link
Author

@sindresorhus agreed. At the moment it's too easy for this to blow up in the developer's (and the user's) face.

@ggerganov
Copy link
Owner

Yup, I'll fix this now.

Can somebody remind me which was the earliest apple family that we support?
Should be Apple7 and above, correct?

@bobqianic
Copy link
Collaborator

Should be Apple7 and above, correct?

Yes.

@ggerganov
Copy link
Owner

#1547 should disable GPU seamlessly if Apple7 family is not supported by the device

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants