MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / test_not_enough_chunks

Function test_not_enough_chunks

tests/test-alloc.cpp:328–349  ·  view source on GitHub ↗

This test assumes a max of 16 buffer chunks, and tries to allocate tensors that would require more. Expectation is that the last buffer should grow to fit everything, leaving it to the backend to error out if it can't allocate that much.

Source from the content-addressed store, hash-verified

326// require more. Expectation is that the last buffer should grow to fit everything,
327// leaving it to the backend to error out if it can't allocate that much.
328static void test_not_enough_chunks() {
329 const int max_chunks = 16;
330 const int max_size = 8;
331
332 dummy_backend backend = dummy_backend_init(max_size);
333 auto [ctx, graph, ctx_ptr] = make_context();
334
335 ggml_tensor * x[max_chunks + 1];
336 for (int i = 0; i < max_chunks + 1; ++i) {
337 x[i] = make_input_with_size(ctx, max_size);
338 }
339 ggml_tensor * acc = x[0];
340 for (int i = 0; i < max_chunks; ++i) {
341 acc = ggml_add(ctx, acc, x[i + 1]);
342 }
343 assign_names(ctx);
344
345 ggml_gallocr_ptr galloc = allocate_graph(graph, acc, &backend.buffer_type);
346 check_all_allocated(graph);
347 check_no_overlap(graph);
348 GGML_ASSERT(backend.context->allocated_total() > max_chunks * max_size);
349}
350
351// Fill up leftover unallocated space of a chunk after allocating a large tensor that
352// requires a new chunk.

Callers

nothing calls this directly

Calls 9

dummy_backend_initFunction · 0.85
make_contextFunction · 0.85
make_input_with_sizeFunction · 0.85
ggml_addFunction · 0.85
assign_namesFunction · 0.85
allocate_graphFunction · 0.85
check_all_allocatedFunction · 0.85
check_no_overlapFunction · 0.85
allocated_totalMethod · 0.80

Tested by

no test coverage detected