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: HOSTPROF adds CUDA-event gpu / bubble / host splits, the precapture zeroes the FIRES counters and uses varied token ids (the expert union grows with the rows like real text)
YanissAmz11e55451590c
diff --git a/exllamav3/loader/step_mu.py b/exllamav3/loader/step_mu.pyindex c46596e..aed0bf2 100644--- a/exllamav3/loader/step_mu.py+++ b/exllamav3/loader/step_mu.py@@ -27,7 +27,7 @@ TM = SG.TM# right before its own graph segment so the reads overlap the GPU (the solo step_rows pipeline); the step inputs are written through a numpy view of the pinned buffer.# HY4_MU_HOSTPROF=1: perf_counter splits per step (HT, seconds) for the server log line of mu_engine.FIRES = {"stage_vec": 0, "stage_ov": 0, "inp_np": 0, "rows_gt8": 0, "steps": 0} # path counters (FIRES-CHECK): a flagged arm with 0 stage_ov FAILS-HT = {"stage": 0.0, "launch": 0.0, "inputs": 0.0}+HT = {"stage": 0.0, "launch": 0.0, "inputs": 0.0, "gpu": 0.0, "bubble": 0.0} # gpu = summed replay time of the segments, bubble = GPU idle between segments (events, HOSTPROF only)def hostfast() -> bool:@@ -242,6 +242,12 @@ class MultiDecoder(SG.GraphDecoder):t0 = pc() if prof else 0.0if self.ev_set:self.ev.synchronize()+ if prof and getattr(self, "_tev_n", 0): # the previous step is done: its per-segment event pairs give the GPU time and the idle gaps between segments+ pr = self._tev_pool[:self._tev_n]+ gpu = sum(a.elapsed_time(b) for a, b in pr)+ HT["gpu"] += gpu / 1000+ HT["bubble"] += (pr[0][0].elapsed_time(pr[-1][1]) - gpu) / 1000+ self._tev_n = 0tk, ps, bs, top = [], [], [], 0for s, toks in rows:assert s.n + len(toks) <= self.cap, "context past the slab"@@ -297,13 +303,21 @@ class MultiDecoder(SG.GraphDecoder):dt = pc() - t2HT["stage"] += dtt0 += dt # launch = the replay calls only+ if prof:+ if getattr(self, "_tev_pool", None) is None:+ self._tev_pool = [(torch.cuda.Event(enable_timing=True), torch.cuda.Event(enable_timing=True)) for _ in range(8)]+ self._tev_pool[si][0].record()with DBG.stage(f"{what} replay segment {si}/{len(cgs)}"):cg.replay()+ if prof:+ self._tev_pool[si][1].record()if ov:FIRES["stage_ov"] += 1if T > 8:FIRES["rows_gt8"] += 1FIRES["steps"] += 1+ if prof:+ self._tev_n = len(cgs)self.ev.record()self.ev_set = Truefor s, toks in rows:diff --git a/tools/hy4/mu_engine.py b/tools/hy4/mu_engine.pyindex fc8406b..fcb3c81 100644--- a/tools/hy4/mu_engine.py+++ b/tools/hy4/mu_engine.py@@ -36,10 +36,11 @@ def fires_line(eng, last: dict | None = None) -> str:ht = dict(HT)if sm is not None:fs.update(sm.FIRES)- ht.update({"stage": sm.HT["stage"], "launch": sm.HT["launch"], "inputs": sm.HT["inputs"]})+ ht.update({k: sm.HT[k] for k in ("stage", "launch", "inputs", "gpu", "bubble")})last = {} if last is None else lastnr = max(1, ht["rounds"] - last.get("rounds", 0))- ms = {k: 1000.0 * (ht.get(k, 0.0) - last.get(k, 0.0)) / nr for k in ("round", "inputs", "stage", "launch", "draft", "wait", "post", "emit")}+ ms = {k: 1000.0 * (ht.get(k, 0.0) - last.get(k, 0.0)) / nr for k in ("round", "inputs", "stage", "launch", "draft", "wait", "post", "emit", "gpu", "bubble")}+ ms["host"] = ms["round"] - ms["gpu"] # round time the GPU did not spend replaying (0 gpu = HOSTPROF events off)rows = (ht["rows"] - last.get("rows", 0)) / nrlast.clear()last.update(ht)@@ -540,7 +541,7 @@ def precapture(sch: MuScheduler, nbs=None, ts=None, progress=print):s.tokens = [0] * bases.n = baset = pc()- GR.step_slots([(s, [1] * T)])+ GR.step_slots([(s, [(i * 7919 + 13) % 50000 for i in range(T)])]) # varied ids: the routed experts of the rows differ, the union grows with T like real texttorch.cuda.synchronize()ms = (pc() - t) * 1000if rep == 0:@@ -561,4 +562,10 @@ def precapture(sch: MuScheduler, nbs=None, ts=None, progress=print):free = torch.cuda.mem_get_info()[0] / 2 ** 30except Exception: # noqa: BLE001pass+ sm = getattr(eng, "SM", None)+ if sm is not None: # the FIRES-CHECK counts the served requests only, never the precapture steps+ for k in sm.FIRES: sm.FIRES[k] = 0+ for k in sm.HT: sm.HT[k] = 0.0+ for k in FIRES: FIRES[k] = 0+ for k in HT: HT[k] = 0 if k in ("rounds", "rows") else 0.0progress(f"mu precapture: buckets {nbs} rows {ts[0]}..{ts[-1]}: {len(nbs) * len(ts)} trunk graphs, {nd} draft graphs, {pc() - t00:.1f} s, free GiB {free}")