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

Function ggml_build_forward_impl

ggml.c:16258–16276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16256}
16257
16258static void ggml_build_forward_impl(struct ggml_cgraph * cgraph, struct ggml_tensor * tensor, bool expand) {
16259 if (!expand) {
16260 // TODO: this branch isn't accessible anymore, maybe move this to ggml_build_forward_expand
16261 ggml_graph_clear(cgraph);
16262 }
16263
16264 const int n0 = cgraph->n_nodes;
16265 UNUSED(n0);
16266
16267 ggml_visit_parents(cgraph, tensor);
16268
16269 const int n_new = cgraph->n_nodes - n0;
16270 GGML_PRINT_DEBUG("%s: visited %d new nodes\n", __func__, n_new);
16271
16272 if (n_new > 0) {
16273 // the last added node should always be starting point
16274 GGML_ASSERT(cgraph->nodes[cgraph->n_nodes - 1] == tensor);
16275 }
16276}
16277
16278void ggml_build_forward_expand(struct ggml_cgraph * cgraph, struct ggml_tensor * tensor) {
16279 ggml_build_forward_impl(cgraph, tensor, true);

Callers 1

Calls 2

ggml_graph_clearFunction · 0.70
ggml_visit_parentsFunction · 0.70

Tested by

no test coverage detected