-
Notifications
You must be signed in to change notification settings - Fork 79
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
Crash on old CPUs (non AVX, AVX2, etc) #33
Comments
I think I ran into this issue on my Windows PC with older (but not stone age old) hardware.
The CPU (i5-2500K) does already support AVX. What is required exactly, just any AVX or AVX2? Anyway, I think the proper solution to this issue is running the model on the GPU by using Barracuda (#32) |
You already answered this, both are required.
Then my question is: how can I check for these from C#? |
That's the trick! There is no C# API that supported by Unity (at least I didn't found one checking specifically for AVX2). However there is some C++ libs that can check CPU and OS capabilities, like: https://github.com/Mysticial/FeatureDetector One way is to compile this C++ library and distribute it along with whisper.cpp. Other option - merge checks from this library directly to ggml. I created issue for this here: Last option is to distribute non-AVX2 dlls with whisper.unity. But I would need to check if PC had AVX support in runtime anyway. |
Thanks for the hints. I found that GCC has a built-in method to check for CPU capabilities, including a check for AVX support. This little program works for me
I can parse the program output to determine whether AVX2 is supported. EDIT: I created a repo for this and added a release with the exe. So others do not need install GCC and compile it. |
Considering this, webgl and barracuda, I'm more convinced to move whisper.cpp to custom fork. This will allow to include AVX check code into dll and use it in C# runtime. |
Is that problem fixed ? |
There was report (#23) that whisper.cpp crashes on old CPUs that doesn't support architectures extensions like AVX, AVX2. This is because compiled libraries for Windows and Linux assumes that hardware supports AVX and AVX2. When compiled library with AVX trying to run on non-AVX CPU it will crash.
This isn't a problem for Mac x86_64, because it compiled without AVX flags. Accelerate works good enough.
I think that in most cases performance for non-AVX CPUs will be very bad. Also according to Steam Survey, 90% of CPUs supports AVX2. So the best way address it is probably just check hardware in runtime and throw error if AVX isn't available.
If you for some reason would need to run this library on non-AVX supported device - recompile whisper.cpp libraries.
The text was updated successfully, but these errors were encountered: