Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/ggml/blob/master/CMakeLists.txt # ggml [Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `ggml / CMakeLists.txt` 503 lines ยท 21909 bytes Raw Blame History 1 cmake_minimum_required(VERSION 3.14...3.28) # for add_link_options and implicit target directories. 2 3 project("ggml" C CXX ASM) 4 5 ### GGML Version 6 set(GGML_VERSION_MAJOR 0) 7 set(GGML_VERSION_MINOR 29) 8 set(GGML_VERSION_PATCH 0) 9 set(GGML_VERSION_BASE "${GGML_VERSION_MAJOR}.${GGML_VERSION_MINOR}.${GGML_VERSION_PATCH}") 10 11 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") 12 13 find_program(GIT_EXE NAMES git git.exe NO_CMAKE_FIND_ROOT_PATH) 14 if(GIT_EXE) 15 # Get current git commit hash 16 execute_process(COMMAND ${GIT_EXE} rev-parse --short HEAD 17 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 18 OUTPUT_VARIABLE GGML_BUILD_COMMIT 19 OUTPUT_STRIP_TRAILING_WHITESPACE 20 ERROR_QUIET 21 ) 22 23 # Check if the working directory is dirty (i.e., has uncommitted changes) 24 execute_process(COMMAND ${GIT_EXE} diff-index --quiet HEAD -- . 25 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 26 RESULT_VARIABLE GGML_GIT_DIRTY 27 ERROR_QUIET 28 ) 29 endif() 30 31 set(GGML_VERSION "${GGML_VERSION_BASE}") 32 33 if(NOT GGML_BUILD_COMMIT) 34 set(GGML_BUILD_COMMIT "unknown") 35 endif() 36 37 # Build the commit string with optional dirty flag 38 if(DEFINED GGML_GIT_DIRTY AND GGML_GIT_DIRTY EQUAL 1) 39 set(GGML_BUILD_COMMIT "${GGML_BUILD_COMMIT}-dirty") 40 endif() 41 42 include(CheckIncludeFileCXX) 43 44 set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 45 46 if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE) 47 set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) 48 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 49 endif() 50 51 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) 52 set(GGML_STANDALONE ON) 53 54 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 55 56 # configure project version 57 # TODO 58 else() 59 set(GGML_STANDALONE OFF) 60 61 if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) 62 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 63 endif() 64 endif() 65 66 if (EMSCRIPTEN) 67 set(BUILD_SHARED_LIBS_DEFAULT OFF) 68 69 option(GGML_WASM_SINGLE_FILE "ggml: embed WASM inside the generated ggml.js" ON) 70 else() 71 if (MINGW) 72 set(BUILD_SHARED_LIBS_DEFAULT OFF) 73 else() 74 set(BUILD_SHARED_LIBS_DEFAULT ON) 75 endif() 76 endif() 77 78 # remove the lib prefix on win32 mingw 79 if (WIN32) 80 set(CMAKE_STATIC_LIBRARY_PREFIX "") 81 set(CMAKE_SHARED_LIBRARY_PREFIX "") 82 set(CMAKE_SHARED_MODULE_PREFIX "") 83 endif() 84 85 option(BUILD_SHARED_LIBS "ggml: build shared libraries" ${BUILD_SHARED_LIBS_DEFAULT}) 86 option(GGML_BACKEND_DL "ggml: build backends as dynamic libraries (requires BUILD_SHARED_LIBS)" OFF) 87 set(GGML_BACKEND_DIR "" CACHE PATH "ggml: directory to load dynamic backends from (requires GGML_BACKEND_DL") 88 89 # 90 # option list 91 # 92 93 # TODO: mark all options as advanced when not GGML_STANDALONE 94 95 if (APPLE) 96 set(GGML_METAL_DEFAULT ON) 97 set(GGML_BLAS_DEFAULT ON) 98 set(GGML_BLAS_VENDOR_DEFAULT "Apple") 99 else() 100 set(GGML_METAL_DEFAULT OFF) 101 set(GGML_BLAS_DEFAULT OFF) 102 set(GGML_BLAS_VENDOR_DEFAULT "Generic") 103 endif() 104 105 if (CMAKE_CROSSCOMPILING OR DEFINED ENV{SOURCE_DATE_EPOCH}) 106 message(STATUS "Setting GGML_NATIVE_DEFAULT to OFF") 107 set(GGML_NATIVE_DEFAULT OFF) 108 else() 109 set(GGML_NATIVE_DEFAULT ON) 110 endif() 111 112 # defaults 113 if (NOT GGML_LLAMAFILE_DEFAULT) 114 set(GGML_LLAMAFILE_DEFAULT OFF) 115 endif() 116 117 if (NOT GGML_CUDA_GRAPHS_DEFAULT) 118 set(GGML_CUDA_GRAPHS_DEFAULT OFF) 119 endif() 120 121 # general 122 option(GGML_STATIC "ggml: static link libraries" OFF) 123 option(GGML_NATIVE "ggml: optimize the build for the current system" ${GGML_NATIVE_DEFAULT}) 124 option(GGML_LTO "ggml: enable link time optimization" OFF) 125 option(GGML_CCACHE "ggml: use ccache if available" ON) 126 127 # debug 128 option(GGML_ALL_WARNINGS "ggml: enable all compiler warnings" ON) 129 option(GGML_ALL_WARNINGS_3RD_PARTY "ggml: enable all compiler warnings in 3rd party libs" OFF) 130 option(GGML_GPROF "ggml: enable gprof" OFF) 131 132 # build 133 option(GGML_FATAL_WARNINGS "ggml: enable -Werror flag" OFF) 134 135 # sanitizers 136 option(GGML_SANITIZE_THREAD "ggml: enable thread sanitizer" OFF) 137 option(GGML_SANITIZE_ADDRESS "ggml: enable address sanitizer" OFF) 138 option(GGML_SANITIZE_UNDEFINED "ggml: enable undefined sanitizer" OFF) 139 140 # instruction set specific 141 if (GGML_NATIVE OR NOT GGML_NATIVE_DEFAULT) 142 set(INS_ENB OFF) 143 else() 144 set(INS_ENB ON) 145 endif() 146 147 message(DEBUG "GGML_NATIVE : ${GGML_NATIVE}") 148 message(DEBUG "GGML_NATIVE_DEFAULT : ${GGML_NATIVE_DEFAULT}") 149 message(DEBUG "INS_ENB : ${INS_ENB}") 150 151 option(GGML_CPU_HBM "ggml: use memkind for CPU HBM" OFF) 152 option(GGML_CPU_REPACK "ggml: use runtime weight conversion of Q4_0 to Q4_X_X" ON) 153 option(GGML_CPU_KLEIDIAI "ggml: use KleidiAI optimized kernels if applicable" OFF) 154 option(GGML_SSE42 "ggml: enable SSE 4.2" ${INS_ENB}) 155 option(GGML_AVX "ggml: enable AVX" ${INS_ENB}) 156 option(GGML_AVX_VNNI "ggml: enable AVX-VNNI" OFF) 157 option(GGML_AVX2 "ggml: enable AVX2" ${INS_ENB}) 158 option(GGML_BMI2 "ggml: enable BMI2" ${INS_ENB}) 159 option(GGML_AVX512 "ggml: enable AVX512F" OFF) 160 option(GGML_AVX512_VBMI "ggml: enable AVX512-VBMI" OFF) 161 option(GGML_AVX512_VNNI "ggml: enable AVX512-VNNI" OFF) 162 option(GGML_AVX512_BF16 "ggml: enable AVX512-BF16" OFF) 163 if (NOT MSVC) 164 # in MSVC F16C and FMA is implied with AVX2/AVX512 165 option(GGML_FMA "ggml: enable FMA" ${INS_ENB}) 166 option(GGML_F16C "ggml: enable F16C" ${INS_ENB}) 167 # MSVC does not seem to support AMX 168 option(GGML_AMX_TILE "ggml: enable AMX-TILE" OFF) 169 option(GGML_AMX_INT8 "ggml: enable AMX-INT8" OFF) 170 option(GGML_AMX_BF16 "ggml: enable AMX-BF16" OFF) 171 endif() 172 option(GGML_LASX "ggml: enable lasx" ON) 173 option(GGML_LSX "ggml: enable lsx" ON) 174 option(GGML_RVV "ggml: enable rvv" ON) 175 option(GGML_RV_ZFH "ggml: enable riscv zfh" ON) 176 option(GGML_RV_ZVFH "ggml: enable riscv zvfh" ON) 177 option(GGML_RV_ZICBOP "ggml: enable riscv zicbop" ON) 178 option(GGML_RV_ZIHINTPAUSE "ggml: enable riscv zihintpause" ON) 179 option(GGML_RV_ZVFBFWMA "ggml: enable riscv zvfbfwma" OFF) 180 option(GGML_XTHEADVECTOR "ggml: enable xtheadvector" OFF) 181 option(GGML_VXE "ggml: enable vxe" ${GGML_NATIVE}) 182 183 option(GGML_CPU_ALL_VARIANTS "ggml: build all variants of the CPU backend (requires GGML_BACKEND_DL)" OFF) 184 set(GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM") 185 set(GGML_CPU_POWERPC_CPUTYPE "" CACHE STRING "ggml: CPU type for PowerPC") 186 187 # ggml core 188 set(GGML_SCHED_MAX_COPIES "4" CACHE STRING "ggml: max input copies for pipeline parallelism") 189 option(GGML_CPU "ggml: enable CPU backend" ON) 190 option(GGML_SCHED_NO_REALLOC "ggml: disallow reallocations in ggml-alloc (for debugging)" OFF) 191 192 # 3rd party libs / backends 193 option(GGML_ACCELERATE "ggml: enable Accelerate framework" ON) 194 option(GGML_BLAS "ggml: use BLAS" ${GGML_BLAS_DEFAULT}) 195 set(GGML_BLAS_VENDOR ${GGML_BLAS_VENDOR_DEFAULT} CACHE STRING 196 "ggml: BLAS library vendor") 197 option(GGML_LLAMAFILE "ggml: use LLAMAFILE" ${GGML_LLAMAFILE_DEFAULT}) 198 199 option(GGML_CUDA "ggml: use CUDA" OFF) 200 set (GGML_CUDA_CCCL_VERSION "" CACHE STRING "ggml: CCCL git tag to fetch, empty to use the version bundled with the installed CUDA Toolkit") 201 option(GGML_MUSA "ggml: use MUSA" OFF) 202 option(GGML_CUDA_FORCE_MMQ "ggml: use mmq kernels instead of cuBLAS" OFF) 203 option(GGML_CUDA_FORCE_CUBLAS "ggml: always use cuBLAS instead of mmq kernels" OFF) 204 option(GGML_CUDA_NO_PEER_COPY "ggml: do not use peer to peer copies" OFF) 205 option(GGML_CUDA_NO_VMM "ggml: do not try to use CUDA VMM" OFF) 206 option(GGML_CUDA_FA "ggml: compile ggml FlashAttention CUDA kernels" ON) 207 option(GGML_CUDA_FA_ALL_QUANTS "ggml: compile all quants for FlashAttention" OFF) 208 set (GGML_CUDA_FA_QUANTS "q4_0-q4_0;q8_0-q8_0;f16-f16;bf16-bf16" CACHE STRING 209 "ggml: FlashAttention K-V type combinations to compile, \"all\" or a list such as \"q8_0-q8_0;q8_0-q4_0\"") 210 option(GGML_CUDA_GRAPHS "ggml: use CUDA graphs (llama.cpp only)" ${GGML_CUDA_GRAPHS_DEFAULT}) 211 option(GGML_CUDA_NCCL "ggml: use NVIDIA Collective Comm. Library" ON) 212 set (GGML_CUDA_COMPRESSION_MODE "size" CACHE STRING 213 "ggml: cuda link binary compression mode; requires cuda 12.8+") 214 set_property(CACHE GGML_CUDA_COMPRESSION_MODE PROPERTY STRINGS "none;speed;balance;size") 215 216 option(GGML_HIP "ggml: use HIP" OFF) 217 option(GGML_HIP_GRAPHS "ggml: use HIP graph" ON) 218 option(GGML_HIP_RCCL "ggml: use ROCm Collective Comm. Library" OFF) 219 option(GGML_HIP_NO_VMM "ggml: do not try to use HIP VMM" ON) 220 option(GGML_HIP_MMQ_MFMA "ggml: enable MFMA MMA for CDNA in MMQ" ON) 221 option(GGML_HIP_EXPORT_METRICS "ggml: enable kernel perf metrics output" OFF) 222 option(GGML_MUSA_GRAPHS "ggml: use MUSA graph, experimental, unstable" OFF) 223 option(GGML_MUSA_MUDNN_COPY "ggml: enable muDNN for accelerated copy" OFF) 224 option(GGML_VULKAN "ggml: use Vulkan" OFF) 225 option(GGML_VULKAN_CHECK_RESULTS "ggml: run Vulkan op checks" OFF) 226 option(GGML_VULKAN_DEBUG "ggml: enable Vulkan debug output" OFF) 227 option(GGML_VULKAN_MEMORY_DEBUG "ggml: enable Vulkan memory debug output" OFF) 228 option(GGML_VULKAN_SHADER_DEBUG_INFO "ggml: enable Vulkan shader debug info" OFF) 229 option(GGML_VULKAN_VALIDATE "ggml: enable Vulkan validation" OFF) 230 option(GGML_VULKAN_RUN_TESTS "ggml: run Vulkan tests" OFF) 231 option(GGML_WEBGPU "ggml: use WebGPU" OFF) 232 option(GGML_WEBGPU_DEBUG "ggml: enable WebGPU debug output" OFF) 233 option(GGML_WEBGPU_CPU_PROFILE "ggml: enable WebGPU profiling (CPU)" OFF) 234 option(GGML_WEBGPU_GPU_PROFILE "ggml: enable WebGPU profiling (GPU)" OFF) 235 option(GGML_WEBGPU_JSPI "ggml: use JSPI for WebGPU" ON) 236 option(GGML_ZDNN "ggml: use zDNN" OFF) 237 option(GGML_VIRTGPU "ggml: use the VirtGPU/Virglrenderer API Remoting frontend" OFF) 238 option(GGML_VIRTGPU_BACKEND "ggml: build the VirtGPU/Virglrenderer API Remoting backend" OFF) 239 option(GGML_METAL "ggml: use Metal" ${GGML_METAL_DEFAULT}) 240 option(GGML_METAL_NDEBUG "ggml: disable Metal debugging" OFF) 241 option(GGML_METAL_SHADER_DEBUG "ggml: compile Metal with -fno-fast-math" OFF) 242 option(GGML_METAL_EMBED_LIBRARY "ggml: embed Metal library" ${GGML_METAL}) 243 set (GGML_METAL_MACOSX_VERSION_MIN "" CACHE STRING 244 "ggml: metal minimum macOS version") 245 set (GGML_METAL_STD "" CACHE STRING "ggml: metal standard version (-std flag)") 246 set (GGML_METAL_TARGET_OS "macos" CACHE STRING 247 "ggml: metal -mtargetos OS name (macos, ios, xros, tvos)") 248 option(GGML_OPENMP "ggml: use OpenMP" ON) 249 option(GGML_OPENMP_FETCH "ggml: fetch LLVM OpenMP" OFF) 250 option(GGML_RPC "ggml: use RPC" OFF) 251 option(GGML_SYCL "ggml: use SYCL" OFF) 252 option(GGML_SYCL_F16 "ggml: use 16 bit floats for sycl calculations" OFF) 253 option(GGML_SYCL_SUPPORT_XMX "ggml: build the XMX (DPAS) code paths in the SYCL backend" ON) 254 option(GGML_SYCL_GRAPH "ggml: enable graphs in the SYCL backend" ON) 255 option(GGML_SYCL_HOST_MEM_FALLBACK "ggml: allow host memory fallback in SYCL reorder (requires kernel 6.8+)" ON) 256 option(GGML_SYCL_SUPPORT_LEVEL_ZERO_API "ggml: use Level Zero API in SYCL backend" ON) 257 option(GGML_SYCL_DNN "ggml: enable oneDNN in the SYCL backend" ON) 258 set (GGML_SYCL_TARGET "INTEL" CACHE STRING 259 "ggml: sycl target device") 260 set (GGML_SYCL_DEVICE_ARCH "" CACHE STRING 261 "ggml: sycl device architecture") 262 263 option(GGML_OPENVINO "ggml: use OPENVINO" OFF) 264 option(GGML_ET "ggml: use ET backend" OFF) 265 option(GGML_ET_SYSEMU "ggml: use ET backend via sysemu" OFF) 266 267 option(GGML_OPENCL "ggml: use OpenCL" OFF) 268 option(GGML_OPENCL_PROFILING "ggml: use OpenCL profiling (increases overhead)" OFF) 269 option(GGML_OPENCL_EMBED_KERNELS "ggml: embed kernels" ON) 270 option(GGML_OPENCL_USE_ADRENO_KERNELS "ggml: use optimized kernels for Adreno" ON) 271 set (GGML_OPENCL_TARGET_VERSION "300" CACHE STRING 272 "ggml: OpenCL API version to target") 273 274 option(GGML_HEXAGON "ggml: enable Hexagon backend" OFF) 275 276 # toolchain for vulkan-shaders-gen 277 set (GGML_VULKAN_SHADERS_GEN_TOOLCHAIN "" CACHE FILEPATH "ggml: toolchain file for vulkan-shaders-gen") 278 279 option(GGML_ZENDNN "ggml: use ZenDNN" OFF) 280 option(ZENDNN_ROOT "ggml: path to ZenDNN installation" "") 281 282 # extra artifacts 283 option(GGML_BUILD_TESTS "ggml: build tests" ${GGML_STANDALONE}) 284 option(GGML_BUILD_EXAMPLES "ggml: build examples" ${GGML_STANDALONE}) 285 286 # 287 # dependencies 288 # 289 290 set(CMAKE_C_STANDARD 11) 291 set(CMAKE_C_STANDARD_REQUIRED true) 292 293 set(CMAKE_CXX_STANDARD 17) 294 set(CMAKE_CXX_STANDARD_REQUIRED true) 295 296 set(THREADS_PREFER_PTHREAD_FLAG ON) 297 298 find_package(Threads REQUIRED) 299 300 include(GNUInstallDirs) 301 302 # 303 # build the library 304 # 305 306 add_subdirectory(src) 307 308 # 309 # tests and examples 310 # 311 312 if (GGML_BUILD_TESTS) 313 enable_testing() 314 add_subdirectory(tests) 315 endif () 316 317 if (GGML_BUILD_EXAMPLES) 318 add_subdirectory(examples) 319 endif () 320 321 # 322 # install 323 # 324 325 include(CMakePackageConfigHelpers) 326 327 # all public headers 328 set(GGML_PUBLIC_HEADERS 329 include/ggml.h 330 include/ggml-cpu.h 331 include/ggml-alloc.h 332 include/ggml-backend.h 333 include/ggml-blas.h 334 include/ggml-cann.h 335 include/ggml-cpp.h 336 include/ggml-cuda.h 337 include/ggml-opt.h 338 include/ggml-metal.h 339 include/ggml-rpc.h 340 include/ggml-virtgpu.h 341 include/ggml-sycl.h 342 include/ggml-vulkan.h 343 include/ggml-webgpu.h 344 include/ggml-zendnn.h 345 include/ggml-openvino.h 346 include/gguf.h) 347 348 set_target_properties(ggml PROPERTIES PUBLIC_HEADER "${GGML_PUBLIC_HEADERS}") 349 install(TARGETS ggml LIBRARY PUBLIC_HEADER) 350 install(TARGETS ggml-base LIBRARY) 351 352 if (GGML_STANDALONE) 353 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ggml.pc.in 354 ${CMAKE_CURRENT_BINARY_DIR}/ggml.pc 355 @ONLY) 356 357 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ggml.pc 358 DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) 359 endif() 360 361 # 362 # Create CMake package 363 # 364 365 366 367 # Capture variables prefixed with GGML_. 368 369 set(variable_set_statements 370 " 371 ####### Expanded from @GGML_VARIABLES_EXPANED@ by configure_package_config_file() ####### 372 ####### Any changes to this file will be overwritten by the next CMake run ####### 373 374 ") 375 376 set(GGML_SHARED_LIB ${BUILD_SHARED_LIBS}) 377 378 get_cmake_property(all_variables VARIABLES) 379 foreach(variable_name IN LISTS all_variables) 380 if(variable_name MATCHES "^GGML_") 381 string(REPLACE ";" "\\;" 382 variable_value "${${variable_name}}") 383 384 set(variable_set_statements 385 "${variable_set_statements}set(${variable_name} \"${variable_value}\")\n") 386 endif() 387 endforeach() 388 389 set(GGML_VARIABLES_EXPANDED ${variable_set_statements}) 390 391 # Create the CMake package and set install location. 392 393 set(GGML_INSTALL_VERSION ${GGML_VERSION}) 394 set(GGML_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location of header files") 395 set(GGML_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Location of library files") 396 set(GGML_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Location of binary files") 397 398 configure_package_config_file( 399 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ggml-config.cmake.in 400 ${CMAKE_CURRENT_BINARY_DIR}/ggml-config.cmake 401 INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ggml 402 PATH_VARS GGML_INCLUDE_INSTALL_DIR 403 GGML_LIB_INSTALL_DIR 404 GGML_BIN_INSTALL_DIR) 405 406 write_basic_package_version_file( 407 ${CMAKE_CURRENT_BINARY_DIR}/ggml-config-version.cmake 408 VERSION ${GGML_INSTALL_VERSION} 409 COMPATIBILITY SameMajorVersion) 410 411 message(STATUS "ggml version: ${GGML_INSTALL_VERSION}") 412 message(STATUS "ggml commit: ${GGML_BUILD_COMMIT}") 413 414 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ggml-config.cmake 415 ${CMAKE_CURRENT_BINARY_DIR}/ggml-config-version.cmake 416 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ggml) 417 418 if (MSVC) 419 set(MSVC_WARNING_FLAGS 420 /wd4005 # Macro redefinition 421 /wd4244 # Conversion from one type to another type, possible loss of data 422 /wd4267 # Conversion from 'size_t' to a smaller type, possible loss of data 423 /wd4305 # Conversion from 'type1' to 'type2', possible loss of data 424 /wd4566 # Conversion from 'char' to 'wchar_t', possible loss of data 425 /wd4996 # Disable POSIX deprecation warnings 426 /wd4702 # Unreachable code warnings 427 ) 428 set(MSVC_COMPILE_OPTIONS 429 "$<$:/utf-8>" 430 "$<$:/utf-8>" 431 ) 432 function(configure_msvc_target target_name) 433 if(TARGET ${target_name}) 434 target_compile_options(${target_name} PRIVATE ${MSVC_WARNING_FLAGS}) 435 target_compile_options(${target_name} PRIVATE ${MSVC_COMPILE_OPTIONS}) 436 endif() 437 endfunction() 438 439 configure_msvc_target(ggml-base) 440 configure_msvc_target(ggml) 441 configure_msvc_target(ggml-cpu) 442 configure_msvc_target(ggml-cpu-x64) 443 configure_msvc_target(ggml-cpu-sse42) 444 configure_msvc_target(ggml-cpu-sandybridge) 445 # __FMA__ and __F16C__ are not defined in MSVC, however they are implied with AVX2/AVX512 446 # skipping ggml-cpu-ivybridge 447 # skipping ggml-cpu-piledriver 448 configure_msvc_target(ggml-cpu-haswell) 449 configure_msvc_target(ggml-cpu-skylakex) 450 configure_msvc_target(ggml-cpu-cannonlake) 451 configure_msvc_target(ggml-cpu-cascadelake) 452 configure_msvc_target(ggml-cpu-icelake) 453 # MSVC 2022 doesn't support BF16 intrinsics without `/arch:AVX10.1` ?! 454 # https://learn.microsoft.com/en-us/cpp/intrinsics/x64-amd64-intrinsics-list?view=msvc-170 455 # https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170 456 # skipping ggml-cpu-cooperlake 457 # skipping ggml-cpu-zen4 458 configure_msvc_target(ggml-cpu-alderlake) 459 # MSVC doesn't support AMX 460 # skipping ggml-cpu-sapphirerapids 461 462 if (GGML_BUILD_EXAMPLES) 463 configure_msvc_target(common-ggml) 464 configure_msvc_target(common) 465 466 configure_msvc_target(mnist-common) 467 configure_msvc_target(mnist-eval) 468 configure_msvc_target(mnist-train) 469 470 configure_msvc_target(gpt-2-ctx) 471 configure_msvc_target(gpt-2-alloc) 472 configure_msvc_target(gpt-2-backend) 473 configure_msvc_target(gpt-2-sched) 474 configure_msvc_target(gpt-2-quantize) 475 configure_msvc_target(gpt-2-batched) 476 477 configure_msvc_target(gpt-j) 478 configure_msvc_target(gpt-j-quantize) 479 480 configure_msvc_target(magika) 481 configure_msvc_target(yolov3-tiny) 482 configure_msvc_target(sam) 483 484 configure_msvc_target(simple-ctx) 485 configure_msvc_target(simple-backend) 486 endif() 487 488 if (GGML_BUILD_TESTS) 489 configure_msvc_target(test-mul-mat) 490 configure_msvc_target(test-arange) 491 configure_msvc_target(test-backend-ops) 492 configure_msvc_target(test-cont) 493 configure_msvc_target(test-conv-transpose) 494 configure_msvc_target(test-conv-transpose-1d) 495 configure_msvc_target(test-conv1d) 496 configure_msvc_target(test-conv2d) 497 configure_msvc_target(test-conv2d-dw) 498 configure_msvc_target(test-customop) 499 configure_msvc_target(test-dup) 500 configure_msvc_target(test-opt) 501 configure_msvc_target(test-pool) 502 endif () 503 endif()