ggerganov / whisper.cpp

Port of OpenAI's Whisper model in C/C++
MIT License
35.38k stars 3.61k forks source link

Fix NoAvx build configuration for AVX enabled machines. #2523

Closed sandrohanea closed 1 day ago

sandrohanea commented 2 days ago

I want to build Whisper Runtimes for machines without AVX on an AVX-enabled host with Windows OS. This is for providing the runtimes for Whisper.net for users without AVX,

Because the checks if AVX, AVX2, etc are executed regardless of if the options are provided or not and updated it anyway, I cannot build these runtimes for Whisper.net.Runtime.NoAvx:

See: https://github.com/sandrohanea/whisper.net/issues/239

I checked the build and indeed, even if I set -DGGML_AVX=OFF it will still be set to true because it is available on the host machine: https://github.com/sandrohanea/whisper.net/actions/runs/11572290952/job/32211959849 image

This PR is addressing this issue to run those checks only if the option is already true, allowing it to be overridden to false if the capability is not found on the machine.

It also changes the default for MSVC to have INS_ENB by default on (to keep the same behaviour if building on an AVX enabled host)

This configuration will allow:

slaren commented 1 day ago

The AVX options are intended to be used for cross-compiling to a specific instruction set independently of the host computer. If you don't want this behavior, you need to disable GGML_NATIVE.

sandrohanea commented 1 day ago

Got it, I misunderstood it and was not disabling GGML_NATIVE.

If disabling GGML_NATIVE I am able to build both AVX-Enabled Libs and Not-AVX-Enabled Libs using one single host (that have AVX).

Thank you for the answers and your time @slaren , @ggerganov (will close this now).