@@ -152,7 +152,7 @@ static void whisper_log_callback_default(ggml_log_level level, const char * text
152152//  ggml helpers
153153// 
154154
155- static  void  ggml_graph_compute_helper (
155+ static  bool  ggml_graph_compute_helper (
156156          struct  ggml_cgraph  * graph,
157157        std::vector<uint8_t > & buf,
158158                         int    n_threads,
@@ -168,10 +168,10 @@ static void ggml_graph_compute_helper(
168168        plan.work_data  = buf.data ();
169169    }
170170
171-     ggml_graph_compute (graph, &plan);
171+     return   ggml_graph_compute (graph, &plan);
172172}
173173
174- static  void  ggml_graph_compute_helper (
174+ static  bool  ggml_graph_compute_helper (
175175       struct  ggml_backend  * backend,
176176        struct  ggml_cgraph  * graph,
177177                       int    n_threads) {
@@ -183,7 +183,7 @@ static void ggml_graph_compute_helper(
183183        ggml_backend_metal_set_n_cb (backend, n_threads);
184184    }
185185#endif 
186-     ggml_backend_graph_compute (backend, graph);
186+     return   ggml_backend_graph_compute (backend, graph);
187187}
188188
189189//  faster matrix multiplications for tensors that do not have dimension 0 divisible by "pad"
@@ -2103,7 +2103,9 @@ static bool whisper_encode_internal(
21032103        ggml_allocr_alloc_graph (alloc, gf);
21042104
21052105        if  (!whisper_encode_external (wstate)) {
2106-             ggml_graph_compute_helper (wstate.backend , gf, n_threads);
2106+             if  (!ggml_graph_compute_helper (wstate.backend , gf, n_threads)) {
2107+                 return  false ;
2108+             }
21072109        }
21082110    }
21092111
@@ -2117,7 +2119,9 @@ static bool whisper_encode_internal(
21172119
21182120        ggml_allocr_alloc_graph (alloc, gf);
21192121
2120-         ggml_graph_compute_helper (wstate.backend , gf, n_threads);
2122+         if  (!ggml_graph_compute_helper (wstate.backend , gf, n_threads)) {
2123+             return  false ;
2124+         }
21212125    }
21222126
21232127    //  cross
@@ -2130,7 +2134,9 @@ static bool whisper_encode_internal(
21302134
21312135        ggml_allocr_alloc_graph (alloc, gf);
21322136
2133-         ggml_graph_compute_helper (wstate.backend , gf, n_threads);
2137+         if  (!ggml_graph_compute_helper (wstate.backend , gf, n_threads)) {
2138+             return  false ;
2139+         }
21342140    }
21352141
21362142    wstate.t_encode_us  += ggml_time_us () - t_start_us;
@@ -2552,7 +2558,9 @@ static bool whisper_decode_internal(
25522558
25532559        logits = gf->nodes [gf->n_nodes  - 1 ];
25542560
2555-         ggml_graph_compute_helper (wstate.backend , gf, n_threads);
2561+         if  (!ggml_graph_compute_helper (wstate.backend , gf, n_threads)) {
2562+             return  false ;
2563+         }
25562564    }
25572565
25582566    logits_out.resize (n_tokens*n_vocab);
0 commit comments