Skip to content

Commit d8118c6

Browse files
committed
fix: force ALL Phase2 nodes+leafs to GPU (node_XXX ADD ops and views were on CPU)
1 parent 9e63d6f commit d8118c6

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

src/llama-context.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,16 +2081,10 @@ llm_graph_result * llama_context::process_ubatch(const llama_ubatch & ubatch, ll
20812081
// --- CAPTURE PATH ---
20822082
// 1. Reset + force All Phase 2 ops/srcs to GPU, then alloc
20832083
ggml_backend_sched_reset(sched.get());
2084-
for (int i = 0; i < ggml_graph_n_nodes(phase2_gf); i++) {
2085-
ggml_tensor * t = ggml_graph_node(phase2_gf, i);
2086-
auto [tid, il] = h2_hijack.match_name(t->name);
2087-
if (tid >= 0) ggml_backend_sched_set_tensor_backend(sched.get(), t, gpu);
2088-
}
2089-
for (int i = 0; i < ggml_graph_n_leafs(phase2_gf); i++) {
2090-
ggml_tensor * t = ggml_graph_leaf(phase2_gf, i);
2091-
auto [tid, il] = h2_hijack.match_name(t->name);
2092-
if (tid >= 0) ggml_backend_sched_set_tensor_backend(sched.get(), t, gpu);
2093-
}
2084+
for (int i = 0; i < ggml_graph_n_nodes(phase2_gf); i++)
2085+
ggml_backend_sched_set_tensor_backend(sched.get(), ggml_graph_node(phase2_gf, i), gpu);
2086+
for (int i = 0; i < ggml_graph_n_leafs(phase2_gf); i++)
2087+
ggml_backend_sched_set_tensor_backend(sched.get(), ggml_graph_leaf(phase2_gf, i), gpu);
20942088
force_idxs_to_cpu();
20952089
if (!ggml_backend_sched_alloc_graph(sched.get(), phase2_gf)) {
20962090
ret = GGML_STATUS_ALLOC_FAILED; return nullptr;

0 commit comments

Comments
 (0)