MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / check_max_size

Function check_max_size

subprojects/llama.cpp/tests/test-alloc.cpp:195–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195static void check_max_size(ggml_context * ctx) {
196 for (ggml_tensor * t = ggml_get_first_tensor(ctx); t; t = ggml_get_next_tensor(ctx, t)) {
197 auto buft = ggml_backend_buffer_get_type(t->buffer);
198 size_t max_size = ggml_backend_buft_get_max_size(buft);
199 size_t offset = (char *) t->data - (char *) ggml_backend_buffer_get_base(t->buffer);
200 GGML_ASSERT(t->data >= ggml_backend_buffer_get_base(t->buffer));
201 GGML_ASSERT((size_t) offset + ggml_nbytes(t) <= max_size);
202 }
203}
204
205static bool can_reuse_memory(ggml_cgraph * graph, int current_i, ggml_tensor * current, ggml_tensor * other) {
206 if (other->flags & GGML_TENSOR_FLAG_OUTPUT) {

Callers 7

test_fill_leftover_spaceFunction · 0.85
test_view_inplaceFunction · 0.85
test_reuse_and_freeFunction · 0.85
test_merge_free_blockFunction · 0.85

Calls 6

ggml_get_first_tensorFunction · 0.85
ggml_get_next_tensorFunction · 0.85
ggml_nbytesFunction · 0.85

Tested by

no test coverage detected