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.
Python amdapple-siliconcudadeepseekexl3exllamav3glminferencellmllm-inferencelocal-llmnvidiaopenai-apiquantizationqwenrocmstrix-halo
Prefill roof bench: PREFILL_PROF=1 prints device-time split by op class and top kernels
YanissAmz43f14fbd842c
diff --git a/tests/bench_prefill_roof.py b/tests/bench_prefill_roof.pyindex 56ce786..37c5ca9 100644--- a/tests/bench_prefill_roof.py+++ b/tests/bench_prefill_roof.py@@ -2,6 +2,7 @@per token; attention FLOPs not counted, so the gap at 32K includes them) and its share of the device's measured fp16 matmul peak.MODEL_DIR=<exl3 dir> | FMOE_GGUF=<file.gguf> [PREFILL_LENS=8192,32768] python tests/bench_prefill_roof.py+ PREFILL_PROF=1 adds a device-time split by op class and the top kernels for the last length."""import os, sys, timeimport torch@@ -60,9 +61,28 @@ for L in [1024] + lens:job = Job(input_ids=ids, max_new_tokens=1, sampler=GreedySampler(), stop_conditions=[])gen.enqueue(job)torch.cuda.synchronize(); t = time.time()+ prof = os.environ.get("PREFILL_PROF") and L == lens[-1]+ if prof:+ from torch.profiler import profile, ProfilerActivity+ pctx = profile(activities=[ProfilerActivity.CUDA]); pctx.__enter__()while gen.num_remaining_jobs():gen.iterate()torch.cuda.synchronize(); dt = time.time() - t+ if prof:+ pctx.__exit__(None, None, None)+ tot = sum(e.device_time_total for e in pctx.key_averages())+ classes = {"gemm/linear": ("gemm", "cijk", "cutlass", "mgemm", "gemv", "exl3", "mpw", "fq_", "matmul", "tensile"), "moe": ("moe", "expert", "route", "topk", "grouped", "dq_", "sort"),+ "gdn/ssm": ("chunk", "gated", "delta", "recompute", "conv", "gdn", "recurrent"), "attn": ("attn", "flash", "qsa", "rope", "paged", "softmax"),+ "norm/elem": ("norm", "gr_", "silu", "add", "mul", "hc_apply", "copy", "fill", "elementwise", "reduce", "cat", "index")}+ acc = {k: 0.0 for k in classes}; acc["other"] = 0.0+ for e in pctx.key_averages():+ n = e.key.lower()+ for k, subs in classes.items():+ if any(x in n for x in subs): acc[k] += e.device_time_total; break+ else: acc["other"] += e.device_time_total+ print(f"PROF L={L}: device {tot/1e3:.0f} ms of {dt*1e3:.0f} ms wall; class split: " + ", ".join(f"{k} {100*v/tot:.0f}%" for k, v in sorted(acc.items(), key=lambda kv: -kv[1])))+ for e in sorted(pctx.key_averages(), key=lambda e: -e.device_time_total)[:16]:+ print(f"{100*e.device_time_total/tot:5.1f}% {e.device_time_total/1e3:8.1f} ms n={e.count:6d} {e.key[:90]}")if L != 1024:r = L / dtprint(f"prefill L={L}: {dt:.2f}s = {r:.0f} tok/s, {2 * act * r / 1e12:.1f} TFLOPs-equiv = {100 * 2 * act * r / 1e12 / peak:.0f} % of matmul peak")