Skip to content

Commit 3a07714

Browse files
authored
llama : allow using mmap without PrefetchVirtualMemory, apply GGML_WIN_VER to llama.cpp sources (#14013)
1 parent d01d112 commit 3a07714

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ if (NOT TARGET ggml AND NOT LLAMA_USE_SYSTEM_GGML)
159159
# ... otherwise assume ggml is added by a parent CMakeLists.txt
160160
endif()
161161

162+
if (MINGW)
163+
# Target Windows 8 for PrefetchVirtualMemory
164+
add_compile_definitions(_WIN32_WINNT=${GGML_WIN_VER})
165+
endif()
166+
162167
#
163168
# build the library
164169
#

ggml/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ set(GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM")
137137
set(GGML_CPU_POWERPC_CPUTYPE "" CACHE STRING "ggml: CPU type for PowerPC")
138138

139139

140-
if (WIN32)
140+
if (MINGW)
141141
set(GGML_WIN_VER "0x602" CACHE STRING "ggml: Windows version")
142142
endif()
143143

ggml/src/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ if (NOT MSVC)
125125
endif()
126126

127127
if (MINGW)
128-
# Target Windows 8 for PrefetchVirtualMemory
129128
add_compile_definitions(_WIN32_WINNT=${GGML_WIN_VER})
130129
endif()
131130

src/llama-mmap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ struct llama_mmap::impl {
401401
}
402402
}
403403
#else
404-
throw std::runtime_error("PrefetchVirtualMemory unavailable");
404+
LLAMA_LOG_DEBUG("skipping PrefetchVirtualMemory because _WIN32_WINNT < 0x602\n");
405405
#endif
406406
}
407407
}

0 commit comments

Comments
 (0)