-
Notifications
You must be signed in to change notification settings - Fork 17
Adds support for MacOS Arm CPU builds #15
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
Conversation
Thanks for your contribution; lmk once this compiles on metal (op not implemented errors are fine), and compiles and passes tests on cpu on MacOS (ideally for both intel and arm), and I'll verify on Linux and merge. Since it looks like the first missing op is in the diffusion model, you should be able to run the autoregressive test on metal, which might be of interest. |
I typed the wrong wrong thing somehow. It compiles on metal! it just doesn't run tortoise yet because of the missing ops. You could probably tell this based on my progress in the issue. I'll confirm it runs on cpu for mac intel and mac arm yes. I'l give these tests a go to. As for adding the missing ops, I found the files very hard to navigate and was getting confused with how things were referenced in the main.cpp versus in the ggml code. I would like to at least establish which ones are missing and how to put in the skeleton code for them so I can compile and test them + build an itemised list so that it's easier for others to see what needs to be done if they want to chip in / take over |
Sounds good to me. Worth noting that all remaining changes for metal support should be in the ggml submodule and you shouldn't need to modify |
The main confusion I had was working out the exact name of the operation. The message it gave back for:
was that the operation was not supported, but metal appeared to have an upscaling operation. So it seems that there is a "ext" version and a not "ext" version, but then I couldn't find a differently named upscaling operation in CUDA either? (was looking in CUDA to find what the required one should be named for metal) |
I did yeah but I think ggerganov added the metal changes. ggml-org/ggml#814 You can check ggml.c So it shouldnt need a custom backend op as i think GGML_OP_UPSCALE already has metal implementation. Maybe this is a ggml bug. |
Mac OS ARM (CPU) test_autoregressive();
test_diffusion();
test_vocoder();
Mac OS intel (x86) (CPU)
|
The illegal instruction on intel may mean it needs a compile flag related to intel architecture extensions changed. Maybe worth looking at this file to see commands used to build a the similar project stable-diffusion.cpp https://github.com/leejet/stable-diffusion.cpp/blob/master/.github/workflows/build.yml The test mismatch is something I noticed on windows as well, and is fine as long as legible audio comes out of the full process |
I tried one of those commands. I had no idea you could do a universal compilation for ARM and x86 wow
haven't found the right build command for intel yet but that's a cool finding for me |
I tried mac os intel with
but no success. something else seems to be the issue. |
maybe try the avx related ones, those are features that are missing on some intel chips but available on others, so could cause an illegal instruction. |
possibly Rosetta 2 doesn't support them |
@balisujohn did you determine whether the change of {1,1} was {1,1,1,1} was correct / required and functioned on other OS? The only other changes in here is the CMake for Metal and commenting out a logging function in metal that didn't seem to exist. We can also change the readme info for Mac build to say that it builds for Mac ARM metal but does not run fully and that Mac Intel currently doesn't work as this will encourage other mac users dropping by to attempt builds and allows them to run it on cpu no issues (for mac arm) |
As for the Metal ops, that work will need to be done through GGML repo as discussed and currently it seems a bit out of my ability with my current testing setup |
Ok yeah we can merge this as "support for ARM CPU only." The patch did not fix the issues on Windows, but I am very confident it is correct because without it you are reading to and writing from unallocated memory locations, which just happens silently on Linux(c++ moment). If you could add a readme section detailing the extent of current Mac support and how to build on Mac, I think this will be ready to merge. |
(I noticed the README is already updated; I'll handle this PR from here. Thanks for your contribution!) |
alright LGTM :^) |
Uh oh!
There was an error while loading. Please reload this page.