-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CPU runner without any optimization like AVX. Upstreamed to ollama/ollama#8224.
- Loading branch information
1 parent
c34b4be
commit 035db09
Showing
2 changed files
with
37 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff --git a/make/Makefile.cpu b/make/Makefile.cpu | ||
index 968ae934..ca4d7df2 100644 | ||
--- a/make/Makefile.cpu | ||
+++ b/make/Makefile.cpu | ||
@@ -8,6 +8,7 @@ ifeq ($(origin CUSTOM_CPU_FLAGS),undefined) | ||
RUNNERS = cpu_avx cpu_avx2 | ||
endif | ||
endif | ||
+RUNNERS += cpu | ||
|
||
DIST_RUNNERS = $(addprefix $(RUNNERS_DIST_DIR)/,$(addsuffix /ollama_llama_server$(EXE_EXT),$(RUNNERS))) | ||
BUILD_RUNNERS = $(addprefix $(RUNNERS_BUILD_DIR)/,$(addsuffix /ollama_llama_server$(EXE_EXT),$(RUNNERS))) | ||
@@ -16,6 +17,11 @@ cpu: $(BUILD_RUNNERS) | ||
|
||
dist: $(DIST_RUNNERS) | ||
|
||
+$(RUNNERS_BUILD_DIR)/cpu/ollama_llama_server$(EXE_EXT): TARGET_CPU_FLAGS="" | ||
+$(RUNNERS_BUILD_DIR)/cpu/ollama_llama_server$(EXE_EXT): ./llama/*.go ./llama/runner/*.go $(COMMON_SRCS) $(COMMON_HDRS) | ||
+ @-mkdir -p $(dir $@) | ||
+ GOARCH=$(ARCH) go build -buildmode=pie $(CPU_GOFLAGS) -trimpath -tags $(subst $(space),$(comma),$(TARGET_CPU_FLAGS)) -o $@ ./cmd/runner | ||
+ | ||
$(RUNNERS_BUILD_DIR)/cpu_avx/ollama_llama_server$(EXE_EXT): TARGET_CPU_FLAGS="avx" | ||
$(RUNNERS_BUILD_DIR)/cpu_avx/ollama_llama_server$(EXE_EXT): ./llama/*.go ./llama/runner/*.go $(COMMON_SRCS) $(COMMON_HDRS) | ||
@-mkdir -p $(dir $@) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters