From 1b09b76c885659a57575e1ac8b9b262b203babde Mon Sep 17 00:00:00 2001
From: Hashim Sharif <hsharif3@miranda.cs.illinois.edu>
Date: Mon, 5 Apr 2021 21:41:53 -0500
Subject: [PATCH] removing more dead code from RT control - removing fake
 frequency routine deps

---
 .../tensor_runtime/src/hpvm-rt-controller.cpp | 72 ++-----------------
 1 file changed, 7 insertions(+), 65 deletions(-)

diff --git a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
index 3f41cd15df..dc3493a87b 100644
--- a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
+++ b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
@@ -1286,56 +1286,6 @@ extern "C" void llvm_hpvm_invokeRtControl_BASE(void *result, const char *str,
 }
 
 
-extern "C" void llvm_hpvm_invokeRtControl_ADJUST(void *result, const char *str,
-                                                 int start, int end) {
-
-  uint32_t *labels_cached = hpvm_rt_readLabelsBatch_cached(str, start, end);
-  hpvm_rt_computeAccuracy3(labels_cached, result);
-
-  // Read stats for iteration that was just completed
-  double current_iteration_energy = RC->getCurrentIterationComputeEnergy();
-  RC->readIterationFrequency();
-
-  RC->resume_profiler();
-  double current_iteration_time = RC->getCurrentIterationComputeTime();
-  double target_speedup;
-  if (RC->getLastFrequency() == RC->getIterationFrequency()) {
-    target_speedup = RC->getLastSpeedup();
-  } else {
-    double baseline_time = RC->getBaselineTime();
-    // Relative to current configuration
-    target_speedup = current_iteration_time / baseline_time;
-    // Adjust to baseline
-    target_speedup *= RC->getCurrentConfigurationSpeedup();
-    RC->setLastFrequency(RC->getIterationFrequency());
-    RC->setLastSpeedup(target_speedup);
-  }
-  RC->findTargetConfiguration(target_speedup, SPEEDUP);
-  RC->pause_profiler();
-
-  std::pair<double, double> pinfo = RC->get_time_energy();
-  RC->reset_profiler();
-  RC->addToCurrentIterationControlTime(pinfo.first);
-  RC->addToCurrentIterationControlEnergy(pinfo.second);
-
-  //*                                                                        *
-  //*Needed for the frequency variation experiment - not part of the control *
-  RC->resume_profiler();
-  RC->updateFrequency();
-  RC->pause_profiler();
-
-  std::pair<double, double> pinfo2 = RC->get_time_energy();
-  RC->reset_profiler();
-  RC->addToCurrentIterationConfigTime(pinfo2.first);
-  RC->addToCurrentIterationConfigEnergy(pinfo2.second);
-
-  INFO("current iteration time = %f, current iteration energy = %f\n",
-       current_iteration_time, current_iteration_energy);
-  INFO("target speedup = %lf\n\n", target_speedup);
-
-  // Note the end of iteration
-  RC->end_iteration();
-}
 
 extern "C" void llvm_hpvm_invokeRtControl_ADJUST_PR(void *result,
                                                     const char *str,
@@ -1347,22 +1297,17 @@ extern "C" void llvm_hpvm_invokeRtControl_ADJUST_PR(void *result,
 
   // Read stats for iteration that was just completed
   double current_iteration_energy = RC->getCurrentIterationComputeEnergy();
-  RC->readIterationFrequency();
 
   RC->resume_profiler();
   double current_iteration_time = RC->getCurrentIterationComputeTime();
   double target_speedup;
-  if (RC->getLastFrequency() == RC->getIterationFrequency()) {
-    target_speedup = RC->getLastSpeedup();
-  } else {
-    double baseline_time = RC->getBaselineTime();
-    // Relative to current configuration
-    target_speedup = current_iteration_time / baseline_time;
-    // Adjust to baseline
-    target_speedup *= RC->getCurrentConfigurationSpeedup();
-    RC->setLastFrequency(RC->getIterationFrequency());
-    RC->setLastSpeedup(target_speedup);
-  }
+
+  double baseline_time = RC->getBaselineTime();
+  // Relative to current configuration
+  target_speedup = current_iteration_time / baseline_time;
+  // Adjust to baseline
+  target_speedup *= RC->getCurrentConfigurationSpeedup();
+  
   RC->findTargetConfiguration(target_speedup, SPEEDUP);
   RC->adjustTargetConfiguration(target_speedup);
   RC->pause_profiler();
@@ -1372,10 +1317,7 @@ extern "C" void llvm_hpvm_invokeRtControl_ADJUST_PR(void *result,
   RC->addToCurrentIterationControlTime(pinfo.first);
   RC->addToCurrentIterationControlEnergy(pinfo.second);
 
-  //*                                                                        *
-  //*Needed for the frequency variation experiment - not part of the control *
   RC->resume_profiler();
-  RC->updateFrequency();
   RC->pause_profiler();
 
   std::pair<double, double> pinfo2 = RC->get_time_energy();
-- 
GitLab