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

Function ggml_graph_print

ggml.c:17986–18027  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17984}
17985
17986void ggml_graph_print(const struct ggml_cgraph * cgraph) {
17987 int64_t perf_total_per_op_us[GGML_OP_COUNT] = {0};
17988
17989 GGML_PRINT("=== GRAPH ===\n");
17990
17991 GGML_PRINT("n_nodes = %d\n", cgraph->n_nodes);
17992 for (int i = 0; i < cgraph->n_nodes; i++) {
17993 struct ggml_tensor * node = cgraph->nodes[i];
17994
17995 perf_total_per_op_us[node->op] += MAX(1, node->perf_time_us);
17996
17997 GGML_PRINT(" - %3d: [ %5" PRId64 ", %5" PRId64 ", %5" PRId64 "] %16s %48s %s (%3d) cpu = %7.3f / %7.3f ms, wall = %7.3f / %7.3f ms\n",
17998 i,
17999 node->ne[0], node->ne[1], node->ne[2],
18000 ggml_op_name(node->op), ggml_get_name(node), node->is_param ? "x" : node->grad ? "g" : " ", node->perf_runs,
18001 (double) node->perf_cycles / (double) ggml_cycles_per_ms(),
18002 (double) node->perf_cycles / (double) ggml_cycles_per_ms() / (double) node->perf_runs,
18003 (double) node->perf_time_us / 1000.0,
18004 (double) node->perf_time_us / 1000.0 / node->perf_runs);
18005 }
18006
18007 GGML_PRINT("n_leafs = %d\n", cgraph->n_leafs);
18008 for (int i = 0; i < cgraph->n_leafs; i++) {
18009 struct ggml_tensor * node = cgraph->leafs[i];
18010
18011 GGML_PRINT(" - %3d: [ %5" PRId64 ", %5" PRId64 "] %8s %16s\n",
18012 i,
18013 node->ne[0], node->ne[1],
18014 ggml_op_name(node->op),
18015 ggml_get_name(node));
18016 }
18017
18018 for (int i = 0; i < GGML_OP_COUNT; i++) {
18019 if (perf_total_per_op_us[i] == 0) {
18020 continue;
18021 }
18022
18023 GGML_PRINT("perf_total_per_op_us[%16s] = %7.3f ms\n", ggml_op_name(i), (double) perf_total_per_op_us[i] / 1000.0);
18024 }
18025
18026 GGML_PRINT("========================================\n");
18027}
18028
18029// check if node is part of the graph
18030static bool ggml_graph_find(const struct ggml_cgraph * cgraph, const struct ggml_tensor * node) {

Callers 2

ggml_opt_resume_gFunction · 0.70
llama_decode_internalFunction · 0.70

Calls 3

ggml_op_nameFunction · 0.70
ggml_get_nameFunction · 0.70
ggml_cycles_per_msFunction · 0.70

Tested by

no test coverage detected