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
20 changes: 18 additions & 2 deletions cmake/arm64-windows-llvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,21 @@ set( CMAKE_CXX_COMPILER_TARGET ${target} )
set( arch_c_flags "-march=armv8.7-a -Xclang -target-feature -Xclang +fullfp16 -fvectorize -ffp-model=fast -fno-finite-math-only" )
set( warn_c_flags "-Wno-format -Wno-unused-variable -Wno-unused-function -Wno-gnu-zero-variadic-macro-arguments" )

set( CMAKE_C_FLAGS_INIT "${arch_c_flags} ${warn_c_flags}" )
set( CMAKE_CXX_FLAGS_INIT "${arch_c_flags} ${warn_c_flags}" )
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "")

set(base_flags "${arch_c_flags} ${warn_c_flags}")
# Disable CodeView generation as it causes crashes when cross compiling with
# clang-cl; instead rely solely on DWARF debug information.
set(debug_flags "-g -gdwarf-4 -Xclang -gno-codeview")

set(CMAKE_C_FLAGS_INIT "${base_flags}")
set(CMAKE_CXX_FLAGS_INIT "${base_flags}")

set(CMAKE_C_FLAGS_DEBUG_INIT "${debug_flags}")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "${debug_flags}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -DNDEBUG ${debug_flags}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -DNDEBUG ${debug_flags}")
set(CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
11 changes: 10 additions & 1 deletion examples/quantize-stats/quantize-stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,24 @@
#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267) // possible loss of data
#include <intrin.h>
#if defined(_M_X64) || defined(_M_IX86)
#include <ammintrin.h>
#include <nmmintrin.h>
#include <immintrin.h>
#endif
#include <stdlib.h>
inline int popcount(uint8_t x) { return __popcnt(x); }
#if defined(_M_X64) || defined(_M_IX86)
inline int popcount(uint8_t x) { return __popcnt(x); }
inline int popcount(uint16_t x) { return __popcnt(x); }
inline int popcount(uint32_t x) { return __popcnt(x); }
inline int popcount(uint64_t x) { return _mm_popcnt_u64(x); }
#else
inline int popcount(uint8_t x) { return __builtin_popcount(x); }
inline int popcount(uint16_t x) { return __builtin_popcount(x); }
inline int popcount(uint32_t x) { return __builtin_popcount(x); }
inline int popcount(uint64_t x) { return __builtin_popcountll(x); }
#endif
#else
constexpr int popcount(uint8_t x) { return __builtin_popcount(x); }
constexpr int popcount(uint16_t x) { return __builtin_popcount(x); }
constexpr int popcount(uint32_t x) { return __builtin_popcount(x); }
Expand Down
2 changes: 1 addition & 1 deletion ggml/src/ggml-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ static inline ggml_fp16_t ggml_compute_fp32_to_fp16(float f) {
#include <intrin.h>
#else
#if defined(__AVX__) || defined(__AVX2__) || defined(__AVX512F__) || defined(__SSSE3__) || defined(__SSE3__) || defined(__SSE__)
#if !defined(__riscv)
#if !defined(__riscv) && !defined(__aarch64__)
#include <immintrin.h>
#endif
#endif
Expand Down
11 changes: 10 additions & 1 deletion ggml/src/iqk/iqk_quantize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,24 @@
#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267) // possible loss of data
#include <intrin.h>
#if defined(_M_X64) || defined(_M_IX86)
#include <ammintrin.h>
#include <nmmintrin.h>
#include <immintrin.h>
#endif
#include <stdlib.h>
inline int popcount(uint8_t x) { return __popcnt(x); }
#if defined(_M_X64) || defined(_M_IX86)
inline int popcount(uint8_t x) { return __popcnt(x); }
inline int popcount(uint16_t x) { return __popcnt(x); }
inline int popcount(uint32_t x) { return __popcnt(x); }
inline int popcount(uint64_t x) { return _mm_popcnt_u64(x); }
#else
inline int popcount(uint8_t x) { return __builtin_popcount(x); }
inline int popcount(uint16_t x) { return __builtin_popcount(x); }
inline int popcount(uint32_t x) { return __builtin_popcount(x); }
inline int popcount(uint64_t x) { return __builtin_popcountll(x); }
#endif
#else
constexpr int popcount(uint8_t x) { return __builtin_popcount(x); }
constexpr int popcount(uint16_t x) { return __builtin_popcount(x); }
constexpr int popcount(uint32_t x) { return __builtin_popcount(x); }
Expand Down
Loading