From 4c4ea2ff19ac35c460f1710408d69a26f280eb21 Mon Sep 17 00:00:00 2001 From: Maria Kotsifakou <kotsifa2@illinois.edu> Date: Thu, 7 May 2020 15:01:20 -0500 Subject: [PATCH] Profiler (within HPVM RT controller) infrastructure can get and print end-of-iteration frequency. Reading frequency from board functionality to be done later. --- .../include/hpvm-rt-controller.h | 5 +++++ .../tensor_runtime/src/hpvm-rt-controller.cpp | 22 +++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/hpvm-rt-controller.h b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/hpvm-rt-controller.h index 2bb43fdde2..669de46032 100644 --- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/hpvm-rt-controller.h +++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/include/hpvm-rt-controller.h @@ -67,6 +67,9 @@ class ProfileInfo { std::vector< double > config_time_info; std::vector< double > config_energy_info; + // Vector, where frequency information at the end of each iteration is stored + std::vector< double > frequency_info; + bool in_iteration; // Set to the path of the file where results will be written by printToFile. @@ -79,6 +82,8 @@ class ProfileInfo { void start_iteration(); + double getIterationEndFrequency(); + public: void end_iteration(); diff --git a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp index 6574b5daa9..70f605f0ad 100644 --- a/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp +++ b/llvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp @@ -59,11 +59,17 @@ void ProfileInfo::end_iteration() { control_energy_info.push_back(energy_control_current_iteration); config_time_info.push_back(time_config_current_iteration); config_energy_info.push_back(energy_config_current_iteration); + frequency_info.push_back(getIterationEndFrequency()); // Note end of iteration in_iteration = false; } +double ProfileInfo::getIterationEndFrequency() { + return 0.0; + //TODO: if file exists read it else return 0.0 +} + void ProfileInfo::addToCurrentIterationComputeTime(const char *s, double t) { start_iteration(); time_compute_current_iteration += t; @@ -131,7 +137,8 @@ void ProfileInfo::printToFile() { (control_energy_info.size() == iterations) && (config_time_info.size() == iterations) && (config_energy_info.size() == iterations) && - "time_info and energy_info size: \ + (frequency_info.size() == iterations) && + "time_info, energy_info, frequency_info size: \ iteration number does not match."); for (unsigned i = 0; i < tensor_time_info.size(); i++) { @@ -151,12 +158,13 @@ void ProfileInfo::printToFile() { << tensor_energy_info[i][j].second << "\n"; } - s_out << "\nIteration Compute Time : " << compute_time_info[i] << "\n"; - s_out << "Iteration Compute Energy: " << compute_energy_info[i] << "\n"; - s_out << "Iteration Control Time : " << control_time_info[i] << "\n"; - s_out << "Iteration Control Energy: " << control_energy_info[i] << "\n"; - s_out << "Iteration Config Time : " << config_time_info[i] << "\n"; - s_out << "Iteration Control Energy: " << config_energy_info[i] << "\n\n\n"; + s_out << "\nIteration Compute Time : " << compute_time_info[i] << "\n"; + s_out << "Iteration Compute Energy : " << compute_energy_info[i] << "\n"; + s_out << "Iteration Control Time : " << control_time_info[i] << "\n"; + s_out << "Iteration Control Energy : " << control_energy_info[i] << "\n"; + s_out << "Iteration Config Time : " << config_time_info[i] << "\n"; + s_out << "Iteration Config Energy : " << config_energy_info[i] << "\n"; + s_out << "Iteration End Frequency : " << frequency_info[i] << "\n\n\n"; } s_out << "\n\nTotal Compute Time : " << time_compute << "\n"; s_out << "Total Compute Energy: " << energy_compute << "\n"; -- GitLab