diff options
author | Finn Voorhees <finnvoorhees@gmail.com> | 2024-01-03 08:39:43 -0500 |
---|---|---|
committer | Georgi Gerganov <ggerganov@gmail.com> | 2024-01-05 18:02:06 +0200 |
commit | 1bf681f90ef4cf37b36e6d604d3e30fc57eda650 (patch) | |
tree | d2b1789f7503961d8b1cb52da244e4cd078824b0 /ggml-metal.m | |
parent | c1d7cb28d3fed97fbc95fc3c43f0c5e2113e546c (diff) |
ggml : add error handling to graph_compute (whisper/1714)
Diffstat (limited to 'ggml-metal.m')
-rw-r--r-- | ggml-metal.m | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ggml-metal.m b/ggml-metal.m index 7aa92c14..55cc1a87 100644 --- a/ggml-metal.m +++ b/ggml-metal.m @@ -977,7 +977,7 @@ static bool ggml_metal_supports_op(const struct ggml_tensor * op) { return false; } } -void ggml_metal_graph_compute( +bool ggml_metal_graph_compute( struct ggml_metal_context * ctx, struct ggml_cgraph * gf) { @autoreleasepool { @@ -2405,10 +2405,11 @@ void ggml_metal_graph_compute( MTLCommandBufferStatus status = (MTLCommandBufferStatus) [ctx->command_buffers[i] status]; if (status != MTLCommandBufferStatusCompleted) { GGML_METAL_LOG_INFO("%s: command buffer %d failed with status %lu\n", __func__, i, status); - GGML_ASSERT(false); + return false; } } + return true; } } @@ -2688,10 +2689,10 @@ static ggml_backend_buffer_type_t ggml_backend_metal_get_default_buffer_type(ggm UNUSED(backend); } -static void ggml_backend_metal_graph_compute(ggml_backend_t backend, struct ggml_cgraph * cgraph) { +static bool ggml_backend_metal_graph_compute(ggml_backend_t backend, struct ggml_cgraph * cgraph) { struct ggml_metal_context * metal_ctx = (struct ggml_metal_context *)backend->context; - ggml_metal_graph_compute(metal_ctx, cgraph); + return ggml_metal_graph_compute(metal_ctx, cgraph); } static bool ggml_backend_metal_supports_op(ggml_backend_t backend, const struct ggml_tensor * op) { |