mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-30 08:42:00 +00:00 
			
		
		
		
	ggml : add error handling to graph_compute (whisper/1714)
This commit is contained in:
		 Finn Voorhees
					Finn Voorhees
				
			
				
					committed by
					
						 Georgi Gerganov
						Georgi Gerganov
					
				
			
			
				
	
			
			
			 Georgi Gerganov
						Georgi Gerganov
					
				
			
						parent
						
							c1d7cb28d3
						
					
				
				
					commit
					1bf681f90e
				
			| @@ -195,11 +195,14 @@ void ggml_backend_graph_plan_compute(ggml_backend_t backend, ggml_backend_graph_ | ||||
|     ggml_backend_synchronize(backend); | ||||
| } | ||||
|  | ||||
| void ggml_backend_graph_compute(ggml_backend_t backend, struct ggml_cgraph * cgraph) { | ||||
|     backend->iface.graph_compute(backend, cgraph); | ||||
| bool ggml_backend_graph_compute(ggml_backend_t backend, struct ggml_cgraph * cgraph) { | ||||
|     if (!backend->iface.graph_compute(backend, cgraph)) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     // TODO: optional sync | ||||
|     ggml_backend_synchronize(backend); | ||||
|     return true; | ||||
| } | ||||
|  | ||||
| bool ggml_backend_supports_op(ggml_backend_t backend, const struct ggml_tensor * op) { | ||||
| @@ -597,7 +600,7 @@ static void ggml_backend_cpu_graph_plan_compute(ggml_backend_t backend, ggml_bac | ||||
|     GGML_UNUSED(backend); | ||||
| } | ||||
|  | ||||
| static void ggml_backend_cpu_graph_compute(ggml_backend_t backend, struct ggml_cgraph * cgraph) { | ||||
| static bool ggml_backend_cpu_graph_compute(ggml_backend_t backend, struct ggml_cgraph * cgraph) { | ||||
|     struct ggml_backend_cpu_context * cpu_ctx = (struct ggml_backend_cpu_context *)backend->context; | ||||
|  | ||||
|     struct ggml_cplan cplan = ggml_graph_plan(cgraph, cpu_ctx->n_threads); | ||||
| @@ -611,6 +614,7 @@ static void ggml_backend_cpu_graph_compute(ggml_backend_t backend, struct ggml_c | ||||
|     cplan.work_data = cpu_ctx->work_data; | ||||
|  | ||||
|     ggml_graph_compute(cgraph, &cplan); | ||||
|     return true; | ||||
| } | ||||
|  | ||||
| static bool ggml_backend_cpu_supports_op(ggml_backend_t backend, const struct ggml_tensor * op) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user