mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-08-23 07:01:24 +02:00
vulkan: perf_logger improvements (llama/15246)
* vulkan: perf_logger improvements - Account for batch dimension in flops calculation. - Fix how "_VEC" is detected for mat_mul_id. - Fix "n" dimension for mat_mul_id (in case of broadcasting). - Include a->type in name. * use <=mul_mat_vec_max_cols rather than ==1
This commit is contained in:
committed by
Georgi Gerganov
parent
4a6cf896ad
commit
1d8b21caa0
@@ -1112,16 +1112,22 @@ class vk_perf_logger {
|
|||||||
}
|
}
|
||||||
if (node->op == GGML_OP_MUL_MAT || node->op == GGML_OP_MUL_MAT_ID) {
|
if (node->op == GGML_OP_MUL_MAT || node->op == GGML_OP_MUL_MAT_ID) {
|
||||||
const uint64_t m = node->src[0]->ne[1];
|
const uint64_t m = node->src[0]->ne[1];
|
||||||
const uint64_t n = node->src[1]->ne[1];
|
const uint64_t n = node->ne[1];
|
||||||
const uint64_t k = node->src[1]->ne[0];
|
const uint64_t k = node->src[1]->ne[0];
|
||||||
|
const uint64_t batch = node->src[1]->ne[2] * node->src[1]->ne[3];
|
||||||
std::string name = ggml_op_name(node->op);
|
std::string name = ggml_op_name(node->op);
|
||||||
if (n == 1) {
|
if ((node->op == GGML_OP_MUL_MAT && n <= mul_mat_vec_max_cols) ||
|
||||||
name += "_VEC m=" + std::to_string(m) + " k=" + std::to_string(k);
|
(node->op == GGML_OP_MUL_MAT_ID && node->src[2]->ne[1] == 1)) {
|
||||||
} else {
|
name += "_VEC";
|
||||||
|
}
|
||||||
|
name += " ";
|
||||||
|
name += ggml_type_name(node->src[0]->type);
|
||||||
name += " m=" + std::to_string(m) + " n=" + std::to_string(n) + " k=" + std::to_string(k);
|
name += " m=" + std::to_string(m) + " n=" + std::to_string(n) + " k=" + std::to_string(k);
|
||||||
|
if (batch > 1) {
|
||||||
|
name += " batch=" + std::to_string(batch);
|
||||||
}
|
}
|
||||||
timings[name].push_back(time);
|
timings[name].push_back(time);
|
||||||
flops[name].push_back(m * n * (k + (k - 1)));
|
flops[name].push_back(m * n * (k + (k - 1)) * batch);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (node->op == GGML_OP_CONV_2D) {
|
if (node->op == GGML_OP_CONV_2D) {
|
||||||
|
Reference in New Issue
Block a user