whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

Not working on Windows 11 Pro ARM64

Open GewoonJaap opened this issue 1 year ago • 8 comments

I tried compiling and running whisper on Windows 11 Pro on ARM64, sadly it doesn't work.

When compiling using Visual Studio 2022 I used to following profile: image

When reloading the CMAKELists.txt the console prints that it detected a x84_x64 system, which is wrong because CMAKE_SYSTEM_PROCESSOR reports ARM64, so I added that to the CMAKELists.txt image

Building will now result in an error from: immintrin.h: This header is specific to X86 and X64 targets This file is included in ggml.c files.

I tried disabling the include of this immintrin.h file and enable the ARM_NEON includes. This builds a .DLL, however when trying to run this DDL it will give memory errors. Could you help me out getting this to work on ARM64?

GewoonJaap avatar Feb 18 '23 09:02 GewoonJaap

Probably MSVC does not define the __ARM_NEON macro which is used in ggml to determine if we are building for ARM. Try to figure out which macro is available and update the checks in ggml.h and ggml.c:

  • https://github.com/ggerganov/whisper.cpp/blob/f254e787371091552f3e01623dfeca03fda9bc70/ggml.h#L186
  • https://github.com/ggerganov/whisper.cpp/blob/f254e787371091552f3e01623dfeca03fda9bc70/ggml.c#L129
  • https://github.com/ggerganov/whisper.cpp/blob/f254e787371091552f3e01623dfeca03fda9bc70/ggml.c#L366
  • https://github.com/ggerganov/whisper.cpp/blob/f254e787371091552f3e01623dfeca03fda9bc70/ggml.c#L8553

ggerganov avatar Feb 18 '23 10:02 ggerganov

Is there a command to list the available macros?

GewoonJaap avatar Feb 18 '23 10:02 GewoonJaap

I just checked my DLL again, and I think it might actually work with my hack ^^ image

The transcription isn't right tho, but maybe it is the model file i.c.m. with my .wav file. I will try find the right macro

GewoonJaap avatar Feb 18 '23 10:02 GewoonJaap

Here are some additional resources:

  • https://learn.microsoft.com/en-us/cpp/build/reference/arch-arm64
  • https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros

I think to build it properly, you need to add to CMakeLists.txt the flag /arch:ARM64 (similar to how it is currently done for AVX2). And then in the code, you have to check for _M_ARM64 instead of __ARM_NEON.

But not 100% sure if that's all. Let us know if you make progress.

ggerganov avatar Feb 18 '23 10:02 ggerganov

Yup, that made it compile without problems! image I don't like this output.. Only ,'s and the timestamp looks messed up? It also takes forever to transcript with the base model, while on my 64 bit windows machine its done within seconds

GewoonJaap avatar Feb 18 '23 10:02 GewoonJaap

(Using the Windows 2023 DevKit)

GewoonJaap avatar Feb 18 '23 10:02 GewoonJaap

image

Locally compiled Whisper.Net, same results, it even detects the language as HAW?? Never heard of that before haha. This model + .wav works fine on Windows 64 bit.

I think something must be wrong in the compiled .dll?

GewoonJaap avatar Feb 18 '23 10:02 GewoonJaap

I can't get it to work :( https://github.com/GewoonJaap/whisper.cpp/commit/c5df645f4c4426e000a3e205c8cae768a8ae7561 These are my changes. Locally I tried to change the arm_neon.h import to all kind of arm64 imports, but it keeps outputting ,'s What could be going wrong here?

GewoonJaap avatar Feb 18 '23 11:02 GewoonJaap

Same on win 10, I am using the released bin

darkzbaron avatar May 17 '23 10:05 darkzbaron