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.

CUDA graph replay on by default for GGUF stored-bytes models (EXL3_CUDA_GRAPH=0 disables)

YanissAmz28d4b230fd56
diff --git a/exllamav3/architecture/minicpm_v47.py b/exllamav3/architecture/minicpm_v47.py
index 4717955..6eef146 100644
--- a/exllamav3/architecture/minicpm_v47.py
+++ b/exllamav3/architecture/minicpm_v47.py
@@ -246,6 +246,8 @@ class MiniCPMV47TextModel(Model):
def __init__(self, config: MiniCPMV47Config, **kwargs):
super().__init__(config, **kwargs)
+ from ..model import cuda_graph
+ cuda_graph.default_on_for_foreign()
H = config.hidden_size
self.modules += [
Embedding(config=config, key=f"{P}.embed_tokens",
diff --git a/exllamav3/model/cuda_graph.py b/exllamav3/model/cuda_graph.py
index 473027b..33f05ad 100644
--- a/exllamav3/model/cuda_graph.py
+++ b/exllamav3/model/cuda_graph.py
@@ -631,6 +631,14 @@ class CudaGraphRunner:
self._model_ok = None
+def default_on_for_foreign():
+ """Foreign-format (GGUF stored-bytes) models are launch-bound at decode (~43 kernels per block): graph replay is ON by
+ default for them (+32 % on a 4-block qwen35moe cut, tokens identical). EXL3_CUDA_GRAPH=0 still turns it off."""
+ global CUDA_GRAPH_ENABLED
+ if os.environ.get("EXL3_CUDA_GRAPH") != "0":
+ CUDA_GRAPH_ENABLED = True
+
+
def maybe_forward(model, ids: torch.Tensor, params: dict):
"""Hook for Model.forward (non-TP branch). Returns the logits, or None to run the eager path."""
if not CUDA_GRAPH_ENABLED or torch.version.hip or not torch.cuda.is_available():
diff --git a/tests/test_gguf_qwen35moe_decode.py b/tests/test_gguf_qwen35moe_decode.py
index 9a4e3c0..dc64079 100644
--- a/tests/test_gguf_qwen35moe_decode.py
+++ b/tests/test_gguf_qwen35moe_decode.py
@@ -40,4 +40,6 @@ for grouped in ("1", "0", "1"):
n = min(len(res["1"]), len(res["0"]))
agree = sum(a == b for a, b in zip(res["1"], res["0"]))
print(f"token agreement {agree}/{n}")
+if os.environ.get("FMOE_TOKOUT"):
+ json.dump(res["1"], open(os.environ["FMOE_TOKOUT"], "w"))
print("PASS")