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.

Merge feature/hy4-strix-192-kv10-r192 into 1.9.3 tree

YanissAmz05d9195d100d
diff --cc exllamav3/loader/mtp_head.py
index bf3154e,9d000d3..d41879c
--- a/exllamav3/loader/mtp_head.py
+++ b/exllamav3/loader/mtp_head.py
@@@ -100,10 -100,8 +103,10 @@@ class Hy4MTP
st = _ns.state(fw)
self.cap = cap or st.cap
self.ar = st.ar if st.ar.shape[0] >= self.cap else torch.arange(self.cap, device=dev)
- self.kbuf = torch.zeros(self.cap, mla.R + mla.rope_dim, device=dev)
+ self.kbuf = _KV8.Fp8KV(self.cap, mla.R, mla.rope_dim, dev) if KV_FP8_MTP else torch.zeros(self.cap, mla.R + mla.rope_dim, device=dev)
SG.indexer_static_init(self.ix, self.cap)
+ self.ix.gv = self.fast and os.environ.get("HY4_DRAFT_IX_GV", "0") == "1" # indexer fp32 matrices on the mat-vec
+ print(f"mtp_head: draft cfg fast={self.fast} moe_tiles={MI.GU_T}/{MI.DN_T} (flag {int(MI.TILES)}) mla_bg={getattr(mla, 'bg_kb', None) is not None and getattr(mla.bg_kb, 'draft', False)} (wk_b/wv_b int8) ix_gv={self.ix.gv}", flush=True)
try:
from . import attn_eager as _AE
_AE.ensure(self.cap)
diff --cc exllamav3/loader/step_graph.py
index 927fb83,57d3bdc..a03dd46
--- a/exllamav3/loader/step_graph.py
+++ b/exllamav3/loader/step_graph.py
@@@ -71,25 -75,10 +77,26 @@@ def indexer_static_init(ix, cap)
m = ix.vg.shape[0]
vgb[(torch.arange(ix.n - m, ix.n, device=ix.dev) % ix.vg_ring) if ix.vg_ring else slice(ix.n - m, ix.n)] = ix.vg
ix._max_pos = cap
- ix._table(cap)
+ if not _RR.ENABLED: # HY4_ROPE_POS: the rope rows of a call come from its positions, no table to the full context
+ ix._table(cap)
+IX_GV_FIRES = _LVF.Fires("draft_ix_gv", hit="gv", miss="gemm") # draft indexer matrices (ix has the gv attribute): gv = mat-vec calls, gemm = {reason: n} of the calls that kept the GEMM (the trunk's indexer has no gv attribute and is not counted)
+
+
+def _mmw(ix, a, name):
+ """a @ ix.w[name].T; the draft layer's indexer (ix.gv, HY4_DRAFT_IX_GV=1) runs its small fp32 matrices through the router mat-vec (rocBLAS SGEMM at M = 1 runs these at 12-60 GB/s)"""
+ w = ix.w[name]
+ gv = getattr(ix, "gv", None)
+ if gv is None:
+ return a @ w.T
+ if gv and _RG.usable(a, w):
+ IX_GV_FIRES.hit()
+ return _RG.logits(a, w)
+ IX_GV_FIRES.miss("flag_off" if not gv else "unusable_shape")
+ return a @ w.T
+
+
@torch.no_grad()
def indexer_keys_static(ix, x, pos, ar):
"""key side of indexer_forward_static: the per-position (value | gate) rows and the pool groups they complete (x [T, E], pos [T] long device, ascending). Needs no query and no selection."""