From 892ce9827770be54592389891c5fe6d005b19b2e Mon Sep 17 00:00:00 2001 From: Yuri Victorovich Date: Thu, 10 Apr 2025 18:09:26 -0700 Subject: [PATCH] misc/llama-cpp: Fix run-time on older CPUs ... by disabling explicit flags that enable them. --- misc/llama-cpp/Makefile | 3 ++- .../files/patch-ggml_src_ggml-cpu_CMakeLists.txt | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 misc/llama-cpp/files/patch-ggml_src_ggml-cpu_CMakeLists.txt diff --git a/misc/llama-cpp/Makefile b/misc/llama-cpp/Makefile index f59d16d148d3..3230207092e5 100644 --- a/misc/llama-cpp/Makefile +++ b/misc/llama-cpp/Makefile @@ -1,7 +1,7 @@ PORTNAME= llama-cpp DISTVERSIONPREFIX= b DISTVERSION= 5097 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= misc # machine-learning MAINTAINER= yuri@FreeBSD.org @@ -26,6 +26,7 @@ SHEBANG_GLOB= *.py CMAKE_ON= BUILD_SHARED_LIBS CMAKE_OFF= GGML_NATIVE \ + FREEBSD_ALLOW_ADVANCED_CPU_FEATURES \ LLAMA_BUILD_TESTS CMAKE_TESTING_ON= LLAMA_BUILD_TESTS diff --git a/misc/llama-cpp/files/patch-ggml_src_ggml-cpu_CMakeLists.txt b/misc/llama-cpp/files/patch-ggml_src_ggml-cpu_CMakeLists.txt new file mode 100644 index 000000000000..5e6ff248184a --- /dev/null +++ b/misc/llama-cpp/files/patch-ggml_src_ggml-cpu_CMakeLists.txt @@ -0,0 +1,11 @@ +--- ggml/src/ggml-cpu/CMakeLists.txt.orig 2025-04-10 23:26:06 UTC ++++ ggml/src/ggml-cpu/CMakeLists.txt +@@ -236,7 +236,7 @@ function(ggml_add_cpu_backend_variant_impl tag_name) + else () + if (GGML_NATIVE) + list(APPEND ARCH_FLAGS -march=native) +- else () ++ elseif (FREEBSD_ALLOW_ADVANCED_CPU_FEATURES) + list(APPEND ARCH_FLAGS -msse4.2) + list(APPEND ARCH_DEFINITIONS GGML_SSE42) + if (GGML_F16C)