ggml-cpu: fix cross-compilation to Windows from Linux
Fix compilation error when cross-compiling ggml-cpu for Windows using MinGW-w64 on Linux. The _WIN32_WINNT macro is only defined by MSVC headers, causing undefined macro warnings with GCC/MinGW. When cross-compiling llama.cpp for Windows from Linux using MinGW-w64, the `_WIN32_WINNT` macro is not defined (it's provided by MSVC SDK headers). This causes compilation warnings or errors. The fix adds `defined(_MSC_VER)` guard to ensure this Windows-specific code path is only evaluated when compiling with MSVC.
This commit is contained in:
parent
4065c1a3a6
commit
e6b05bbe5c
|
|
@ -2491,7 +2491,7 @@ static bool ggml_thread_apply_priority(int32_t prio) {
|
|||
// Newer Windows 11 versions aggressively park (offline) CPU cores and often place
|
||||
// all our threads onto the first 4 cores which results in terrible performance with
|
||||
// n_threads > 4
|
||||
#if _WIN32_WINNT >= 0x0602
|
||||
#if defined(_MSC_VER) && _WIN32_WINNT >= 0x0602
|
||||
THREAD_POWER_THROTTLING_STATE t;
|
||||
ZeroMemory(&t, sizeof(t));
|
||||
t.Version = THREAD_POWER_THROTTLING_CURRENT_VERSION;
|
||||
|
|
|
|||
Loading…
Reference in New Issue