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

Function ggml_backend_cpu_alloc_buffer

ggml-backend.c:263–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261static const size_t TENSOR_ALIGNMENT = 64; // should be enough for AVX 512
262
263static ggml_backend_buffer_t ggml_backend_cpu_alloc_buffer(ggml_backend_t backend, size_t size) {
264 size += TENSOR_ALIGNMENT; // malloc may return an address that is not aligned
265 void * data = malloc(size); // TODO: maybe use GGML_ALIGNED_MALLOC?
266
267 GGML_ASSERT(data != NULL && "failed to allocate buffer");
268
269 return ggml_backend_buffer_init(backend, cpu_backend_buffer_i, data, size);
270}
271
272static size_t ggml_backend_cpu_get_alignment(ggml_backend_t backend) {
273 return TENSOR_ALIGNMENT;

Callers

nothing calls this directly

Calls 1

ggml_backend_buffer_initFunction · 0.70

Tested by

no test coverage detected