Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: keep llama-bench in the llama.cpp install (#14881)

Daniel Hand7dba5574e74
diff --git a/studio/install_llama_prebuilt.py b/studio/install_llama_prebuilt.py
index b5d8e3a91a3..c2e6f76414d 100644
--- a/studio/install_llama_prebuilt.py
+++ b/studio/install_llama_prebuilt.py
@@ -4729,12 +4729,19 @@ def runtime_patterns_for_install_kind(
"linux-arm64",
"linux-vulkan",
}:
- return ["llama-server", "llama-quantize", "llama-diffusion-gemma-visual-server", "lib*.so*"]
+ return [
+ "llama-server",
+ "llama-quantize",
+ "llama-diffusion-gemma-visual-server",
+ "llama-bench",
+ "lib*.so*",
+ ]
if install_kind in {"macos-arm64", "macos-x64"}:
return [
"llama-server",
"llama-quantize",
"llama-diffusion-gemma-visual-server",
+ "llama-bench",
"llama-fit-params",
"lib*.dylib",
]
@@ -4752,6 +4759,7 @@ def runtime_patterns_for_install_kind(
"llama-server.exe",
"llama-quantize.exe",
"llama-diffusion-gemma-visual-server.exe",
+ "llama-bench.exe",
"*.dll",
]
raise PrebuiltFallback(f"unsupported install kind for runtime overlay: {install_kind}")
@@ -5454,6 +5462,10 @@ def install_from_archives(
raise PrebuiltFallback("unix executables were not installed correctly into build/bin")
os.chmod(source_server, 0o755)
os.chmod(source_quantize, 0o755)
+ # Optional; bundles ship it non-executable.
+ source_bench = build_bin / "llama-bench"
+ if source_bench.is_file():
+ os.chmod(source_bench, 0o755)
ensure_fit_params_executable(install_dir)
root_server = install_dir / "llama-server"
diff --git a/studio/setup.ps1 b/studio/setup.ps1
index 03d2fcea243..f219fb8f5dc 100644
--- a/studio/setup.ps1
+++ b/studio/setup.ps1
@@ -10033,6 +10033,11 @@ if ($LocalLlamaCppLinked) {
$null = cmake --build $BuildDir --config Release --target llama-diffusion-gemma-visual-server -j $NumCpu 2>&1 | Out-String
}
+ # -- Step F: llama-bench (best-effort) --
+ if ($BuildOk) {
+ $null = cmake --build $BuildDir --config Release --target llama-bench -j $NumCpu 2>&1 | Out-String
+ }
+
# Swap temp build dir into final location (only if we built in a temp dir)
if ($BuildOk -and $LlamaCppDir -ne $OriginalLlamaCppDir) {
Assert-StudioOwnedOrAbsent -Path $OriginalLlamaCppDir -Label "llama.cpp install" -IsCustom $RuntimeRootIsCustom
diff --git a/studio/setup.sh b/studio/setup.sh
index fc6fd25ec50..5c3cdd3845a 100755
--- a/studio/setup.sh
+++ b/studio/setup.sh
@@ -5219,6 +5219,7 @@ else
fi
# Best-effort: the target exists only on llama.cpp trees carrying the diffusion example.
run_quiet_no_exit "build diffusion visual server" cmake --build "$_BUILD_TMP/build" --config Release --target llama-diffusion-gemma-visual-server -j"$NCPU" || true
+ run_quiet_no_exit "build llama-bench" cmake --build "$_BUILD_TMP/build" --config Release --target llama-bench -j"$NCPU" || true
fi
# Opt-in smoke test (CUDA JIT stalls); runs before the install swap.
@@ -5248,6 +5249,7 @@ else
if [ "$BUILD_OK" = true ]; then
run_quiet_no_exit "build llama-quantize (cpu fallback)" cmake --build "$_BUILD_TMP/build" --config Release --target llama-quantize -j"$NCPU" || true
run_quiet_no_exit "build diffusion visual server (cpu fallback)" cmake --build "$_BUILD_TMP/build" --config Release --target llama-diffusion-gemma-visual-server -j"$NCPU" || true
+ run_quiet_no_exit "build llama-bench (cpu fallback)" cmake --build "$_BUILD_TMP/build" --config Release --target llama-bench -j"$NCPU" || true
fi
else
BUILD_OK=false
diff --git a/tests/studio/install/test_install_llama_prebuilt_logic.py b/tests/studio/install/test_install_llama_prebuilt_logic.py
index c22cce4fd2f..75fab012bbd 100644
--- a/tests/studio/install/test_install_llama_prebuilt_logic.py
+++ b/tests/studio/install/test_install_llama_prebuilt_logic.py
@@ -3893,6 +3893,65 @@ def test_runtime_overlay_cannot_overwrite_main_archive_payload(tmp_path: Path) -
assert (release_dir / name).exists(), f"missing {name}"
[email protected](sys.platform == "win32", reason = "POSIX mode bits")
[email protected]("ships_bench", [True, False])
+def test_linux_overlay_keeps_llama_bench_executable_when_bundled(
+ tmp_path: Path, ships_bench: bool
+) -> None:
+ # Bundle members are not executable; llama-bench is launched directly.
+ import hashlib
+ import shutil as _shutil
+
+ work = tmp_path / "work"
+ install = tmp_path / "install"
+ work.mkdir()
+ install.mkdir()
+ bundle = tmp_path / "app-b11160-linux-x64-cuda13-newer.tar.gz"
+ names = ["llama-server", "llama-quantize", "libllama.so"] + (
+ ["llama-bench", "libllama-bench-impl.so"] if ships_bench else []
+ )
+ with tarfile.open(bundle, "w:gz") as archive:
+ for name in names:
+ payload = f"{name}\n".encode()
+ member = tarfile.TarInfo(name)
+ member.size = len(payload)
+ member.mode = 0o644
+ archive.addfile(member, io.BytesIO(payload))
+ choice = asset_choice(
+ name = bundle.name,
+ url = f"https://example.com/{bundle.name}",
+ tag = "b11160",
+ source_label = "published",
+ install_kind = "linux-cuda",
+ runtime_line = "cuda13",
+ expected_sha256 = hashlib.sha256(bundle.read_bytes()).hexdigest(),
+ )
+ host = linux_host(driver_cuda_version = (13, 0), has_physical_nvidia = True, has_usable_nvidia = True)
+
+ def fake_download(
+ url,
+ target_path,
+ *,
+ expected_sha256 = None,
+ label = None,
+ **kw,
+ ):
+ _shutil.copy2(bundle, target_path)
+
+ orig_download = INSTALL_LLAMA_PREBUILT.download_file_verified
+ INSTALL_LLAMA_PREBUILT.download_file_verified = fake_download
+ try:
+ INSTALL_LLAMA_PREBUILT.install_from_archives(choice, host, install, work)
+ finally:
+ INSTALL_LLAMA_PREBUILT.download_file_verified = orig_download
+
+ bench = install / "build" / "bin" / "llama-bench"
+ if ships_bench:
+ assert bench.is_file() and os.access(bench, os.X_OK)
+ else:
+ assert not bench.exists()
+
+
def test_linux_runtime_overlay_copies_llama_tool_impl_libraries(tmp_path: Path) -> None:
install_from_archives = INSTALL_LLAMA_PREBUILT.install_from_archives