char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Georgi Gerganovggml : bump version to 0.24.0 (ggml/1627)eeea73161

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