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