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
Make the hyperconnection mixer row-invariant for 9-32 rows
YanissAmz2c948621fb75
diff --git a/exllamav3/exllamav3_ext/hc_mix.cu b/exllamav3/exllamav3_ext/hc_mix.cuindex 98349be..79d26ea 100644--- a/exllamav3/exllamav3_ext/hc_mix.cu+++ b/exllamav3/exllamav3_ext/hc_mix.cu@@ -1582,7 +1582,10 @@ static void hc_mix_launchint hc_mix_num_chunks(int R, int row_len){TORCH_CHECK(R >= 0 && row_len > 0, "hc_mix_num_chunks: R must be nonnegative and row_len must be positive");- int chunks_a = std::min(128, std::max(1, 512 / std::max(R, 1)));+ // Verify rows (R <= 32) split the row like an 8-row call does: the chunk size, hence the partial-sum order of every row, then does not+ // depend on how many rows the call carries (R = 9 used to halve the chunk count and change the bits of every row)+ const int r_split = R <= 32 ? std::min(R, 8) : R;+ int chunks_a = std::min(128, std::max(1, 512 / std::max(r_split, 1)));const int target_cols = (row_len + chunks_a - 1) / chunks_a;int chunk_cols = ((target_cols + 4 * NUM_THREADS_A - 1) / (4 * NUM_THREADS_A)) * (4 * NUM_THREADS_A);return (row_len + chunk_cols - 1) / chunk_cols;diff --git a/tools/decode/hc_rows_probe.py b/tools/decode/hc_rows_probe.pynew file mode 100644index 0000000..d069138--- /dev/null+++ b/tools/decode/hc_rows_probe.py@@ -0,0 +1,37 @@+"""row invariance of ext.hc_mix_norm / hc_mix / hc_apply at R=1..32 (EXL3_ROOT=<worktree>): row j of an R-row call vs the same row alone."""+import os, sys+sys.path.insert(0, os.environ["EXL3_ROOT"])+import torch+from exllamav3.ext import exllamav3_ext as ext+torch.manual_seed(1); dev = "cuda"+D = 4096; H = 4; M = 24+fn = (torch.randn(M, H * D, device=dev) * 0.02).half()+base = torch.randn(M, device=dev); scale = torch.randn(3, device=dev) * 0.1+w = torch.randn(D, device=dev).half()+Rmax = 32+st = torch.randn(Rmax, H, D, device=dev)+def norm_call(s):+ R = s.shape[0]+ chunks = ext.hc_mix_num_chunks(R, H * D)+ part = torch.zeros(R, chunks, M + 1, device=dev); post = torch.zeros(R, H, device=dev); comb = torch.zeros(R, H, H, device=dev)+ y = torch.zeros(R, D, device=dev, dtype=torch.half)+ ext.hc_mix_norm(s.contiguous(), fn, base, scale, 1e-6, 1e-6, 20, part, post, comb, y, w, 1e-6, 0.0, 1.0)+ return post, comb, y+def mix_call(s):+ R = s.shape[0]+ chunks = ext.hc_mix_num_chunks(R, H * D)+ part = torch.zeros(R, chunks, M + 1, device=dev); post = torch.zeros(R, H, device=dev); comb = torch.zeros(R, H, H, device=dev)+ y = torch.zeros(R, D, device=dev, dtype=torch.half)+ ext.hc_mix(s.contiguous(), fn, base, scale, 1e-6, 1e-6, 20, part, post, comb, y)+ return post, comb, y+bad = 0+for name, call in (("hc_mix_norm", norm_call), ("hc_mix", mix_call)):+ ref = [call(st[j:j + 1]) for j in range(Rmax)]+ for R in list(range(2, 33)):+ out = call(st[:R])+ eq = []+ for j in range(R):+ eq.append(all(torch.equal(out[k][j:j + 1], ref[j][k]) for k in range(3)))+ if not all(eq):+ bad += 1; print(name, "R", R, "rows not equal to R=1:", [j for j, e in enumerate(eq) if not e][:8], flush=True)+print("DONE bad", bad)