Skip to content

Commit 3b10875

Browse files
authored
Merge pull request #45 from jpgaribotti/QVAC-6569
QVAC-6569: Redirected performance logging to GGML_LOG
2 parents e976127 + 8a4a22a commit 3b10875

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ggml/src/ggml-vulkan/ggml-vulkan.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,14 +1249,15 @@ class vk_perf_logger {
12491249
if (timings.empty()) {
12501250
return;
12511251
}
1252+
std::stringstream ss;
12521253
uint64_t total_all_op_times = 0;
1253-
std::cerr << "----------------\nVulkan Timings:" << std::endl;
1254+
ss << "----------------\nVulkan Timings:" << std::endl;
12541255
for (const auto & t : timings) {
12551256
uint64_t total_op_times = 0;
12561257
for (const auto & time : t.second) {
12571258
total_op_times += time;
12581259
}
1259-
std::cerr << t.first << ": " << t.second.size() << " x " << (total_op_times / t.second.size() / 1000.0)
1260+
ss << t.first << ": " << t.second.size() << " x " << (total_op_times / t.second.size() / 1000.0)
12601261
<< " us";
12611262

12621263
// If we have as many flops entries as timing entries for the op, then compute and log the flops/S.
@@ -1266,21 +1267,22 @@ class vk_perf_logger {
12661267
for (const auto & elem : it->second) {
12671268
total_op_flops += elem;
12681269
}
1269-
std::cerr << " ("
1270+
ss << " ("
12701271
<< (double(total_op_flops) / (1000.0 * 1000.0 * 1000.0)) /
12711272
(double(total_op_times) / (1000.0 * 1000.0 * 1000.0))
12721273
<< " GFLOPS/s)";
12731274
}
12741275

12751276
total_all_op_times += total_op_times;
12761277

1277-
std::cerr << std::endl;
1278+
ss << std::endl;
12781279
}
12791280

12801281
if (timings.size() > 0) {
1281-
std::cerr << "Total time: " << total_all_op_times / 1000.0 << " us." << std::endl;
1282+
ss << "Total time: " << total_all_op_times / 1000.0 << " us." << std::endl;
12821283
}
1283-
1284+
auto ssStr = ss.str();
1285+
GGML_LOG_DEBUG("%s", ssStr.c_str());
12841286
timings.clear();
12851287
flops.clear();
12861288
}

0 commit comments

Comments
 (0)