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

Function ggml_tallocr_new

ggml-alloc.c:239–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);
241
242 ggml_tallocr_t alloc = (ggml_tallocr_t)malloc(sizeof(struct ggml_tallocr));
243
244 *alloc = (struct ggml_tallocr) {
245 /*.buffer = */ buffer,
246 /*.buffer_owned = */ true,
247 /*.base = */ ggml_backend_buffer_get_base(buffer),
248 /*.alignment = */ alignment,
249 /*.n_free_blocks = */ 0,
250 /*.free_blocks = */ {{0}},
251 /*.max_size = */ 0,
252 /*.measure = */ false,
253#ifdef GGML_ALLOCATOR_DEBUG
254 /*.allocated_tensors = */ {0},
255#endif
256 };
257
258 ggml_tallocr_reset(alloc);
259
260 return alloc;
261}
262
263ggml_tallocr_t ggml_tallocr_new_measure(size_t alignment) {
264 ggml_tallocr_t alloc = ggml_tallocr_new((void *)0x1000, SIZE_MAX/2, alignment);

Callers 2

ggml_tallocr_new_measureFunction · 0.70
ggml_allocr_newFunction · 0.70

Calls 3

ggml_tallocr_resetFunction · 0.85

Tested by

no test coverage detected