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.

Hy4 graph: fresh memory pool when graphs are dropped

YanissAmz2f66b8cc6c91
diff --git a/exllamav3/loader/step_graph.py b/exllamav3/loader/step_graph.py
index 776d8f5..3d93fde 100644
--- a/exllamav3/loader/step_graph.py
+++ b/exllamav3/loader/step_graph.py
@@ -208,6 +208,14 @@ class GraphDecoder:
indexer_static_init(fw._indexer_fused(i), self.cap)
self.prepared = True
+ def clear(self):
+ """drop every captured graph (a flag changed) and start a fresh memory pool (a pool handle must not outlive its graphs)"""
+ self.graphs.clear()
+ self.pool = torch.cuda.graph_pool_handle()
+ import gc
+ gc.collect()
+ torch.cuda.empty_cache()
+
def reset(self):
"""new sequence: zero the static state (buffers keep their addresses so captured graphs stay valid)"""
fw = self.fw