MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / ggml_scratch_save

Function ggml_scratch_save

ggml.c:2363–2371  ·  view source on GitHub ↗

IMPORTANT: when creating "opt" tensors, always save and load the scratch buffer this is an error prone process, but it is necessary to support inplace operators when using scratch buffers TODO: implement a better way

Source from the content-addressed store, hash-verified

2361// operators when using scratch buffers
2362// TODO: implement a better way
2363static void ggml_scratch_save(struct ggml_context * ctx) {
2364 // this is needed to allow opt tensors to store their data
2365 // TODO: again, need to find a better way
2366 ctx->no_alloc_save = ctx->no_alloc;
2367 ctx->no_alloc = false;
2368
2369 ctx->scratch_save = ctx->scratch;
2370 ctx->scratch.data = NULL;
2371}
2372
2373static void ggml_scratch_load(struct ggml_context * ctx) {
2374 ctx->no_alloc = ctx->no_alloc_save;

Callers 2

ggml_new_i32Function · 0.85
ggml_new_f32Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected