From 567b5e24ed09ab6adb584917f697d5c208d071f2 Mon Sep 17 00:00:00 2001 From: slaren Date: Tue, 25 Jul 2023 20:35:59 +0200 Subject: [PATCH] allocate work buffer as a ggml_object in ggml_graph_compute_with_ctx --- ggml.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ggml.c b/ggml.c index 4c729115f..d4abfcc5f 100644 --- a/ggml.c +++ b/ggml.c @@ -16576,10 +16576,9 @@ void ggml_graph_reset(struct ggml_cgraph * cgraph) { void ggml_graph_compute_with_ctx(struct ggml_context * ctx, struct ggml_cgraph * cgraph, int n_threads) { struct ggml_cplan cplan = ggml_graph_plan(cgraph, n_threads); - struct ggml_tensor * buf = ggml_new_tensor_1d(ctx, GGML_TYPE_I8, cplan.work_size); - GGML_ASSERT(buf); + struct ggml_object * obj = ggml_new_object(ctx, GGML_OBJECT_WORK_BUFFER, cplan.work_size); - cplan.work_data = buf->data; + cplan.work_data = (uint8_t *)ctx->mem_buffer + obj->offs; ggml_graph_compute(cgraph, &cplan); }