Skip to content

Commit

Permalink
ggml : add get_no_alloc api corresponding to set_no_alloc (ggerganov#402
Browse files Browse the repository at this point in the history
)
  • Loading branch information
li-plus authored Jul 23, 2023
1 parent 07414d7 commit 28b314b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/ggml/ggml.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 28b314b

Please sign in to comment.