One folder per GPU, with a GPU index in the top-level README
ci / check (push) Successful in 10s

Recipes, tried logs and result folders move under <gpu>/: recipes at
<gpu>/<model>/<engine>-<profile>.md, tried logs at <gpu>/<model>/tried.md,
runs at <gpu>/results/<run>/. build generates a README for every GPU in
cookbook.toml and the GPU table in README.md. validate checks that a run
sits in the folder of the GPU it ran on and warns about stray top-level
folders. Format docs and host setup move to docs/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-29 15:38:54 +01:00
1 parent 4673f0afb6
commit 562c7f2fb8
153 files changed
+445 -288

No files matched your search

+83 -35
View File
@@ -36,6 +36,8 @@ PROFILES = {
FIELDS = ("title", "summary", "model", "quant", "kv", "engine", "gpu", "profile",
"spec", "thinking", "results")
ZERO_DIGEST = "0" * 64
# Top-level folders that are not GPU folders.
RESERVED = {"docs", "tools", "site"}
def slug(s):
@@ -129,9 +131,17 @@ class Cookbook:
self.root = Path(root)
self.errors, self.warnings = [], []
self.config = tomllib.loads((self.root / "cookbook.toml").read_text(encoding="utf-8"))
# One folder per GPU: <gpu>/<model>/<engine>-<profile>.md, <gpu>/<model>/tried.md
# and <gpu>/results/<run>/.
self.gpu_dirs = {slug(g): g for g in self.config["gpus"]}
for d in sorted(self.root.iterdir()):
if d.is_dir() and not d.name.startswith(".") and d.name not in RESERVED | set(self.gpu_dirs):
self.warning(d.name, "not a GPU in cookbook.toml, so nothing in it is checked")
self.results = self._load_results()
self.recipes = self._load_docs("recipes", self._recipe)
self.tried = self._load_docs("tried", self._tried)
docs = [p for g in self.gpu_dirs for p in sorted((self.root / g).glob("*/*.md"))
if p.parent.name != "results"]
self.recipes = self._load_docs([p for p in docs if p.name != "tried.md"], self._recipe)
self.tried = self._load_docs([p for p in docs if p.name == "tried.md"], self._tried)
for r in self.results.values():
if not r["used"]:
self.warning(f"results/{r['id']}", "not cited by any recipe or tried log")
@@ -145,9 +155,10 @@ class Cookbook:
# ------------------------------------------------------------ loading
def _load_results(self):
out = {}
base = self.root / "results"
for d in sorted(p for p in base.iterdir() if p.is_dir()) if base.exists() else []:
where = f"results/{d.name}"
dirs = [(gpu, d) for g, gpu in self.gpu_dirs.items() if (self.root / g / "results").exists()
for d in sorted((self.root / g / "results").iterdir()) if d.is_dir()]
for gpu, d in dirs:
where = d.relative_to(self.root).as_posix()
try:
meta = json.loads((d / "meta.json").read_text(encoding="utf-8"))
res = json.loads((d / f"{d.name}.json").read_text(encoding="utf-8"))
@@ -159,6 +170,9 @@ class Cookbook:
self.error(where, f"{f} missing")
if ((res.get("env") or {}).get("notes") or {}) != meta.get("notes"):
self.error(where, "the notes in meta.json and the results file differ (edited?)")
if (meta.get("collected") or {}).get("gpu_model") != gpu:
self.error(where, f"ran on {(meta.get('collected') or {}).get('gpu_model')}, "
f"but it is in the {gpu} folder")
m = meta.get("mandatory") or {}
cmd = d / "server-cmd.txt"
out[d.name] = {"id": d.name, "dir": d, "meta": meta, "res": res,
@@ -169,11 +183,9 @@ class Cookbook:
"metrics": metrics(meta, res), "used": False}
return out
def _load_docs(self, sub, parse):
def _load_docs(self, paths, parse):
out = []
for p in sorted((self.root / sub).rglob("*.md")):
if p.name == "README.md":
continue
for p in paths:
rel = p.relative_to(self.root).as_posix()
try:
front, body = split_front(p.read_text(encoding="utf-8"))
@@ -190,11 +202,11 @@ class Cookbook:
if missing:
self.error(rel, "front matter lacks " + ", ".join(missing))
return None
rid = rel[len("recipes/"):-len(".md")]
rid = rel[:-len(".md")]
tp, pp = int(f.get("tp", 1)), int(f.get("pp", 1))
want = f"{slug(f['model'])}/{slug(f['gpu'])}/{slug(f['engine'])}-{f['profile']}"
want = f"{slug(f['gpu'])}/{slug(f['model'])}/{slug(f['engine'])}-{f['profile']}"
if rid != want:
self.error(rel, f"should be recipes/{want}.md for its model, gpu, engine and profile")
self.error(rel, f"should be {want}.md for its gpu, model, engine and profile")
if f["profile"] not in PROFILES:
self.error(rel, f"profile {f['profile']!r}: use one of {', '.join(PROFILES)}")
return None
@@ -286,7 +298,7 @@ class Cookbook:
if k not in f:
self.error(rel, f"front matter lacks {k}")
return None
want = f"tried/{slug(f['model'])}/{slug(f['gpu'])}.md"
want = f"{slug(f['gpu'])}/{slug(f['model'])}/tried.md"
if rel != want:
self.error(rel, f"should be {want}")
entries = []
@@ -397,33 +409,67 @@ class Cookbook:
top[key] = rc
return top
def gpu_recipes(self, gpu):
return sorted((r for r in self.recipes if r["front"]["gpu"] == gpu),
key=lambda r: (r["front"]["model"], list(PROFILES).index(r["front"]["profile"]),
r["front"]["engine"]))
def headline(self, rc, star=False):
_, label, unit, _ = PROFILES[rc["front"]["profile"]]
return f"{num(rc['value'], 2 if unit == 'J/tok' else 1)} {unit} {label}{' ★' if star else ''}"
def index_md(self):
"""The GPU table in the top-level README."""
best = self.best()
L = []
gpus = list(self.config["gpus"])
for gpu in gpus:
rows = sorted((r for r in self.recipes if r["front"]["gpu"] == gpu),
key=lambda r: (r["front"]["model"], list(PROFILES).index(r["front"]["profile"]),
r["front"]["engine"]))
if not rows:
continue
L += [f"### {gpu}", "", "| model | profile | engine | headline | status | recipe |",
"|---|---|---|---|---|---|"]
L = ["| GPU | VRAM | bandwidth (spec) | recipes | fastest for one user |", "|---|---|---|---|---|"]
for gpu, g in self.config["gpus"].items():
rows = self.gpu_recipes(gpu)
fastest = [best[k] for k in sorted(best) if k[0] == gpu and k[2] == "single-user"]
top = " · ".join(f"{rc['front']['model']}: {num(rc['value'])} t/s ({rc['front']['engine']})"
for rc in fastest) or "none yet: wanted"
L.append(f"| [{gpu}]({slug(gpu)}/README.md) | {g['vram_gb']} GB | {g['mem_bw_gbs']} GB/s | "
f"{len(rows)} | {top} |")
return "\n".join(L)
def gpu_md(self, gpu):
"""A GPU folder's README, generated whole."""
g, d, best = self.config["gpus"][gpu], slug(gpu), self.best()
rows = self.gpu_recipes(gpu)
L = [f"# {gpu}", "",
"<!-- Generated by tools/cookbook.py build from cookbook.toml and this folder. Don't edit. -->",
"", f"{g['vram_gb']} GB VRAM · {g['mem_bw_gbs']} GB/s memory bandwidth (spec) · {g['arch']}", ""]
if g.get("notes"):
L += [g["notes"].strip(), ""]
if any(r["demo"] for r in rows):
L += ["> **Demo data.** The results in this folder are synthetic, made by "
"`tools/demo/make_demo.py`. Nothing here was measured.", ""]
L += ["## Recipes", ""]
if rows:
L += ["| model | profile | engine | headline | status | recipe |", "|---|---|---|---|---|---|"]
for rc in rows:
f = rc["front"]
_, label, unit, _ = PROFILES[f["profile"]]
star = " ★" if best.get((gpu, f["model"], f["profile"])) is rc else ""
status = "demo" if rc["demo"] else rc["status"]
L.append(f"| {f['model']} | {f['profile']} | {f['engine']} | "
f"{num(rc['value'], 2 if unit == 'J/tok' else 1)} {unit} {label}{star} | "
f"{status} | [{rc['id']}](recipes/{rc['id']}.md) |")
L.append("")
L.append("★ the fastest recipe for that GPU, model and profile.")
wanted = self.wanted()
star = best.get((gpu, f["model"], f["profile"])) is rc
L.append(f"| {f['model']} | {f['profile']} | {f['engine']} | {self.headline(rc, star)} | "
f"{'demo' if rc['demo'] else rc['status']} | "
f"[{f['title']}]({rc['id'].removeprefix(d + '/')}.md) |")
L += ["", "★ the fastest recipe for that model and profile on this GPU."]
else:
L.append("None yet.")
tried = [t for t in self.tried if t["front"]["gpu"] == gpu]
if tried:
L += ["", "## What lost", ""] + [
f"- [{t['front']['model']}]({t['rel'].removeprefix(d + '/')}): {len(t['entries'])} variants"
for t in tried]
wanted = [m for gg, m in self.wanted() if gg == gpu]
if wanted:
L += ["", "**Wanted** (fits in VRAM, no single-user recipe yet): " +
", ".join(f"{m} on {g}" for g, m in wanted) + "."]
return "\n".join(L)
L += ["", "## Wanted", "", "Fits in VRAM, no single-user recipe yet: " + ", ".join(wanted) +
". See [CONTRIBUTING.md](../CONTRIBUTING.md)."]
n = sum(1 for r in self.results.values() if r["dir"].parent.parent.name == d)
where = (f"{n} result folder{'s' if n != 1 else ''} in [`results/`](results/), as bench.sh wrote them."
if n else "None yet. Runs go in `results/` here, as bench.sh writes them.")
L += ["", "## Results", "", where,
"Host setup for every recipe: [docs/host-setup.md](../docs/host-setup.md)."]
return "\n".join(L) + "\n"
def wanted(self):
have = {(r["front"]["gpu"], r["front"]["model"]) for r in self.recipes
@@ -444,6 +490,8 @@ class Cookbook:
out[td["path"]] = fill(text, "tried", self.tried_md(td))
readme = self.root / "README.md"
out[readme] = fill(readme.read_text(encoding="utf-8"), "index", self.index_md())
for gpu in self.config["gpus"]:
out[self.root / slug(gpu) / "README.md"] = self.gpu_md(gpu)
out[self.root / "site" / "index.html"] = site_html(self, out)
return out
+21 -22
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""make_demo.py - writes the synthetic DEMO result folders in results/.
"""make_demo.py - writes the synthetic DEMO result folders in <gpu>/results/.
usage: python3 tools/demo/make_demo.py [--benchmarks DIR]
@@ -61,40 +61,40 @@ SPEC5 = """ --speculative-config '{"method":"mtp","num_speculative_tokens":5}'
# decode/ttft/pp: the medians to aim for; conc: aggregate t/s at 1, 2, 4, 8; watts: decode
RUNS = [
{"recipe": "qwen3.5-9b/arc-pro-b65/llama.cpp-single-user", "date": "261019",
{"recipe": "arc-pro-b65/qwen3.5-9b/llama.cpp-single-user", "date": "261019",
"decode": 64.0, "ttft": 95, "pp": 3400, "conc": [63, 63, 64, 64], "watts": 148},
{"recipe": "qwen3.5-9b/arc-pro-b65/llama.cpp-single-user", "date": "261019", "quick": True,
{"recipe": "arc-pro-b65/qwen3.5-9b/llama.cpp-single-user", "date": "261019", "quick": True,
"sub": [("-fa on -ctk q8_0 -ctv q8_0", "-fa off")], "declare": {"kv": "f16"},
"decode": 57.1, "ttft": 118, "pp": 2650, "conc": [56, 56, 57, 57], "watts": 150},
{"recipe": "qwen3.5-9b/arc-pro-b65/llama.cpp-single-user", "date": "261019", "quick": True,
{"recipe": "arc-pro-b65/qwen3.5-9b/llama.cpp-single-user", "date": "261019", "quick": True,
"sub": [("-e ZES_ENABLE_SYSMAN=1", "-e ZES_ENABLE_SYSMAN=1 -e GGML_SYCL_DISABLE_OPT=1")],
"decode": 49.8, "ttft": 131, "pp": 2100, "conc": [49, 49, 50, 50], "watts": 139},
{"recipe": "qwen3.5-9b/arc-pro-b65/vllm-single-user", "date": "261020",
{"recipe": "arc-pro-b65/qwen3.5-9b/vllm-single-user", "date": "261020",
"decode": 118.0, "ttft": 140, "pp": 4100, "conc": [114, 115, 115, 115], "watts": 165},
{"recipe": "qwen3.8-27b/arc-pro-b65/llama.cpp-single-user", "date": "261021",
{"recipe": "arc-pro-b65/qwen3.8-27b/llama.cpp-single-user", "date": "261021",
"decode": 22.6, "ttft": 210, "pp": 980, "conc": [22, 22, 23, 23], "watts": 160},
{"recipe": "qwen3.8-27b/arc-pro-b65/llama.cpp-single-user", "date": "261021", "quick": True,
{"recipe": "arc-pro-b65/qwen3.8-27b/llama.cpp-single-user", "date": "261021", "quick": True,
"sub": [("-ub 512", "-ub 1024")],
"decode": 22.5, "ttft": 200, "pp": 1070, "conc": [22, 22, 22, 23], "watts": 161},
{"recipe": "qwen3.8-27b/arc-pro-b65/llama.cpp-single-user", "date": "261021", "quick": True,
{"recipe": "arc-pro-b65/qwen3.8-27b/llama.cpp-single-user", "date": "261021", "quick": True,
"sub": [("-ctk q8_0 -ctv q8_0", "-ctk f16 -ctv f16")], "declare": {"kv": "f16"},
"decode": 22.8, "ttft": 205, "pp": 1000, "conc": [22, 23, 23, 23], "watts": 160},
{"recipe": "qwen3.8-27b/arc-pro-b65/vllm-single-user", "date": "261022",
{"recipe": "arc-pro-b65/qwen3.8-27b/vllm-single-user", "date": "261022",
"decode": 84.5, "ttft": 190, "pp": 1520, "conc": [83, 83, 84, 84], "watts": 172},
{"recipe": "qwen3.8-27b/arc-pro-b65/vllm-single-user", "date": "261022", "quick": True,
{"recipe": "arc-pro-b65/qwen3.8-27b/vllm-single-user", "date": "261022", "quick": True,
"sub": [(SPEC5, "")], "declare": {"spec": "none"},
"decode": 31.0, "ttft": 185, "pp": 1530, "conc": [31, 31, 31, 31], "watts": 168},
{"recipe": "qwen3.8-27b/arc-pro-b65/vllm-single-user", "date": "261022", "quick": True,
{"recipe": "arc-pro-b65/qwen3.8-27b/vllm-single-user", "date": "261022", "quick": True,
"sub": [('"num_speculative_tokens":5', '"num_speculative_tokens":3')], "declare": {"spec": "mtp:3"},
"decode": 76.4, "ttft": 188, "pp": 1515, "conc": [75, 75, 76, 76], "watts": 171},
{"recipe": "qwen3.8-27b/arc-pro-b65/vllm-single-user", "date": "261022", "quick": True,
{"recipe": "arc-pro-b65/qwen3.8-27b/vllm-single-user", "date": "261022", "quick": True,
"sub": [('"num_speculative_tokens":5', '"num_speculative_tokens":7')], "declare": {"spec": "mtp:7"},
"decode": 80.2, "ttft": 192, "pp": 1520, "conc": [79, 79, 80, 80], "watts": 174},
{"recipe": "qwen3.8-27b/arc-pro-b65/vllm-throughput", "date": "261023",
{"recipe": "arc-pro-b65/qwen3.8-27b/vllm-throughput", "date": "261023",
"decode": 64.0, "ttft": 205, "pp": 1500, "conc": [62, 118, 205, 296], "watts": 170},
{"recipe": "qwen3.5-9b/arc-b580/llama.cpp-single-user", "date": "261024",
{"recipe": "arc-b580/qwen3.5-9b/llama.cpp-single-user", "date": "261024",
"decode": 48.2, "ttft": 120, "pp": 2500, "conc": [47, 48, 48, 48], "watts": 140},
{"recipe": "qwen3.8-27b/arc-pro-b65/vllm-single-user", "date": "261026", "submitter": "demo-2",
{"recipe": "arc-pro-b65/qwen3.8-27b/vllm-single-user", "date": "261026", "submitter": "demo-2",
"decode": 82.1, "ttft": 196, "pp": 1490, "conc": [81, 81, 82, 82], "watts": 175},
]
@@ -104,7 +104,7 @@ def kv_file(path, d):
def recipe_front(rid):
front, body = cookbook.split_front((ROOT / "recipes" / f"{rid}.md").read_text(encoding="utf-8"))
front, body = cookbook.split_front((ROOT / f"{rid}.md").read_text(encoding="utf-8"))
return front, cookbook.launch_block(body)
@@ -200,7 +200,7 @@ def power_rows(run, gpu, phases, t_end, t0, rng):
return rows
def make(run, out_dir, bench, ids):
def make(run, bench, ids):
front, launch = recipe_front(run["recipe"])
cmd = launch
for old, new in run.get("sub", []):
@@ -254,7 +254,7 @@ def make(run, out_dir, bench, ids):
"greedy_hash": hashlib.sha256(f"{front['model']}{front['quant']}".encode()).hexdigest()[:12],
"greedy_reasoning": "yes"}
d = out_dir / rid
d = ROOT / cookbook.slug(front["gpu"]) / "results" / rid
shutil.rmtree(d, ignore_errors=True)
d.mkdir(parents=True)
with tempfile.TemporaryDirectory() as tmp:
@@ -277,7 +277,7 @@ def make(run, out_dir, bench, ids):
config = json.loads((d / "config.json").read_text(encoding="utf-8"))
argv = ["betterbench", "run", "--no-update-check", "--endpoint", endpoint, "--model", served,
"--config", f"results/{rid}/config.json", "--name", name, "--out", f"results/{rid}/{rid}.json"]
"--config", f"{d.relative_to(ROOT)}/config.json", "--name", name, "--out", f"{d.relative_to(ROOT)}/{rid}.json"]
argv += (["--quick"] if quick else []) + ["--max-model-len", str(ctx)]
for k, v in notes.items():
argv += ["--note", f"{k}={v}"]
@@ -338,12 +338,11 @@ def main():
bench = a.benchmarks.resolve()
if not (bench / "dev" / "postrun.py").exists():
sys.exit(f"no benchmarks checkout at {bench} (pass --benchmarks DIR)")
out = ROOT / "results"
for d in out.glob("*/DEMO"):
for d in ROOT.glob("*/results/*/DEMO"):
shutil.rmtree(d.parent)
ids = set()
for run in RUNS:
make(run, out, bench, ids)
make(run, bench, ids)
if __name__ == "__main__":
+20 -8
View File
@@ -11,7 +11,7 @@ import pytest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import cookbook # noqa: E402
RECIPE = "recipes/qwen3.8-27b/arc-pro-b65/vllm-single-user.md"
RECIPE = "arc-pro-b65/qwen3.8-27b/vllm-single-user.md"
def test_command_words_ignores_layout_and_comments():
@@ -65,8 +65,8 @@ def test_repo_validates_and_is_built():
def test_verified_needs_two_submitters():
cb = cookbook.Cookbook()
status = {r["id"]: r["status"] for r in cb.recipes}
assert status["qwen3.8-27b/arc-pro-b65/vllm-single-user"] == "verified by 2"
assert status["qwen3.8-27b/arc-pro-b65/vllm-throughput"] == "one submitter"
assert status["arc-pro-b65/qwen3.8-27b/vllm-single-user"] == "verified by 2"
assert status["arc-pro-b65/qwen3.8-27b/vllm-throughput"] == "one submitter"
# ---------------------------------------------------------------- broken copies
@@ -74,7 +74,7 @@ def test_verified_needs_two_submitters():
def repo(tmp_path):
root = tmp_path / "cookbook"
shutil.copytree(cookbook.ROOT, root, ignore=shutil.ignore_patterns(".git", "__pycache__", "*.html"))
for d in (root / "results").iterdir(): # validate only needs the reports to exist
for d in root.glob("*/results/*"): # validate only needs the reports to exist
if d.is_dir():
(d / f"{d.name}.html").touch()
return root
@@ -113,11 +113,11 @@ def test_launch_command_must_be_the_benchmarked_one(repo):
def test_only_arc_gpus(repo):
edit(repo / RECIPE, 'gpu = "Arc Pro B65"', 'gpu = "RTX 4090"')
e = errors(repo)
assert "not an Intel Arc GPU" in e and "should be recipes/" in e
assert "not an Intel Arc GPU" in e and "should be rtx-4090/" in e
def test_edited_results_are_caught(repo):
d = repo / "results" / "261022_demo_qwen3.8-27b_vllm_1x-arc-pro-b65"
d = repo / "arc-pro-b65" / "results" / "261022_demo_qwen3.8-27b_vllm_1x-arc-pro-b65"
meta = json.loads((d / "meta.json").read_text(encoding="utf-8"))
meta["notes"]["spec"] = "none"
(d / "meta.json").write_text(json.dumps(meta), encoding="utf-8")
@@ -125,11 +125,23 @@ def test_edited_results_are_caught(repo):
def test_placeholder_digest_only_for_demo(repo):
(repo / "results" / "261019_demo_qwen3.5-9b_llama.cpp_1x-arc-pro-b65" / "DEMO").unlink()
(repo / "arc-pro-b65" / "results" / "261019_demo_qwen3.5-9b_llama.cpp_1x-arc-pro-b65" / "DEMO").unlink()
e = errors(repo)
assert "all-zero placeholder" in e
def test_tried_needs_an_existing_result(repo):
edit(repo / "tried/qwen3.5-9b/arc-pro-b65.md", "_quick_2", "_quick_9")
edit(repo / "arc-pro-b65/qwen3.5-9b/tried.md", "_quick_2", "_quick_9")
assert "is not in results/" in errors(repo)
def test_result_must_sit_in_its_gpu_folder(repo):
run = "261024_demo_qwen3.5-9b_llama.cpp_1x-arc-b580"
shutil.move(repo / "arc-b580" / "results" / run, repo / "arc-pro-b65" / "results" / run)
e = errors(repo)
assert "but it is in the Arc Pro B65 folder" in e and f"result {run} is not in results/" not in e
def test_stray_top_level_folder_warns(repo):
(repo / "arc-b999").mkdir()
assert any("arc-b999: not a GPU" in w for w in cookbook.Cookbook(repo).warnings)