Skip to content
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

Metal iOS #1841

Open
soldelacroix opened this issue Mar 13, 2024 · 3 comments
Open

Metal iOS #1841

soldelacroix opened this issue Mar 13, 2024 · 3 comments

Comments

@soldelacroix
Copy link

Great framework!

Is the usage of Metal already possible on iOS? I'm trying to run the Phi example on iOS and I can only get it to work with a CPU device but not with Metal. MTLStorageModeManaged isn't available on iOS.

@LaurentMazare
Copy link
Collaborator

I've never tried compiling for iOS but this issue seems related #1759

@ssoudan
Copy link

ssoudan commented Mar 26, 2024

Have had a try at it here but something based on candle-examples/examples/phi is generating mostly blank tokens on my iPad. Not sure what the issue is at this point. TBC

@filipw
Copy link

filipw commented Apr 10, 2024

Thanks a lot @LaurentMazare for the great work.

I tried running it on iOS and as the OP noted, it works well but only on CPU.
When using the GPU, the Metal code crashes because candle is explicitly using MTLResourceOptions::StorageModeManaged in a few places. The managed mode is not available on iOS and tvOS so the code panics.

I tried simply changing it to be shared everywhere, but that also panics because iOS has a buffer size limit of 256MB (see: https://github.com/gfx-rs/metal-rs/blob/master/src/device.rs#L712-L718) and at least trying to run Phi would attempt to allocate more.

Can we somewhere control the buffer size that is being used by candle?

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

No branches or pull requests

4 participants