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
Hy4 multi-session: MUFAST line also when the scheduler goes idle, fires_line test, doc of the host path flags and the TM 16 kernel limits
YanissAmz3a7c58533385
diff --git a/doc/HY4_MULTI_USER.md b/doc/HY4_MULTI_USER.mdindex 66d0c58..86f36f8 100644--- a/doc/HY4_MULTI_USER.md+++ b/doc/HY4_MULTI_USER.md@@ -27,3 +27,16 @@ Slab per session ~ n_layers * cap * 2304 B (K) + 13 indexer layers * cap * 1.3 K- `tests/test_hy4_mu_slots.py` (CPU, Triton interpreter, and MU_DEV=cuda): indexer batched rows == solo per session (allow masks, vgb rows, pooled keys; past the all-causal bound), staggeredsessions, scrambled neighbours, sentinel slots never written (last slab, last position), MLA core reference == per-row solo reference, other slabs / future rows never read, Triton kernel == reference.- GPU (`tools/hy4/mu_bench.py`): solo legacy reference vs batched streams (first divergence index), logits of a row alone vs inside a 2-row step, aggregate / per-session tok/s, memory, ttft + gaps.++## Host path and TM (HY4_MU_HOSTFAST, HY4_GRAPH_TM, HY4_MU_PRECAP; all default OFF)+- Per decode round the host did, per session: argmax readback (already ONE `.tolist()` for all rows), `hcur` clone (N tiny launches), n-gram append, `GR.bind` before every draft chain+ (about 2 x layers slice ops), one `.tolist()` per session for the drafts; per step in `step_slots`: three `torch.tensor` input builds and the per-row, per-layer python Engram hash with+ every pread finished BEFORE the first replay (the solo path stages each layer group while the previous graph segment runs). `HY4_MU_HOSTFAST=1`: numpy `EngramStager` hash per session,+ each group staged just before its own segment, inputs through a numpy view of the pinned buffer, one indexed copy into a preallocated `[slots, D]` hcur buffer, one `torch.cat` + `.tolist()`+ for all drafts, no `bind` when the (slot, bucket) draft graph exists, n-gram appends deferred to the next round's GPU window. Same tokens as the baseline (CPU test).+- `HY4_MU_HOSTPROF=1`: one `MUFAST` line per 100 rounds and when the scheduler goes idle: path counters (plain, spec, hcur_idx, bind_skip, draft_cat, stage_vec, stage_ov, inp_np, rows_gt8)+ and ms per round for round / inputs / stage / launch / draft / wait / post / emit.+- `HY4_MU_PRECAP=512,1024`: before the server is ready, capture every (bucket, rows) trunk graph for rows 1..TM and every (slot, bucket) draft graph, and print `MUCURVE Nb T ms`.+- TM limit: `HY4_GRAPH_TM` up to 16. mu_slots `MAX_T = 16` (reference path above), `MMVQ_MAXR = 16` (MoE row kernels), engram staging and inputs are sized by TM. Rows 9..16 leave the+ 8-row fast paths: `mla_bgemv` / `router_gemv` (MAXT = 8: fp32 einsum / matmul), MLA absorb / unfold VALU kernels (R <= 8), DSA split decode (n_splits = 1 above 8 rows), `gm_moe_kq_decode`+ (R <= 8, off by default) so a 16-row round can cost more than two 8-row rounds; the `MUCURVE` line measures it. Above 16 rows nothing is supported.diff --git a/tests/test_hy4_mu_hostfast.py b/tests/test_hy4_mu_hostfast.pyindex f879342..eb622d9 100644--- a/tests/test_hy4_mu_hostfast.py+++ b/tests/test_hy4_mu_hostfast.py@@ -303,3 +303,19 @@ def test_step_slots_rows_equal_in_both_modes(decoder, monkeypatch):d.step_slots(rows)got[fast] = (d.gs.eng_raw[:, :5].clone(), d.gs.eng_valid[:, :5].clone(), d.hin[:, :5].clone())assert all(torch.equal(a, b) for a, b in zip(got[False], got[True]))+++def test_fires_line_format_is_what_the_driver_parses():+ import re+ from exllamav3.loader import step_mu+ eng = SimpleNamespace(SM=step_mu)+ snap = {}+ ME.HT["rounds"] += 100+ ME.HT["rows"] += 400+ line = ME.fires_line(eng, snap)+ assert line.startswith("MUFAST rounds=")+ got = {k: int(v) for k, v in re.findall(r"(\w+)=(\d+)(?=[ ])", line.split(" | ")[0] + " ")}+ for k in ("fast", "plain", "spec", "hcur_idx", "bind_skip", "draft_cat", "stage_vec", "stage_ov", "inp_np", "rows_gt8", "steps"):+ assert k in got, k+ assert "rows/round=4.00" in line+ assert ME.fires_line(SimpleNamespace(), None).startswith("MUFAST")diff --git a/tools/hy4/mu_engine.py b/tools/hy4/mu_engine.pyindex 2bfb483..fc8406b 100644--- a/tools/hy4/mu_engine.py+++ b/tools/hy4/mu_engine.py@@ -431,10 +431,13 @@ class MuScheduler(threading.Thread):def run(self):eng, pc = self.eng, time.perf_counter- prof, snap = _prof(), {}+ prof, snap, printed = _prof(), {}, 0try:eng.phase("decode")while True:+ if prof and HT["rounds"] > printed and not (self.pending or self.pf or self.dec): # idle: one MUFAST line per burst of requests (a bench cell)+ printed = HT["rounds"]+ print(fires_line(eng, snap), flush=True)with self.cv:while not (self.pending or self.pf or self.dec) and not self.stop_flag:self.cv.wait()@@ -490,6 +493,7 @@ class MuScheduler(threading.Thread):HT["round"] += t1 - t0HT["emit"] += pc() - t1if HT["rounds"] % 100 == 0:+ printed = HT["rounds"]print(fires_line(eng, snap), flush=True)except Exception as ex: # noqa: BLE001import traceback