Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion ggml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,29 @@ else()
set(GGML_BLAS_VENDOR_DEFAULT "Generic")
endif()

if (CMAKE_CROSSCOMPILING)
# Disable native builds when cross-compiling or when the target processor
# differs from the host processor. In some environments (e.g. Windows
# arm64 cross-builds using clang), CMake does not set the
# CMAKE_CROSSCOMPILING flag even though the target architecture is
# different. Passing `-march=native` in such cases results in compiler
# errors, so explicitly check the processor as well.
if (CMAKE_CROSSCOMPILING OR NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR))
set(GGML_NATIVE_DEFAULT OFF)
set(GGML_CROSS_DIFFERENT_ARCH ON)
else()
set(GGML_NATIVE_DEFAULT ON)
set(GGML_CROSS_DIFFERENT_ARCH OFF)
endif()

# When cross-compiling with clang for Windows the default CodeView debug
# info can trigger LLVM backend crashes. In that case, prefer DWARF
# debug info instead.
if (GGML_CROSS_DIFFERENT_ARCH AND WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options(-gdwarf-4)
foreach(lang C CXX)
string(REGEX REPLACE "-Xclang[ ]+-gcodeview" "" CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}")
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}" CACHE STRING "" FORCE)
endforeach()
endif()

# general
Expand Down
2 changes: 1 addition & 1 deletion ggml/src/iqk/iqk_quantize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <unordered_map>
#include <string>

#if defined(_MSC_VER)
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
#pragma warning(disable: 4244 4267) // possible loss of data
#include <intrin.h>
#include <ammintrin.h>
Expand Down
Loading