From 7cabcab2f9228efd6b0292d0bab3bc03ed4d841b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Efe=20G=C3=B6kdemir?= Date: Sun, 27 Sep 2026 23:21:31 +0300 Subject: [PATCH 1/5] fix: keep CPU builds portable across x86 hosts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Efe Gökdemir --- docs/build.md | 5 +++++ scripts/configure.sh | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/build.md b/docs/build.md index e313d72..3a9211a 100644 --- a/docs/build.md +++ b/docs/build.md @@ -119,6 +119,11 @@ adapters and separate `riva_server` executable are needed. The preset selects which components and ggml backend are compiled. +CPU presets disable ggml's native-architecture optimization by default so +portable x86_64 CPU artifacts do not require instruction sets from the build +host. Pass `-DGGML_NATIVE=ON` only when producing an artifact for a known +target machine. + Additional CMake definitions can follow the preset: ```bash diff --git a/scripts/configure.sh b/scripts/configure.sh index ad056d4..b16d816 100755 --- a/scripts/configure.sh +++ b/scripts/configure.sh @@ -176,4 +176,10 @@ if [ "$need_nmt" = ON ] || [ "$need_s2s" = ON ]; then scripts/apply-llama-patches.sh fi -cmake --preset "$PRESET" "$@" +ggml_native=ON +case "$PRESET" in + cpu-*) ggml_native=OFF ;; +esac +ggml_native="$(cmake_bool_override GGML_NATIVE "$ggml_native" "$@")" + +cmake --preset "$PRESET" "-DGGML_NATIVE=$ggml_native" "$@" From de79e651f8625d8e0f4ce35cc0b19caec8300510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Efe=20G=C3=B6kdemir?= Date: Mon, 28 Sep 2026 11:30:22 +0300 Subject: [PATCH 2/5] fix: disable host ISA flags for portable CPU presets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Efe Gökdemir --- scripts/configure.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/configure.sh b/scripts/configure.sh index b16d816..5e7e5df 100755 --- a/scripts/configure.sh +++ b/scripts/configure.sh @@ -182,4 +182,14 @@ case "$PRESET" in esac ggml_native="$(cmake_bool_override GGML_NATIVE "$ggml_native" "$@")" -cmake --preset "$PRESET" "-DGGML_NATIVE=$ggml_native" "$@" +ggml_options=("-DGGML_NATIVE=$ggml_native") +case "$PRESET" in + cpu-*) + for variable in GGML_SSE42 GGML_AVX GGML_AVX2 GGML_BMI2 GGML_FMA GGML_F16C; do + value="$(cmake_bool_override "$variable" OFF "$@")" + ggml_options+=("-D$variable=$value") + done + ;; +esac + +cmake --preset "$PRESET" "${ggml_options[@]}" "$@" From ba9a0805110af4a57be365889e012d0a6cb3deb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Efe=20G=C3=B6kdemir?= Date: Mon, 28 Sep 2026 11:45:23 +0300 Subject: [PATCH 3/5] fix: disable host ISA defaults in portable CPU builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Efe Gökdemir --- scripts/configure.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/configure.sh b/scripts/configure.sh index 5e7e5df..c1a7768 100755 --- a/scripts/configure.sh +++ b/scripts/configure.sh @@ -182,14 +182,13 @@ case "$PRESET" in esac ggml_native="$(cmake_bool_override GGML_NATIVE "$ggml_native" "$@")" -ggml_options=("-DGGML_NATIVE=$ggml_native") -case "$PRESET" in - cpu-*) - for variable in GGML_SSE42 GGML_AVX GGML_AVX2 GGML_BMI2 GGML_FMA GGML_F16C; do - value="$(cmake_bool_override "$variable" OFF "$@")" - ggml_options+=("-D$variable=$value") - done - ;; -esac +ggml_cpu_options=() +if [[ "$PRESET" == cpu-* && "$ggml_native" = OFF ]]; then + for variable in GGML_SSE42 GGML_AVX GGML_AVX2 GGML_BMI2 GGML_FMA GGML_F16C; do + value="$(cmake_bool_override "$variable" OFF "$@")" + ggml_cpu_options+=("-D$variable=$value") + done +fi -cmake --preset "$PRESET" "${ggml_options[@]}" "$@" +cmake --preset "$PRESET" "-DGGML_NATIVE=$ggml_native" \ + "${ggml_cpu_options[@]}" "$@" From bd608b2f934251fb75ac99920e16f2904961d14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Efe=20G=C3=B6kdemir?= Date: Tue, 29 Sep 2026 13:54:34 +0300 Subject: [PATCH 4/5] fix: keep portable CPU configuration minimal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Efe Gökdemir --- scripts/configure.sh | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/scripts/configure.sh b/scripts/configure.sh index c1a7768..5b4d516 100755 --- a/scripts/configure.sh +++ b/scripts/configure.sh @@ -176,19 +176,12 @@ if [ "$need_nmt" = ON ] || [ "$need_s2s" = ON ]; then scripts/apply-llama-patches.sh fi -ggml_native=ON case "$PRESET" in - cpu-*) ggml_native=OFF ;; + cpu-*) + ggml_native="$(cmake_bool_override GGML_NATIVE OFF "$@")" + cmake --preset "$PRESET" "-DGGML_NATIVE=$ggml_native" "$@" + ;; + *) + cmake --preset "$PRESET" "$@" + ;; esac -ggml_native="$(cmake_bool_override GGML_NATIVE "$ggml_native" "$@")" - -ggml_cpu_options=() -if [[ "$PRESET" == cpu-* && "$ggml_native" = OFF ]]; then - for variable in GGML_SSE42 GGML_AVX GGML_AVX2 GGML_BMI2 GGML_FMA GGML_F16C; do - value="$(cmake_bool_override "$variable" OFF "$@")" - ggml_cpu_options+=("-D$variable=$value") - done -fi - -cmake --preset "$PRESET" "-DGGML_NATIVE=$ggml_native" \ - "${ggml_cpu_options[@]}" "$@" From 9a6913c136614b9d500b0852831f7889974b5253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Efe=20G=C3=B6kdemir?= Date: Tue, 29 Sep 2026 15:11:38 +0300 Subject: [PATCH 5/5] fix: preserve native ARM CPU defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Efe Gökdemir --- docs/build.md | 9 +++++---- scripts/configure.sh | 11 +++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/build.md b/docs/build.md index 3a9211a..eef3767 100644 --- a/docs/build.md +++ b/docs/build.md @@ -119,10 +119,11 @@ adapters and separate `riva_server` executable are needed. The preset selects which components and ggml backend are compiled. -CPU presets disable ggml's native-architecture optimization by default so -portable x86_64 CPU artifacts do not require instruction sets from the build -host. Pass `-DGGML_NATIVE=ON` only when producing an artifact for a known -target machine. +On x86_64 hosts, CPU presets disable ggml's native-architecture optimization +by default so portable artifacts do not require instruction sets from the build +host. On other architectures, the preset keeps ggml's normal defaults so that +architecture-specific kernels remain available. Pass `-DGGML_NATIVE=ON` or +`-DGGML_NATIVE=OFF` explicitly when the target requires a different choice. Additional CMake definitions can follow the preset: diff --git a/scripts/configure.sh b/scripts/configure.sh index 5b4d516..c5820d6 100755 --- a/scripts/configure.sh +++ b/scripts/configure.sh @@ -178,8 +178,15 @@ fi case "$PRESET" in cpu-*) - ggml_native="$(cmake_bool_override GGML_NATIVE OFF "$@")" - cmake --preset "$PRESET" "-DGGML_NATIVE=$ggml_native" "$@" + case "$(uname -m)" in + x86_64|amd64) + ggml_native="$(cmake_bool_override GGML_NATIVE OFF "$@")" + cmake --preset "$PRESET" "-DGGML_NATIVE=$ggml_native" "$@" + ;; + *) + cmake --preset "$PRESET" "$@" + ;; + esac ;; *) cmake --preset "$PRESET" "$@"