From d66c8cfbc75b6d4c8399df05009c2501857ff8a4 Mon Sep 17 00:00:00 2001 From: Shane Manaton Date: Sun, 19 Jul 2026 10:34:57 +0100 Subject: [PATCH 1/2] build: prefer llama.cpp-mainline over sibling llama.cpp The Apothic-AI fork (often checked out as a sibling llama.cpp) trails upstream ggml and produces NaN logits on Q1_0 models. Prefer a llama.cpp-mainline checkout when present so accidental builds against the fork fail less silently. WWAMA_LLAMA_CPP_DIR still overrides entirely. --- build.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.rs b/build.rs index 30670e4..0e1535a 100644 --- a/build.rs +++ b/build.rs @@ -370,7 +370,14 @@ fn find_llama_cpp_dir() -> PathBuf { let manifest_dir = PathBuf::from( env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR is set by cargo"), ); + // Prefer an explicit mainline checkout over a sibling `llama.cpp`, which in + // this workspace is the Apothic-AI fork — it trails upstream ggml and emits + // NaN logits for 1-bit (Q1_0) models (see WINDOWS-BUILD-REPORT.md, Bug 4). + // The mainline tree (`llama.cpp-mainline`, an upstream release tag) is what + // miyagi must build against; set WWAMA_LLAMA_CPP_DIR to override entirely. let candidates = [ + manifest_dir.join("../../cpp/llama.cpp-mainline"), + manifest_dir.join("../llama.cpp-mainline"), manifest_dir.join("../../cpp/llama.cpp"), manifest_dir.join("../llama.cpp"), ]; From 34848ce7ad49f41036b95781132e2dd6cb5647ca Mon Sep 17 00:00:00 2001 From: Shane Manaton Date: Sun, 19 Jul 2026 19:02:14 +0100 Subject: [PATCH 2/2] docs(build): clarify mainline llama preference without dangling report ref --- build.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/build.rs b/build.rs index 0e1535a..2722b98 100644 --- a/build.rs +++ b/build.rs @@ -370,11 +370,10 @@ fn find_llama_cpp_dir() -> PathBuf { let manifest_dir = PathBuf::from( env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR is set by cargo"), ); - // Prefer an explicit mainline checkout over a sibling `llama.cpp`, which in - // this workspace is the Apothic-AI fork — it trails upstream ggml and emits - // NaN logits for 1-bit (Q1_0) models (see WINDOWS-BUILD-REPORT.md, Bug 4). - // The mainline tree (`llama.cpp-mainline`, an upstream release tag) is what - // miyagi must build against; set WWAMA_LLAMA_CPP_DIR to override entirely. + // Prefer an explicit mainline checkout over a sibling `llama.cpp` when both + // exist. Some forks lag upstream ggml and have produced non-finite (NaN) + // logits on Q1_0 models; a `llama.cpp-mainline` directory name makes the + // intended tree obvious. WWAMA_LLAMA_CPP_DIR still overrides entirely. let candidates = [ manifest_dir.join("../../cpp/llama.cpp-mainline"), manifest_dir.join("../llama.cpp-mainline"),