Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

Bench report: power line (limit given by the user, platform profile, mains or battery)

YanissAmzc7f35727bfa3
diff --git a/.github/ISSUE_TEMPLATE/benchmark_report.yml b/.github/ISSUE_TEMPLATE/benchmark_report.yml
index 5e9b060..c002491 100644
--- a/.github/ISSUE_TEMPLATE/benchmark_report.yml
+++ b/.github/ISSUE_TEMPLATE/benchmark_report.yml
@@ -17,7 +17,7 @@ body:
id: hardware
attributes:
label: Machine
- description: Product name, RAM size and speed, cooling or power mode if you changed it.
+ description: Product name, RAM size and speed, power limit in watts if you know it (it changes the figures a lot between machines), cooling or power mode if you changed it.
validations:
required: true
- type: input
diff --git a/doc/benchmarks.md b/doc/benchmarks.md
index 9b3ebac..c7f4ee5 100644
--- a/doc/benchmarks.md
+++ b/doc/benchmarks.md
@@ -105,5 +105,5 @@ llama.cpp (ROCm, UD-IQ1_S 1.56 bpw, `-fa 1 -ub 2048`, no MTP), same machine: pp4
## Share your numbers
-Start a server from the quickstart, then run `tools/bench.sh` (standard library only, `--base` and `--model` select the server). It measures prefill on a prompt of about 3.5K tokens and decode on prose, chat and code with the prompts behind the table above, and prints one Markdown block with your hardware and versions (`--json` adds the same numbers, with every run, as a JSON block).
+Start a server from the quickstart, then run `tools/bench.sh` (standard library only, `--base` and `--model` select the server). It measures prefill on a prompt of about 3.5K tokens and decode on prose, chat and code with the prompts behind the table above, and prints one Markdown block with your hardware and versions (`--json` adds the same numbers, with every run, as a JSON block). The power limit changes the figures a lot from one machine to the next and cannot be read without root: pass it with `--power-limit "71 W"` when you know it, and the report prints it next to the platform profile.
Paste it into a [benchmark report](https://github.com/Yamz-Labs/kyojin/issues/new?template=benchmark_report.yml). Results from other gfx1151 machines and other ROCm GPUs are the most useful contribution. See `CONTRIBUTING.md`.
diff --git a/tests/test_bench_power_cpu.py b/tests/test_bench_power_cpu.py
new file mode 100644
index 0000000..6b08b24
--- /dev/null
+++ b/tests/test_bench_power_cpu.py
@@ -0,0 +1,36 @@
+"""CPU tests for the power line of tools/bench.py: the limit the user passes, the platform profile, mains or
+battery, and "unknown" when the machine exposes none of them."""
+import importlib.util
+from pathlib import Path
+
+_spec = importlib.util.spec_from_file_location("bench", Path(__file__).parent.parent / "tools" / "bench.py")
+bench = importlib.util.module_from_spec(_spec)
+_spec.loader.exec_module(bench)
+
+
+def _supply(root, name, kind, online=None):
+ d = root / name
+ d.mkdir(parents=True)
+ (d / "type").write_text(f"{kind}\n")
+ if online is not None:
+ (d / "online").write_text(f"{online}\n")
+
+
+def test_nothing_readable_is_unknown(tmp_path):
+ assert bench.power_mode(profile=tmp_path / "none", supplies=tmp_path / "none") == "unknown"
+
+
+def test_limit_profile_and_mains(tmp_path):
+ (tmp_path / "profile").write_text("performance\n")
+ _supply(tmp_path / "ps", "ADP1", "Mains", 1)
+ _supply(tmp_path / "ps", "BAT0", "Battery")
+ assert bench.power_mode(" 71 W ", tmp_path / "profile", tmp_path / "ps") == "71 W, profile performance, on mains"
+
+
+def test_on_battery(tmp_path):
+ _supply(tmp_path / "ps", "ADP1", "Mains", 0)
+ assert bench.power_mode(profile=tmp_path / "none", supplies=tmp_path / "ps") == "on battery"
+
+
+def test_blank_limit_is_dropped(tmp_path):
+ assert bench.power_mode(" ", tmp_path / "none", tmp_path / "none") == "unknown"
diff --git a/tools/bench.py b/tools/bench.py
index 887e9c7..ee45b9c 100755
--- a/tools/bench.py
+++ b/tools/bench.py
@@ -139,6 +139,26 @@ def ram_gib():
return "unknown"
+POWER_PROFILE = Path("/sys/firmware/acpi/platform_profile")
+POWER_SUPPLIES = Path("/sys/class/power_supply")
+
+
+def power_mode(limit=None, profile=POWER_PROFILE, supplies=POWER_SUPPLIES):
+ """Power line of the report: the limit the user passed with --power-limit (the sustained package limit is
+ not readable without root), the platform profile, and mains or battery. "unknown" when nothing answers."""
+ parts = [limit.strip()] if limit and limit.strip() else []
+ prof = read_version(profile)
+ if prof:
+ parts.append(f"profile {prof}")
+ try:
+ mains = [read_version(d / "online") for d in sorted(Path(supplies).iterdir()) if read_version(d / "type") == "Mains"]
+ except OSError:
+ mains = []
+ if mains:
+ parts.append("on mains" if "1" in mains else "on battery")
+ return ", ".join(parts) or "unknown"
+
+
def server_compiler(base, model=None):
"""(compiler line, warning or None) the server reports on /health (the server root, one level above /v1).
Behind a proxy such as llama-swap the root /health is the proxy's own, so /upstream/<model>/health is tried next."""
@@ -258,6 +278,7 @@ def main():
ap.add_argument("--reps", type=int, default=3, help="runs per measurement (default 3)")
ap.add_argument("--max-tokens", type=int, default=128)
ap.add_argument("--corpus", help="text file for the prefill prompt (default: Markdown files of this repository)")
+ ap.add_argument("--power-limit", help="sustained power limit of the machine, as text (example: \"71 W\"); printed in the report")
ap.add_argument("--json", action="store_true", help="also print the measurements as a fenced JSON block")
a = ap.parse_args()
base = a.base.rstrip("/")
@@ -309,7 +330,7 @@ def main():
if comp[1]:
print(comp[1], file=sys.stderr)
info = {"model": model, "cpu": cpu_name(), "ram": ram_gib(), "gpu_target": gpu_name(), "kernel": platform.release(),
- "rocm": rocm_version(), "kernel_compiler": comp[0], "server": base, "date": time.strftime('%Y-%m-%d')}
+ "rocm": rocm_version(), "power": power_mode(a.power_limit), "kernel_compiler": comp[0], "server": base, "date": time.strftime('%Y-%m-%d')}
prefill_med = med([t for _, t in pf])
lines = [
"### Kyojin benchmark",
@@ -320,6 +341,7 @@ def main():
f"- GPU target: {info['gpu_target']}",
f"- Kernel: {info['kernel']}",
f"- ROCm: {info['rocm']}",
+ f"- Power: {info['power']}",
f"- Kernel compiler: {info['kernel_compiler']}",
f"- Server: {info['server']}",
f"- Date: {info['date']}",