From d8628141490c1f6b80e3dcbc22f41a417cd7a393 Mon Sep 17 00:00:00 2001 From: CodSpeed Bot Date: Thu, 30 Jul 2026 14:52:35 +0000 Subject: [PATCH] benchmarks: enable GGML_LLAMAFILE by default to match llama.cpp benchmarks/CMakeLists.txt adds ggml as a subdirectory directly, so it never sees the root llama.cpp CMakeLists.txt override that flips the default of GGML_LLAMAFILE to ON. The benchmarks were therefore built with GGML_LLAMAFILE=OFF and every ggml_compute_forward_mul_mat() call measured the per-row ggml_vec_dot() fallback instead of the tiled tinyBLAS GEMM path that real llama.cpp CPU inference takes. Mirror the same default override in the benchmark project so the benchmarked ggml matches the configuration llama.cpp itself builds with. Unsupported types and shapes (e.g. Q4_K) fall back cleanly since llamafile_sgemm() returns false. --- benchmarks/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index f052060a8674..1f1dd5b4af56 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -58,6 +58,17 @@ if (CODSPEED_MODE STREQUAL "simulation") set(GGML_F16C ON CACHE BOOL "" FORCE) endif() +# Match the ggml configuration that llama.cpp itself builds with. The root +# llama.cpp CMakeLists.txt changes the default of GGML_LLAMAFILE to ON (see +# "change the default for these ggml options"), which enables the tiled +# tinyBLAS matmul kernels in ggml-cpu. This project adds ggml directly as a +# subdirectory and therefore never sees that override, so without this the +# benchmarks measure the unoptimized per-row ggml_vec_dot() fallback instead of +# the GEMM path real llama.cpp inference takes. +if (NOT DEFINED GGML_LLAMAFILE) + set(GGML_LLAMAFILE_DEFAULT ON) +endif() + # Build the ggml compute core shipped in this repository. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ggml ${CMAKE_BINARY_DIR}/ggml)