print graph

This commit is contained in:
luffy06 2024-01-10 22:36:50 +08:00
parent 5ba6593252
commit 76e1fd0f45
2 changed files with 26 additions and 1 deletions

2
ggml.h
View file

@ -515,7 +515,7 @@ extern "C" {
struct ggml_backend_buffer * buffer;
int64_t ne[GGML_MAX_DIMS]; // number of elements, [batch size, , seq len, hidden dim]
int64_t ne[GGML_MAX_DIMS]; // number of elements, [batch size, heads, seq len, hidden dim]
size_t nb[GGML_MAX_DIMS]; // stride in bytes:
// nb[0] = ggml_type_size(type)
// nb[1] = nb[0] * (ne[0] / ggml_blck_size(type)) + padding

View file

@ -4514,6 +4514,31 @@ struct llm_build_context {
LLAMA_LOG_INFO(")\n");
}
}
LLAMA_LOG_INFO("%s: \tSource tensor [", __func__);
switch (t->op) {
case GGML_OP_VIEW:
case GGML_OP_RMS_NORM:
case GGML_OP_RESHAPE:
case GGML_OP_CPY:
case GGML_OP_TRANSPOSE:
case GGML_OP_PERMUTE:
case GGML_OP_CONT:
case GGML_OP_UNARY:
LLAMA_LOG_INFO("%s", t->src[0]->name);
break;
case GGML_OP_ROPE:
case GGML_OP_GET_ROWS:
case GGML_OP_MUL:
case GGML_OP_MUL_MAT:
case GGML_OP_SOFT_MAX:
case GGML_OP_ADD:
LLAMA_LOG_INFO("%s, %s", t->src[0]->name, t->src[1]->name);
break;
default:
LLAMA_LOG_INFO("Unknown OP [%s]\n", ggml_op_string(t->op));
exit(-1);
}
LLAMA_LOG_INFO("]\n");
}
exit(-1);