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.

qdec: run 4 and 5 q tiles on the HIP split kernel instead of the Triton fallback

YanissAmz73eae3d0e6d8
diff --git a/exllamav3/modules/attention_fn/qdec_hip.py b/exllamav3/modules/attention_fn/qdec_hip.py
index 389630c..4b3b812 100644
--- a/exllamav3/modules/attention_fn/qdec_hip.py
+++ b/exllamav3/modules/attention_fn/qdec_hip.py
@@ -41,13 +41,18 @@ def _hip():
def pick_dw(hd, nt, nw):
- """waves per stream splitting the head dim: the smallest count that keeps the O accumulators (NT * HD/16 * 8 / DW floats) in budget"""
+ """waves per stream splitting the head dim: the smallest count that keeps the O accumulators (NT * HD/16 * 8 / DW floats) in budget.
+ Shapes past that budget (4 and 5 q tiles at hd 256) still take DW=4, with the accumulators spilling, when they fit the second budget:
+ the alternative there is the Triton fallback, measured 6.6x / 4.8x slower per call at 131K (same rows, same cache bytes)."""
if knob("EXL3_QDEC_HIP_DW"):
dw = int(knob("EXL3_QDEC_HIP_DW"))
return dw if dw in (1, 2, 4) and nw % dw == 0 and hd // 16 // dw >= 4 else None
for dw in (1, 2, 4):
if nw % dw == 0 and hd // 16 // dw >= 4 and nt * (hd // 16) * 8 // dw <= knob_int("EXL3_QDEC_HIP_MAXO", 96):
return dw
+ dw = 4
+ if nw % dw == 0 and hd // 16 // dw >= 4 and nt * (hd // 16) * 8 // dw <= knob_int("EXL3_QDEC_HIP_MAXO2", 160):
+ return dw
return None
diff --git a/exllamav3/util/knobs.py b/exllamav3/util/knobs.py
index 4333678..6f11ad6 100644
--- a/exllamav3/util/knobs.py
+++ b/exllamav3/util/knobs.py
@@ -46,6 +46,7 @@ KNOBS = {
"EXL3_QDEC_HIP_NW": "0",
"EXL3_QDEC_HIP_DW": "",
"EXL3_QDEC_HIP_MAXO": "96",
+ "EXL3_QDEC_HIP_MAXO2": "160",
"EXL3_QDEC_HIP_SPL": "",
"EXL3_QDEC_HIP_WAVES": "0",
"EXL3_QDEC_HIP_VPF": "1",