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>
This commit is contained in:
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

View File

@ -75,6 +75,11 @@ ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686))
endif 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 ") AVX2_M := $(shell $(CPUINFO_CMD) | grep -m 1 "avx2 ")
ifneq (,$(findstring avx2,$(AVX2_M))) ifneq (,$(findstring avx2,$(AVX2_M)))
CFLAGS += -mavx2 CFLAGS += -mavx2