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
KDA-HF: four checkpoint slots, so an 8192-row chunk with four mode-2 checkpoints stays on the kernel
YanissAmz8f69a50eec2b
diff --git a/exllamav3/vendor/fla/hip/kda_hf.hip b/exllamav3/vendor/fla/hip/kda_hf.hipindex a6182c6..19393ac 100644--- a/exllamav3/vendor/fla/hip/kda_hf.hip+++ b/exllamav3/vendor/fla/hip/kda_hf.hip@@ -60,7 +60,8 @@ extern "C" __global__ void kda_chunk16_wmma(const float* __restrict__ g, const unsigned short* __restrict__ beta, const float* __restrict__ akk,const unsigned short* __restrict__ aqk, float* __restrict__ state, unsigned short* __restrict__ output,int rows, int key_heads, int value_heads, float query_scale,- float* __restrict__ ck0, int ck_row0, float* __restrict__ ck1, int ck_row1) { // state entering row ck_row* (multiple of 16), or -1+ float* __restrict__ ck0, int ck_row0, float* __restrict__ ck1, int ck_row1, // state entering row ck_row* (multiple of 16), or -1;+ float* __restrict__ ck2, int ck_row2, float* __restrict__ ck3, int ck_row3) { // 4 slots: an 8192-row chunk carries 3 interior + the last pageconst int vh = blockIdx.x;const int tid = threadIdx.x, wave = tid >> 5, lane = tid & 31, l16 = lane & 15, hi = lane >> 4;const int kh = vh / (value_heads / key_heads);@@ -262,8 +263,8 @@ extern "C" __global__ void kda_chunk16_wmma(S[t] = GC_WMMA(*(const gc_h16*)&kdT[16 * t + l16][0], vb, S[t]);}GC_BARRIER(); // chunk inputs consumed; out_s complete- if (t0 + 16 == ck_row0 || t0 + 16 == ck_row1) { // prefix-cache checkpoint: S after this chunk = state entering row t0 + 16- float* ck = t0 + 16 == ck_row0 ? ck0 : ck1;+ float* ck = t0 + 16 == ck_row0 ? ck0 : t0 + 16 == ck_row1 ? ck1 : t0 + 16 == ck_row2 ? ck2 : t0 + 16 == ck_row3 ? ck3 : nullptr;+ if (ck) { // prefix-cache checkpoint: S after this chunk = state entering row t0 + 16#pragma unrollfor (int t = 0; t < 8; ++t)#pragma unrolldiff --git a/exllamav3/vendor/fla/hip/kda_hf_hip.py b/exllamav3/vendor/fla/hip/kda_hf_hip.pyindex 5f6ed09..79bc009 100644--- a/exllamav3/vendor/fla/hip/kda_hf_hip.py+++ b/exllamav3/vendor/fla/hip/kda_hf_hip.py@@ -58,7 +58,7 @@ def kda_hf_ok(q, k, v, g, beta, initial_state, chunk_size):def chunk_kda_hf(q, k, v, g, beta, scale, initial_state, output_final_state, ckpt=None, defs=None):- """Returns (o [1, T, HV, 128] bf16, final_state or None). ckpt: None, a dict or a list of <= 2 dicts {"s": fp32 [1, HV, K, V]+ """Returns (o [1, T, HV, 128] bf16, final_state or None). ckpt: None, a dict or a list of <= 4 dicts {"s": fp32 [1, HV, K, V]contiguous, "chunk": n} (kda_fused_h_hip contract): the state after row 64 n is written to ck["s"] and ck["ok"] set."""if defs is None:# diagonal 16x16 blocks: from fla's token_parallel kernel (exact fp32 pairwise decay) by default; EXL3_KDA_HF_DIAG=1 (read@@ -90,10 +90,10 @@ def chunk_kda_hf(q, k, v, g, beta, scale, initial_state, output_final_state, ckpctypes.c_float(scale)]cks = [] if ckpt is None else (list(ckpt) if isinstance(ckpt, (list, tuple)) else [ckpt])cks = [c for c in cks if 0 < 64 * c["chunk"] <= T]- assert len(cks) <= 2+ assert len(cks) <= 4 # EXL3_NC2_CKPT4: an 8192-row chunk carries 3 interior checkpoints + the last full pagefor c in cks:assert c["s"].dtype == torch.float32 and c["s"].is_contiguous() and c["s"].shape == (1, HV, K, K)- for i in range(2):+ for i in range(4):c = cks[i] if i < len(cks) else Noneargs += [P(0 if c is None else c["s"].data_ptr()), ctypes.c_int(-1 if c is None else 64 * c["chunk"])]params = (ctypes.c_void_p * len(args))(*[ctypes.cast(ctypes.byref(a), ctypes.c_void_p) for a in args])