Skip to content

Commit 8e79201

Browse files
Update llama-context-mmojo.cpp
Signed-off-by: Brad Hutchings <[email protected]>
1 parent b9eb212 commit 8e79201

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/llama-context-mmojo.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ llama_context::llama_context(
113113
}
114114
}
115115

116+
{
117+
const char * LLAMA_GRAPH_REUSE_DISABLE = getenv("LLAMA_GRAPH_REUSE_DISABLE");
118+
graph_reuse_disable = LLAMA_GRAPH_REUSE_DISABLE ? (atoi(LLAMA_GRAPH_REUSE_DISABLE) != 0) : graph_reuse_disable;
119+
120+
if (graph_reuse_disable) {
121+
LLAMA_LOG_WARN("%s: graph reuse disabled\n", __func__);
122+
}
123+
}
124+
116125
const uint32_t n_ctx_per_seq = cparams.n_ctx / cparams.n_seq_max;
117126

118127
LLAMA_LOG_INFO("%s: n_seq_max = %u\n", __func__, cparams.n_seq_max);
@@ -716,7 +725,7 @@ llm_graph_result * llama_context::process_ubatch(const llama_ubatch & ubatch, ll
716725
// in order to correctly reuse a graph, it's full topology has to be uniquely determined by these parameters
717726
const auto gparams = graph_params(res, ubatch, mctx, gtype);
718727

719-
if (res->can_reuse(gparams)) {
728+
if (!graph_reuse_disable && res->can_reuse(gparams)) {
720729
//LLAMA_LOG_DEBUG("%s: reusing previous graph\n", __func__);
721730

722731
n_reused++;

0 commit comments

Comments
 (0)