make : fix Linux machines supporting AVX1 not AVX2 (#1162)

e.g. ancient CPU E5-2670 (v1)

See issue #1126

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
pull/1148/head
Eric Swanson 2023-08-25 08:52:22 -04:00 committed by GitHub
parent c84cf87261
commit 8ce20f0f3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -74,7 +74,12 @@ ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686))
CPUINFO_CMD := sysinfo -cpu
endif
ifdef CPUINFO_CMD
ifdef CPUINFO_CMD
AVX_M := $(shell $(CPUINFO_CMD) | grep -m 1 "avx ")
ifneq (,$(findstring avx,$(AVX_M)))
CFLAGS += -mavx
endif
AVX2_M := $(shell $(CPUINFO_CMD) | grep -m 1 "avx2 ")
ifneq (,$(findstring avx2,$(AVX2_M)))
CFLAGS += -mavx2