Skip to content

Commit 4ba2e6b

Browse files
authored
make : disable avx in case f16c is not available (ggml-org#706)
Why: * ggml.c does not support AVX without F16C
1 parent 9694245 commit 4ba2e6b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686))
7777
CFLAGS += -mavx2
7878
endif
7979
else ifeq ($(UNAME_S),Linux)
80-
AVX1_M := $(shell grep "avx " /proc/cpuinfo)
81-
ifneq (,$(findstring avx,$(AVX1_M)))
82-
CFLAGS += -mavx
83-
endif
8480
AVX2_M := $(shell grep "avx2 " /proc/cpuinfo)
8581
ifneq (,$(findstring avx2,$(AVX2_M)))
8682
CFLAGS += -mavx2
@@ -92,16 +88,17 @@ ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686))
9288
F16C_M := $(shell grep "f16c " /proc/cpuinfo)
9389
ifneq (,$(findstring f16c,$(F16C_M)))
9490
CFLAGS += -mf16c
91+
92+
AVX1_M := $(shell grep "avx " /proc/cpuinfo)
93+
ifneq (,$(findstring avx,$(AVX1_M)))
94+
CFLAGS += -mavx
95+
endif
9596
endif
9697
SSE3_M := $(shell grep "sse3 " /proc/cpuinfo)
9798
ifneq (,$(findstring sse3,$(SSE3_M)))
9899
CFLAGS += -msse3
99100
endif
100101
else ifeq ($(UNAME_S),Haiku)
101-
AVX1_M := $(shell sysinfo -cpu | grep "AVX ")
102-
ifneq (,$(findstring avx,$(AVX1_M)))
103-
CFLAGS += -mavx
104-
endif
105102
AVX2_M := $(shell sysinfo -cpu | grep "AVX2 ")
106103
ifneq (,$(findstring avx2,$(AVX2_M)))
107104
CFLAGS += -mavx2
@@ -113,6 +110,11 @@ ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686))
113110
F16C_M := $(shell sysinfo -cpu | grep "F16C ")
114111
ifneq (,$(findstring f16c,$(F16C_M)))
115112
CFLAGS += -mf16c
113+
114+
AVX1_M := $(shell sysinfo -cpu | grep "AVX ")
115+
ifneq (,$(findstring avx,$(AVX1_M)))
116+
CFLAGS += -mavx
117+
endif
116118
endif
117119
else
118120
CFLAGS += -mfma -mf16c -mavx -mavx2

0 commit comments

Comments
 (0)