11cmake_minimum_required (VERSION 3.14) # for add_link_options and implicit target directories.
2- project ("ggml" C CXX)
2+ project ("ggml" C CXX ASM)
3+
4+ ### GGML Version
5+ set (GGML_VERSION_MAJOR 0)
6+ set (GGML_VERSION_MINOR 9)
7+ set (GGML_VERSION_PATCH 4)
8+ set (GGML_VERSION_BASE "${GGML_VERSION_MAJOR} .${GGML_VERSION_MINOR} .${GGML_VERSION_PATCH} " )
9+
10+ find_program (GIT_EXE NAMES git git.exe NO_CMAKE_FIND_ROOT_PATH )
11+ if (GIT_EXE)
12+ # Get current git commit hash
13+ execute_process (COMMAND ${GIT_EXE} rev-parse --short HEAD
14+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
15+ OUTPUT_VARIABLE GGML_BUILD_COMMIT
16+ OUTPUT_STRIP_TRAILING_WHITESPACE
17+ ERROR_QUIET
18+ )
19+
20+ # Check if the working directory is dirty (i.e., has uncommitted changes)
21+ execute_process (COMMAND ${GIT_EXE} diff-index --quiet HEAD -- .
22+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
23+ RESULT_VARIABLE GGML_GIT_DIRTY
24+ ERROR_QUIET
25+ )
26+ endif ()
27+
28+ # Build the version string with optional dirty flag
29+ set (GGML_VERSION "${GGML_VERSION_BASE} " )
30+ if (GGML_GIT_DIRTY AND NOT GGML_GIT_DIRTY EQUAL 0)
31+ set (GGML_VERSION "${GGML_VERSION} -dirty" )
32+ endif ()
33+
34+ if (NOT GGML_BUILD_COMMIT)
35+ set (GGML_BUILD_COMMIT "unknown" )
36+ endif ()
37+
338include (CheckIncludeFileCXX)
439
540set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
@@ -129,18 +164,19 @@ endif()
129164option (GGML_LASX "ggml: enable lasx" ON )
130165option (GGML_LSX "ggml: enable lsx" ON )
131166option (GGML_RVV "ggml: enable rvv" ON )
132- option (GGML_RV_ZFH "ggml: enable riscv zfh" OFF )
167+ option (GGML_RV_ZFH "ggml: enable riscv zfh" ON )
168+ option (GGML_RV_ZVFH "ggml: enable riscv zvfh" ON )
169+ option (GGML_RV_ZICBOP "ggml: enable riscv zicbop" ON )
133170option (GGML_XTHEADVECTOR "ggml: enable xtheadvector" OFF )
134- option (GGML_VXE "ggml: enable vxe" ON )
135- option (GGML_NNPA "ggml: enable nnpa" OFF ) # temp disabled by default, see: https://github.com/ggml-org/llama.cpp/issues/14877
171+ option (GGML_VXE "ggml: enable vxe" ${GGML_NATIVE} )
136172
137173option (GGML_CPU_ALL_VARIANTS "ggml: build all variants of the CPU backend (requires GGML_BACKEND_DL)" OFF )
138174set (GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM" )
139175set (GGML_CPU_POWERPC_CPUTYPE "" CACHE STRING "ggml: CPU type for PowerPC" )
140176
141177
142178if (MINGW)
143- set (GGML_WIN_VER "0x602 " CACHE STRING "ggml: Windows version" )
179+ set (GGML_WIN_VER "0xA00 " CACHE STRING "ggml: Windows version" )
144180endif ()
145181
146182# ggml core
@@ -158,7 +194,6 @@ option(GGML_CUDA "ggml: use CUDA"
158194option (GGML_MUSA "ggml: use MUSA" OFF )
159195option (GGML_CUDA_FORCE_MMQ "ggml: use mmq kernels instead of cuBLAS" OFF )
160196option (GGML_CUDA_FORCE_CUBLAS "ggml: always use cuBLAS instead of mmq kernels" OFF )
161- option (GGML_CUDA_F16 "ggml: use 16 bit floats for some calculations" OFF )
162197set (GGML_CUDA_PEER_MAX_BATCH_SIZE "128" CACHE STRING
163198 "ggml: max. batch size for using peer access" )
164199option (GGML_CUDA_NO_PEER_COPY "ggml: do not use peer to peer copies" OFF )
@@ -174,8 +209,8 @@ option(GGML_HIP "ggml: use HIP"
174209option (GGML_HIP_GRAPHS "ggml: use HIP graph, experimental, slow" OFF )
175210option (GGML_HIP_NO_VMM "ggml: do not try to use HIP VMM" ON )
176211option (GGML_HIP_ROCWMMA_FATTN "ggml: enable rocWMMA for FlashAttention" OFF )
177- option (GGML_HIP_FORCE_ROCWMMA_FATTN_GFX12 "ggml: enable rocWMMA FlashAttention on GFX12" OFF )
178212option (GGML_HIP_MMQ_MFMA "ggml: enable MFMA MMA for CDNA in MMQ" ON )
213+ option (GGML_HIP_EXPORT_METRICS "ggml: enable kernel perf metrics output" OFF )
179214option (GGML_MUSA_GRAPHS "ggml: use MUSA graph, experimental, unstable" OFF )
180215option (GGML_MUSA_MUDNN_COPY "ggml: enable muDNN for accelerated copy" OFF )
181216option (GGML_VULKAN "ggml: use Vulkan" OFF )
@@ -187,8 +222,11 @@ option(GGML_VULKAN_VALIDATE "ggml: enable Vulkan validation"
187222option (GGML_VULKAN_RUN_TESTS "ggml: run Vulkan tests" OFF )
188223option (GGML_WEBGPU "ggml: use WebGPU" OFF )
189224option (GGML_WEBGPU_DEBUG "ggml: enable WebGPU debug output" OFF )
225+ option (GGML_WEBGPU_CPU_PROFILE "ggml: enable WebGPU profiling (CPU)" OFF )
226+ option (GGML_WEBGPU_GPU_PROFILE "ggml: enable WebGPU profiling (GPU)" OFF )
227+
228+ option (GGML_ZDNN "ggml: use zDNN" OFF )
190229option (GGML_METAL "ggml: use Metal" ${GGML_METAL_DEFAULT} )
191- option (GGML_METAL_USE_BF16 "ggml: use bfloat if available" OFF )
192230option (GGML_METAL_NDEBUG "ggml: disable Metal debugging" OFF )
193231option (GGML_METAL_SHADER_DEBUG "ggml: compile Metal with -fno-fast-math" OFF )
194232option (GGML_METAL_EMBED_LIBRARY "ggml: embed Metal library" ${GGML_METAL} )
@@ -213,6 +251,8 @@ option(GGML_OPENCL_USE_ADRENO_KERNELS "ggml: use optimized kernels for Adr
213251set (GGML_OPENCL_TARGET_VERSION "300" CACHE STRING
214252 "gmml: OpenCL API version to target" )
215253
254+ option (GGML_HEXAGON "ggml: enable Hexagon backend" OFF )
255+
216256# toolchain for vulkan-shaders-gen
217257set (GGML_VULKAN_SHADERS_GEN_TOOLCHAIN "" CACHE FILEPATH "ggml: toolchain file for vulkan-shaders-gen" )
218258
@@ -299,26 +339,6 @@ endif()
299339# Create CMake package
300340#
301341
302- # Generate version info based on git commit.
303-
304- if (NOT DEFINED GGML_BUILD_NUMBER)
305- find_program (GIT_EXE NAMES git git.exe REQUIRED NO_CMAKE_FIND_ROOT_PATH )
306- execute_process (COMMAND ${GIT_EXE} rev-list --count HEAD
307- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
308- OUTPUT_VARIABLE GGML_BUILD_NUMBER
309- OUTPUT_STRIP_TRAILING_WHITESPACE
310- )
311-
312- if (GGML_BUILD_NUMBER EQUAL 1)
313- message (WARNING "GGML build version fixed at 1 likely due to a shallow clone." )
314- endif ()
315-
316- execute_process (COMMAND ${GIT_EXE} rev-parse --short HEAD
317- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
318- OUTPUT_VARIABLE GGML_BUILD_COMMIT
319- OUTPUT_STRIP_TRAILING_WHITESPACE
320- )
321- endif ()
322342
323343
324344# Capture variables prefixed with GGML_.
@@ -347,7 +367,7 @@ set(GGML_VARIABLES_EXPANDED ${variable_set_statements})
347367
348368# Create the CMake package and set install location.
349369
350- set (GGML_INSTALL_VERSION 0.0. ${GGML_BUILD_NUMBER } )
370+ set (GGML_INSTALL_VERSION ${GGML_VERSION } )
351371set (GGML_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location of header files" )
352372set (GGML_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Location of library files" )
353373set (GGML_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Location of binary files" )
0 commit comments