From 3aec8b5493c0ca6c272dacbc305f761aabf2373e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Pietil=C3=A4?= Date: Mon, 20 Oct 2025 08:04:59 +0000 Subject: [PATCH] Improve profiler output. --- ...e_profile_grouped_conv_bwd_weight_impl.hpp | 36 ++++++++++++++----- .../profile_grouped_conv_bwd_weight_impl.hpp | 30 ++++++++++++++-- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/profiler/ck_tile/include/tile_profile_grouped_conv_bwd_weight_impl.hpp b/profiler/ck_tile/include/tile_profile_grouped_conv_bwd_weight_impl.hpp index a4316bfa3d..7906007369 100644 --- a/profiler/ck_tile/include/tile_profile_grouped_conv_bwd_weight_impl.hpp +++ b/profiler/ck_tile/include/tile_profile_grouped_conv_bwd_weight_impl.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "ck_tile/host.hpp" #include "ck_tile/host/convolution_parameter.hpp" @@ -257,14 +258,33 @@ bool profile_grouped_conv_bwd_weight_impl(int do_verification, } } - std::cout << "\n********************************" - << "\nBest configuration parameters:" - << "\n********************************" - << "\nname: " << best_op_name - << "\navg_time: " << best_avg_time << "\ntflops: " << best_tflops - << "\nGB/s: " << best_gb_per_sec - << "\nSplitK: " << best_split_k - << std::endl; + std::stringstream ss; + ss << "\n********************************" + << "\nCK Tile best configuration parameters:" + << "\n********************************" + << "\nname: " << best_op_name + << "\navg_time: " << best_avg_time << "\ntflops: " << best_tflops + << "\nGB/s: " << best_gb_per_sec + << "\nSplitK: " << best_split_k + << std::endl; + + std::cout << ss.str(); + + const char* log_file = std::getenv("CK_TILE_PROFILER_LOG_FILE"); + if(log_file != nullptr) + { + std::ofstream out(log_file, std::ios::app); + if(out.is_open()) + { + std::stringstream out_ss; + out_ss << "CK Tile best configuration:" << std::endl + << "name: " << best_op_name << std::endl + << "avg_time: " << best_avg_time << std::endl + << "SplitK: " << best_split_k << std::endl; + out << out_ss.str(); + out.close(); + } + } if(instance_index != -1) { diff --git a/profiler/include/profiler/profile_grouped_conv_bwd_weight_impl.hpp b/profiler/include/profiler/profile_grouped_conv_bwd_weight_impl.hpp index 6654275fd0..4dc0f7115e 100644 --- a/profiler/include/profiler/profile_grouped_conv_bwd_weight_impl.hpp +++ b/profiler/include/profiler/profile_grouped_conv_bwd_weight_impl.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "ck/ck.hpp" #include "ck/tensor_operation/gpu/device/tensor_layout.hpp" @@ -330,9 +331,32 @@ bool profile_grouped_conv_bwd_weight_impl(int do_verification, } } - std::cout << "Best configuration parameters:" << "\nname: " << best_op_name - << "\navg_time: " << best_avg_time << "\ntflops: " << best_tflops - << "\nGB/s: " << best_gb_per_sec << ", SplitK " << best_split_k << std::endl; + std::stringstream ss; + ss << "\n********************************" + << "\nCK best configuration parameters:" + << "\n********************************" + << "\nname: " << best_op_name + << "\navg_time: " << best_avg_time << "\ntflops: " << best_tflops + << "\nGB/s: " << best_gb_per_sec + << "\nSplitK: " << best_split_k + << std::endl; + std::cout << ss.str(); + + const char* log_file = std::getenv("CK_PROFILER_LOG_FILE"); + if(log_file != nullptr) + { + std::ofstream out(log_file, std::ios::app); + if(out.is_open()) + { + std::stringstream out_ss; + out_ss << "CK best configuration:" << std::endl + << "name: " << best_op_name << std::endl + << "avg_time: " << best_avg_time << std::endl + << "SplitK: " << best_split_k << std::endl; + out << out_ss.str(); + out.close(); + } + } if(instance_index != -1) {