- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.5k
 
Guard ThreadPowerThrottling for non-MSVC builds #16014
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
base: master
Are you sure you want to change the base?
Guard ThreadPowerThrottling for non-MSVC builds #16014
Conversation
… MinGW compile errors
| 
           Can you try changing the value of GGML_WIN_VER in ggml/cmakelists.txt to a high enough value to enable this command instead?  | 
    
| 
           I believe this is only an issue in old versions of mingw. There is no reason to disable it for all mingw versions. We have CI that tests the build in mingw (msys2).  | 
    
| 
           IIUC we're supposed to set the minimum version we support via _WIN32_WINNT (https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170) and we're setting it to something less than win8 which i think is unintended.  | 
    
| 
           I'm upgrading the audio.whisper R wrapper around whisper.cpp to 1.8.2 (https://github.com/bnosac/audio.whisper/tree/v1.8.2) and also see this error when doing the continuous integration. E.g. https://github.com/bnosac/audio.whisper/actions/runs/18661388118/job/53202464986?pr=80 Is there something I can help to further narrow down the issue / suggested fix?  | 
    
| 
           I installed the latest msys but wasn't able to reproduce this. My suggested steps for how to proceed are at #14953 (comment).  | 
    
| 
           This is very likely a bug in old versions of mingw, so I am not even convinced that we need to do anything. If someone is willing to put the work to figure exactly what version is broken and needs to be guarded we could possibly do that, but I am not sure that we would be doing anyone a favor by disabling the feature, and it might just be easier to update to a newer version of mingw.  | 
    
| 
           FWIW. From the docs there: `Rtools45 consists of Msys2 build tools, GCC 14/MinGW-w64 compiler toolchain, libraries built using the toolchain, and QPDF. Rtools45 supports 64-bit Windows and UCRT as the C runtime. `  | 
    
| 
           I tried using the rtools environment and the build still worked for me. I suspect I'm getting a newer toolchain.  | 
    
Title: Guard ThreadPowerThrottling block for non-MSVC compilers
Description:
This patch wraps the ThreadPowerThrottling block in
ggml-cpu.cwith anMSVC-only preprocessor guard so MinGW/GCC builds don't attempt to compile
Windows SDK-only types (e.g. THREAD_POWER_THROTTLING_STATE).
Patch snippet (apply inside
llama.cpp/ggml/src/ggml-cpu/ggml-cpu.cwhere theThreadPowerThrottling block appears):
Notes:
surrounding #if defined(_MSC_VER) so non-MSVC compilers skip the block.
Suggested PR title:
Guard ThreadPowerThrottling block in ggml-cpu.c for non-MSVC compilers
Suggested PR description:
The ThreadPowerThrottling block references Windows SDK-only types which
cause MinGW/GCC builds to fail with unknown type errors. This change adds
an MSVC-only guard so that MinGW/GCC skip the block. MSVC builds are
unaffected.