diff --git a/docs/build.md b/docs/build.md index 1c8d91e..8e752d7 100644 --- a/docs/build.md +++ b/docs/build.md @@ -118,6 +118,12 @@ adapters and separate `riva_server` executable are needed. The preset selects which components and ggml backend are compiled. +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: ```bash diff --git a/scripts/configure.sh b/scripts/configure.sh index 627f8a8..9fe8424 100755 --- a/scripts/configure.sh +++ b/scripts/configure.sh @@ -138,4 +138,19 @@ if [ "${#missing[@]}" -ne 0 ]; then exit 1 fi -cmake --preset "$PRESET" "$@" +case "$PRESET" in + cpu-*) + 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" "$@" + ;; +esac