| 346 | } |
| 347 | |
| 348 | static void ggml_backend_cpu_graph_compute(ggml_backend_t backend, struct ggml_cgraph * cgraph) { |
| 349 | struct ggml_backend_cpu_context * cpu_ctx = (struct ggml_backend_cpu_context *)backend->context; |
| 350 | |
| 351 | struct ggml_cplan cplan = ggml_graph_plan(cgraph, cpu_ctx->n_threads); |
| 352 | |
| 353 | if (cpu_ctx->work_size < cplan.work_size) { |
| 354 | // TODO: may be faster to free and use malloc to avoid the copy |
| 355 | cpu_ctx->work_data = realloc(cpu_ctx->work_data, cplan.work_size); |
| 356 | cpu_ctx->work_size = cplan.work_size; |
| 357 | } |
| 358 | |
| 359 | cplan.work_data = cpu_ctx->work_data; |
| 360 | |
| 361 | ggml_graph_compute(cgraph, &cplan); |
| 362 | } |
| 363 | |
| 364 | static bool ggml_backend_cpu_supports_op(ggml_backend_t backend, const struct ggml_tensor * op) { |
| 365 | return true; |
nothing calls this directly
no test coverage detected