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

Function ggml_get_max_tensor_size

ggml.c:2336–2356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2334}
2335
2336size_t ggml_get_max_tensor_size(const struct ggml_context * ctx) {
2337 size_t max_size = 0;
2338
2339 struct ggml_object * obj = ctx->objects_begin;
2340
2341 while (obj != NULL) {
2342 if (obj->type == GGML_OBJECT_TENSOR) {
2343 struct ggml_tensor * tensor = (struct ggml_tensor *) ((char *) ctx->mem_buffer + obj->offs);
2344
2345 const size_t size = ggml_nbytes(tensor);
2346
2347 if (max_size < size) {
2348 max_size = size;
2349 }
2350 }
2351
2352 obj = obj->next;
2353 }
2354
2355 return max_size;
2356}
2357
2358// IMPORTANT:
2359// when creating "opt" tensors, always save and load the scratch buffer

Callers 2

mainFunction · 0.50

Calls 1

ggml_nbytesFunction · 0.70

Tested by

no test coverage detected