diff --git a/llvm/projects/hpvm-tensor-rt/autotuner/tuner_driver_src/buildRtConfig.py b/llvm/projects/hpvm-tensor-rt/autotuner/tuner_driver_src/buildRtConfig.py index 4e6239e485081c70e39516cf8d0b5594db8778b2..26e139bd34ef59b1672419a40203e36d324b8a64 100644 --- a/llvm/projects/hpvm-tensor-rt/autotuner/tuner_driver_src/buildRtConfig.py +++ b/llvm/projects/hpvm-tensor-rt/autotuner/tuner_driver_src/buildRtConfig.py @@ -371,8 +371,11 @@ def adjustDevTimeLoss(loss): if loss < 0.3: loss += 0.4 else: - loss = loss * 1.4 + loss = loss * 1.33 # 33% extra error for unseen data + if loss < 0.0: + loss = 0.1 + return loss diff --git a/llvm/projects/hpvm-tensor-rt/autotuner/tuner_driver_src/run_devtime_tuner.py b/llvm/projects/hpvm-tensor-rt/autotuner/tuner_driver_src/run_devtime_tuner.py index 1390b1eb1ac3ecb24f4d6f2552546723fd6ebd54..646fa8d366cddd43392747e5c42469260966000a 100644 --- a/llvm/projects/hpvm-tensor-rt/autotuner/tuner_driver_src/run_devtime_tuner.py +++ b/llvm/projects/hpvm-tensor-rt/autotuner/tuner_driver_src/run_devtime_tuner.py @@ -4,6 +4,7 @@ import os import sys import subprocess import shutil +import time from benchmarks import batch_id import utils import global_paths @@ -17,7 +18,7 @@ class DevTimeTuner: def __init__(self, Bench): - self.autotuner_runs = 20 + self.autotuner_runs = 300 self.binary_path = Bench.promise_binary self.num_layers = Bench.num_layers self.gold_accuracy = Bench.promise_accuracy @@ -27,7 +28,8 @@ class DevTimeTuner: self.result_dir = global_paths.tensorRT_dir + "/" + Bench.base_dir + "/loss_123/" + batch_id + "/dev_tuner/" # NOTE: maintains overall autotuning iterations completed - across multiple devtuner invocations self.iterations_completed = 0 - + # Start time for timing autotuner runs + self.start_time = 0 def invokeDevTunerScript(self, accuracy_slack, autotuner_runs): @@ -145,17 +147,39 @@ class DevTimeTuner: - - def setBaselineAccuracy(self): self.gold_accuracy = utils.getBaselineAccuracy(self.binary_path, self.num_layers) print ("NOTE: Baseline Accuracy = ", self.gold_accuracy, "\n\n") + + + def startTimer(self): + self.start_time = time.time() + print ("\n\n ---Starting DevTuner Timer ----- \n\n") + + + + def endTimer(self): + end_time = time.time() + total_tuning_time = end_time - self.start_time + time_hrs = total_tuning_time * 1.0 / (60 * 60) + print ("\n\n --- Time In Hours = ", time_hrs, " \n\n") + + time_file_path = self.result_dir + "tuning_time.txt" + + f = open(time_file_path, "w+") + f.write("time_hrs = " + str(time_hrs) + "\n") + f.close() + + + + def runDevTuner(self): - self.checkExistingDir() + #self.checkExistingDir() + self.startTimer() self.setBaselineAccuracy() @@ -170,5 +194,6 @@ class DevTimeTuner: # NOTE: dumping files for checking experimental parameters for each batch self.dumpReferenceFiles() - - + + + self.endTimer()