]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
make : use unaligned vector moves on MinGW (#2945)
authorCebtenzzre <redacted>
Fri, 1 Sep 2023 13:53:14 +0000 (09:53 -0400)
committerGitHub <redacted>
Fri, 1 Sep 2023 13:53:14 +0000 (16:53 +0300)
Fixes #2922

Makefile

index ef1eef6ac34808e158e31e72421cb20645a8e975..23f050c0d7a133efb786c00595beb61ee2a274f8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -177,6 +177,14 @@ ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
        #CXXFLAGS += -mssse3
 endif
 
+# The stack is only 16-byte aligned on Windows, so don't let gcc emit aligned moves.
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
+# https://github.com/ggerganov/llama.cpp/issues/2922
+ifneq '' '$(findstring mingw,$(shell $(CC) -dumpmachine))'
+       CFLAGS   += -Xassembler -muse-unaligned-vector-move
+       CXXFLAGS += -Xassembler -muse-unaligned-vector-move
+endif
+
 ifneq ($(filter aarch64%,$(UNAME_M)),)
        # Apple M1, M2, etc.
        # Raspberry Pi 3, 4, Zero 2 (64-bit)