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

Function ggml_tallocr_reset

ggml-alloc.c:227–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225}
226
227void ggml_tallocr_reset(ggml_tallocr_t alloc) {
228 alloc->n_free_blocks = 1;
229 size_t align_offset = aligned_offset(alloc->base, 0, alloc->alignment);
230 alloc->free_blocks[0].addr = (char *)alloc->base + align_offset;
231
232 if (alloc->measure) {
233 alloc->free_blocks[0].size = SIZE_MAX/2; // restrict maximum size of a measure allocator to half size_t max to avoid overflows
234 } else {
235 alloc->free_blocks[0].size = ggml_backend_buffer_get_size(alloc->buffer) - align_offset;
236 }
237}
238
239ggml_tallocr_t ggml_tallocr_new(void * data, size_t size, size_t alignment) {
240 struct ggml_backend_buffer * buffer = ggml_backend_cpu_buffer_from_ptr(NULL, data, size);

Callers 5

ggml_tallocr_newFunction · 0.85
ggml_allocr_resetFunction · 0.85
sched_resetFunction · 0.85

Calls 2

aligned_offsetFunction · 0.70

Tested by

no test coverage detected