Skip to content

Commit a318f9d

Browse files
howard0suCopilot
andcommitted
gemma4: check graph_compute return in prefill_bsa per-layer embed
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 22c510f commit a318f9d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

dflash/src/gemma4/gemma4_graph.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,12 @@ bool gemma4_prefill_bsa(
960960
return false;
961961
}
962962
ggml_backend_tensor_set(tok, token_ids, 0, (size_t)S * sizeof(int32_t));
963-
ggml_backend_graph_compute(backend, gf);
963+
if (ggml_backend_graph_compute(backend, gf) != GGML_STATUS_SUCCESS) {
964+
std::fprintf(stderr, "gemma4_prefill_bsa: per-layer embed graph_compute failed\n");
965+
ggml_gallocr_free(ga); ggml_free(ctx);
966+
g4_free_pers(per_layer_buf); cleanup_all();
967+
return false;
968+
}
964969
ggml_gallocr_free(ga);
965970
ggml_free(ctx);
966971
}

0 commit comments

Comments
 (0)