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

Function init_view

ggml-alloc.c:449–467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449static void init_view(ggml_gallocr_t galloc, struct ggml_tensor * view, bool update_backend) {
450 ggml_tallocr_t alloc = node_tallocr(galloc, view);
451
452 //printf("init_view: %s from src %s\n", view->name, view->view_src->name);
453 GGML_ASSERT(view->view_src != NULL && view->view_src->data != NULL);
454 if (update_backend) {
455 view->backend = view->view_src->backend;
456 }
457 view->buffer = view->view_src->buffer;
458 view->data = (char *)view->view_src->data + view->view_offs;
459
460 // FIXME: the view should be initialized by the owning buffer, but currently this breaks the CUDA backend
461 // due to the ggml_tensor_extra_gpu ring buffer overwriting the KV cache extras
462 assert(ggml_tallocr_is_measure(alloc) || !view->buffer || view->buffer->backend == alloc->buffer->backend);
463
464 if (!alloc->measure) {
465 ggml_backend_buffer_init_tensor(alloc->buffer, view);
466 }
467}
468
469static void allocate_node(ggml_gallocr_t galloc, struct ggml_tensor * node) {
470 ggml_tallocr_t alloc = node_tallocr(galloc, node);

Callers 2

allocate_nodeFunction · 0.85

Calls 3

node_tallocrFunction · 0.85
ggml_tallocr_is_measureFunction · 0.85

Tested by

no test coverage detected