From: Jiahao Li Date: Sun, 23 Jul 2023 15:17:06 +0000 (+0800) Subject: ggml : add get_no_alloc api corresponding to set_no_alloc (#402) X-Git-Tag: upstream/0.0.1642~1297 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=28b314ba637b7d7185e03482f857259b441b06c0;p=pkg%2Fggml%2Fsources%2Fggml ggml : add get_no_alloc api corresponding to set_no_alloc (#402) --- diff --git a/include/ggml/ggml.h b/include/ggml/ggml.h index d1539027..def39e35 100644 --- a/include/ggml/ggml.h +++ b/include/ggml/ggml.h @@ -558,6 +558,7 @@ extern "C" { GGML_API size_t ggml_used_mem(const struct ggml_context * ctx); GGML_API size_t ggml_set_scratch (struct ggml_context * ctx, struct ggml_scratch scratch); + GGML_API bool ggml_get_no_alloc(struct ggml_context * ctx); GGML_API void ggml_set_no_alloc(struct ggml_context * ctx, bool no_alloc); GGML_API void * ggml_get_mem_buffer (const struct ggml_context * ctx); diff --git a/src/ggml.c b/src/ggml.c index 931a2092..333e8845 100644 --- a/src/ggml.c +++ b/src/ggml.c @@ -4445,6 +4445,10 @@ size_t ggml_set_scratch(struct ggml_context * ctx, struct ggml_scratch scratch) return result; } +bool ggml_get_no_alloc(struct ggml_context * ctx) { + return ctx->no_alloc; +} + void ggml_set_no_alloc(struct ggml_context * ctx, bool no_alloc) { ctx->no_alloc = no_alloc; }