Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix(engine): build ggml with CUDA graphs and llamafile, as upstream does (#9163)

thinhlpg8c87c87a5ade
diff --git a/src-tauri/plugins/tauri-plugin-llamacpp/build.rs b/src-tauri/plugins/tauri-plugin-llamacpp/build.rs
index 5bb709f9f..25d9af6ea 100644
--- a/src-tauri/plugins/tauri-plugin-llamacpp/build.rs
+++ b/src-tauri/plugins/tauri-plugin-llamacpp/build.rs
@@ -473,6 +473,15 @@ mod engine {
// difference on a CUDA rebuild is minutes versus tens of minutes.
// ggml picks up ccache or sccache, whichever it finds.
"-DGGML_CCACHE=ON",
+ // llama.cpp turns both of these on in its top-level CMakeLists.txt,
+ // which the wrapper above never reads; ggml's own default for each
+ // is OFF. Without CUDA graphs every decode step launches each kernel
+ // separately, which cost 2-4x in token generation against 0.8.4's
+ // upstream-built engine (#9163). Without llamafile the CPU variants
+ // lose the sgemm path upstream ships. Graphs is read only by the
+ // CUDA backend, so it is inert for every other leg.
+ "-DGGML_CUDA_GRAPHS=ON",
+ "-DGGML_LLAMAFILE=ON",
]);
// Every ggml library is staged into one directory, so each can find
// its siblings from its own location. cmake otherwise strips the rpath