diff --git a/llvm/projects/hpvm-tensor-rt/bin/tuner_src/benchmarks.py b/llvm/projects/hpvm-tensor-rt/bin/tuner_src/benchmarks.py index eeca0ed8ed8ed407b9c84592b22820857678b311..9281773acf6f64b0a0d6b7b4a830b54dfaac6c54 100644 --- a/llvm/projects/hpvm-tensor-rt/bin/tuner_src/benchmarks.py +++ b/llvm/projects/hpvm-tensor-rt/bin/tuner_src/benchmarks.py @@ -7,9 +7,15 @@ # Batch 12: Error Sens: 10, 25, 35, for Loss1, 2, 3, respectively, Min: P3. 1000 Runs for All # Batch 13: No Error Sens: Equal Runs (1000) for all. Min: P1 # Batch 14: Reruning Batch12 with bugFix! -# Batch 16: MAJOR CHANGE: 3 different skip levels for each Loss1,Loss2,Loss3 -# Batch 17: Baseline with 3000 runs. Compare with Batch16 +# Batch 15: MAJOR CHANGE: 3 different skip levels for each Loss1,Loss2,Loss3 +# Batch 18: Batch13 (Basline) + ParetoCurve (1500 Runs) - BUGGY IGNORE!!! + +# Batch 19: (Basline) + ParetoCurve + 2 runs in Tuning Phase (1500 Runs) +# Batch 20: 3-Skip levels + + 2 runs + 1500 Runs + EnergyBandSize now % of Max (Compare against Batch19 + + +batch_id = "batch200" class Benchmark: def __init__(self): @@ -46,19 +52,20 @@ Alexnet1.skip_layers = 0 Alexnet1.skip_layer_str = "5_0" Alexnet1.base_dir = "../build_tuner/tuner_results/alexnet_cifar10/" -Alexnet1.result_dir_1 = "../build_tuner/tuner_results/alexnet_cifar10/loss_1/batch17" -Alexnet1.result_dir_2 = "../build_tuner/tuner_results/alexnet_cifar10/loss_2/batch17" -Alexnet1.result_dir_3 = "../build_tuner/tuner_results/alexnet_cifar10/loss_3/batch17" +Alexnet1.result_dir_1 = "../build_tuner/tuner_results/alexnet_cifar10/loss_1/" + batch_id +Alexnet1.result_dir_2 = "../build_tuner/tuner_results/alexnet_cifar10/loss_2/" + batch_id +Alexnet1.result_dir_3 = "../build_tuner/tuner_results/alexnet_cifar10/loss_3/" + batch_id Alexnet1.tensor_desc_file = "tuner_results/alexnet_cifar10/alexnet_tensors.txt" Alexnet1.layer_file = "tuner_results/alexnet_cifar10/alexnet_layers.txt" Alexnet1.cost_file = "../build_tuner/tuner_results/alexnet_cifar10/op_cost.txt" +Alexnet1.layer_knobs = "../opentuner/data/alexnet/knobs.txt" #Alexnet1.loss1_result_file = "tuner_results/alexnet2_cifar10/alexnet_layers.txt" Alexnet1.loss1_result_file = "tuner_results/alexnet_cifar10/loss_1/promise_tuned_confs/promise_confs.txt" Alexnet1.loss2_result_file = "tuner_results/alexnet_cifar10/loss_2/promise_tuned_confs/promise_confs.txt" -Alexnet1.autotuner_runs = 1000 +Alexnet1.autotuner_runs = 1500 Alexnet1.tuner_accuracy = 79.9 Alexnet1.promise_accuracy = 79.9 Alexnet1.validation_accuracy = 79.19 @@ -79,15 +86,16 @@ Alexnet2.start_promise_range = 1 Alexnet2.skip_layer_str = "6_1_0" Alexnet2.base_dir = "../build_tuner/tuner_results/alexnet2_cifar10/" -Alexnet2.result_dir_1 = "../build_tuner/tuner_results/alexnet2_cifar10/loss_1/batch17" -Alexnet2.result_dir_2 = "../build_tuner/tuner_results/alexnet2_cifar10/loss_2/batch17" -Alexnet2.result_dir_3 = "../build_tuner/tuner_results/alexnet2_cifar10/loss_3/batch17" +Alexnet2.result_dir_1 = "../build_tuner/tuner_results/alexnet2_cifar10/loss_1/" + batch_id +Alexnet2.result_dir_2 = "../build_tuner/tuner_results/alexnet2_cifar10/loss_2/" + batch_id +Alexnet2.result_dir_3 = "../build_tuner/tuner_results/alexnet2_cifar10/loss_3/" + batch_id Alexnet2.tensor_desc_file = "tuner_results/alexnet2_cifar10/alexnet2_tensors.txt" Alexnet2.layer_file = "tuner_results/alexnet2_cifar10/alexnet2_layers.txt" Alexnet2.cost_file = "../build_tuner/tuner_results/alexnet2_cifar10/op_cost.txt" +Alexnet2.layer_knobs = "../opentuner/data/alexnet2/knobs.txt" #Alexnet2.loss1_result_file = "tuner_results/alexnet2_cifar10/loss_1/promise_tuned_confs/promise_confs.txt" #Alexnet2.loss2_result_file = "tuner_results/alexnet2_cifar10/loss_2/promise_tuned_confs/promise_confs.txt" -Alexnet2.autotuner_runs = 1000 +Alexnet2.autotuner_runs = 1500 Alexnet2.tuner_accuracy = 84.19 Alexnet2.promise_accuracy = 84.19 Alexnet2.validation_accuracy = 85.15 @@ -109,18 +117,19 @@ Alexnet3.start_promise_range = 1 Alexnet3.skip_layer_str = "14_3_4_1_6" Alexnet3.base_dir = "../build_tuner/tuner_results/vgg16_cifar10/" -Alexnet3.result_dir_1 = "../build_tuner/tuner_results/vgg16_cifar10/loss_1/batch17" -Alexnet3.result_dir_2 = "../build_tuner/tuner_results/vgg16_cifar10/loss_2/batch17" -Alexnet3.result_dir_3 = "../build_tuner/tuner_results/vgg16_cifar10/loss_3/batch17" +Alexnet3.result_dir_1 = "../build_tuner/tuner_results/vgg16_cifar10/loss_1/" + batch_id +Alexnet3.result_dir_2 = "../build_tuner/tuner_results/vgg16_cifar10/loss_2/" + batch_id +Alexnet3.result_dir_3 = "../build_tuner/tuner_results/vgg16_cifar10/loss_3/" + batch_id Alexnet3.tensor_desc_file = "tuner_results/vgg16_cifar10/vgg16_tensors.txt" Alexnet3.layer_file = "tuner_results/vgg16_cifar10/vgg16_layers.txt" Alexnet3.cost_file = "../build_tuner/tuner_results/vgg16_cifar10/op_cost.txt" +Alexnet3.layer_knobs = "../opentuner/data/vgg16_cifar10/knobs.txt" Alexnet3.loss1_result_file = "tuner_results/vgg16_cifar10/loss_1/promise_tuned_confs/promise_confs.txt" Alexnet3.loss2_result_file = "tuner_results/vgg16_cifar10/loss_2/promise_tuned_confs/promise_confs.txt" -Alexnet3.autotuner_runs = 1000 +Alexnet3.autotuner_runs = 1500 Alexnet3.tuner_accuracy = 90.19 Alexnet3.promise_accuracy = 90.19 Alexnet3.validation_accuracy = 89.05 @@ -141,17 +150,18 @@ Alexnet4.start_promise_range = 1 #Alexnet4.skip_layer_str = "0" Alexnet4.skip_layer_str = "0_1_2_14_15_17_18_21" Alexnet4.base_dir = "../build_tuner/tuner_results/resnet18_cifar10/" -Alexnet4.result_dir_1 = "../build_tuner/tuner_results/resnet18_cifar10/loss_1/batch17" -Alexnet4.result_dir_2 = "../build_tuner/tuner_results/resnet18_cifar10/loss_2/batch17" -Alexnet4.result_dir_3 = "../build_tuner/tuner_results/resnet18_cifar10/loss_3/batch17" +Alexnet4.result_dir_1 = "../build_tuner/tuner_results/resnet18_cifar10/loss_1/" + batch_id +Alexnet4.result_dir_2 = "../build_tuner/tuner_results/resnet18_cifar10/loss_2/" + batch_id +Alexnet4.result_dir_3 = "../build_tuner/tuner_results/resnet18_cifar10/loss_3/" + batch_id Alexnet4.tensor_desc_file = "tuner_results/resnet18_cifar10/resnet_tensors.txt" -Alexnet4.layer_file = "tuner_results/resnet18_cifar10/resnet18_layers.txt" +Alexnet4.layer_file = "tuner_results/resnet18_cifar10/resnet_layers.txt" Alexnet4.cost_file = "../build_tuner/tuner_results/resnet18_cifar10/op_cost.txt" +Alexnet4.layer_knobs = "../opentuner/data/resnet/knobs.txt" Alexnet4.loss1_result_file = "tuner_results/resnet18_cifar10/loss_1/promise_tuned_confs/promise_confs.txt" Alexnet4.loss2_result_file = "tuner_results/resnet18_cifar10/loss_2/promise_tuned_confs/promise_confs.txt" -Alexnet4.autotuner_runs = 1000 +Alexnet4.autotuner_runs = 1500 Alexnet4.tuner_accuracy = 89.6 Alexnet4.promise_accuracy = 89.59 Alexnet4.validation_accuracy = 89.65 @@ -174,17 +184,18 @@ Alexnet5.start_promise_range = 1 #Alexnet5.skip_layer_str = "0" Alexnet5.skip_layer_str = "0_1_2_3_4" Alexnet5.base_dir = "../build_tuner/tuner_results/vgg16_cifar100/" -Alexnet5.result_dir_1 = "../build_tuner/tuner_results/vgg16_cifar100/loss_1/batch17" -Alexnet5.result_dir_2 = "../build_tuner/tuner_results/vgg16_cifar100/loss_2/batch17" -Alexnet5.result_dir_3 = "../build_tuner/tuner_results/vgg16_cifar100/loss_3/batch17" +Alexnet5.result_dir_1 = "../build_tuner/tuner_results/vgg16_cifar100/loss_1/" + batch_id +Alexnet5.result_dir_2 = "../build_tuner/tuner_results/vgg16_cifar100/loss_2/" + batch_id +Alexnet5.result_dir_3 = "../build_tuner/tuner_results/vgg16_cifar100/loss_3/" + batch_id Alexnet5.tensor_desc_file = "../build_tuner/tuner_results/vgg16_cifar100/vgg16_tensors.txt" Alexnet5.layer_file = "../build_tuner/tuner_results/vgg16_cifar100/vgg16_layers.txt" Alexnet5.cost_file = "../build_tuner/tuner_results/vgg16_cifar100/op_cost.txt" +Alexnet5.layer_knobs = "../opentuner/data/vgg16_cifar100/knobs.txt" Alexnet5.loss1_result_file = "tuner_results/vgg_cifar100/loss_1/promise_tuned_confs/promise_confs.txt" Alexnet5.loss2_result_file = "tuner_results/vgg_cifar100/loss_2/promise_tuned_confs/promise_confs.txt" -Alexnet5.autotuner_runs = 1000 +Alexnet5.autotuner_runs = 1500 Alexnet5.tuner_accuracy = 67.95 Alexnet5.promise_accuracy = 66.8 Alexnet5.validation_accuracy = 68.65 @@ -206,17 +217,18 @@ Alexnet6.start_promise_range = 1 Alexnet6.skip_layer_str = "0" Alexnet6.base_dir = "../build_tuner/tuner_results/lenet_keras/" -Alexnet6.result_dir_1 = "../build_tuner/tuner_results/lenet_keras/loss_1/batch17" -Alexnet6.result_dir_2 = "../build_tuner/tuner_results/lenet_keras/loss_2/batch17" -Alexnet6.result_dir_3 = "../build_tuner/tuner_results/lenet_keras/loss_3/batch17" +Alexnet6.result_dir_1 = "../build_tuner/tuner_results/lenet_keras/loss_1/" + batch_id +Alexnet6.result_dir_2 = "../build_tuner/tuner_results/lenet_keras/loss_2/" + batch_id +Alexnet6.result_dir_3 = "../build_tuner/tuner_results/lenet_keras/loss_3/" + batch_id Alexnet6.tensor_desc_file = "tuner_results/lenet_keras/lenet_tensors.txt" Alexnet6.layer_file = "tuner_results/lenet_keras/lenet_layers.txt" Alexnet6.cost_file = "../build_tuner/tuner_results/lenet_keras/op_cost.txt" +Alexnet6.layer_knobs = "../opentuner/data/lenet/knobs.txt" #Alexnet6.loss1_result_file = "tuner_results/vgg_cifar100/loss_1/promise_tuned_confs/promise_confs.txt" #Alexnet6.loss2_result_file = "tuner_results/vgg_cifar100/loss_2/promise_tuned_confs/promise_confs.txt" -Alexnet6.autotuner_runs = 500 +Alexnet6.autotuner_runs = 900 Alexnet6.tuner_accuracy = 98.9 Alexnet6.promise_accuracy = 98.9 Alexnet6.validation_accuracy = 99 @@ -239,18 +251,19 @@ Alexnet7.start_promise_range = 1 #Alexnet7.skip_layer_str = "0" Alexnet7.skip_layer_str = "1_14_0_6_2" Alexnet7.base_dir = "../build_tuner/tuner_results/mobilenet/" -Alexnet7.result_dir_1 = "../build_tuner/tuner_results/mobilenet/loss_1/batch17" -Alexnet7.result_dir_2 = "../build_tuner/tuner_results/mobilenet/loss_2/batch17" -Alexnet7.result_dir_3 = "../build_tuner/tuner_results/mobilenet/loss_3/batch17" +Alexnet7.result_dir_1 = "../build_tuner/tuner_results/mobilenet/loss_1/" + batch_id +Alexnet7.result_dir_2 = "../build_tuner/tuner_results/mobilenet/loss_2/" + batch_id +Alexnet7.result_dir_3 = "../build_tuner/tuner_results/mobilenet/loss_3/" + batch_id Alexnet7.tensor_desc_file = "tuner_results/mobilenet/mobilenet_ops.txt" Alexnet7.layer_file = "tuner_results/mobilenet/mobilenet_layer_comp.txt" Alexnet7.cost_file = "../build_tuner/tuner_results/mobilenet/op_cost.txt" +Alexnet7.layer_knobs = "../opentuner/data/mobilenet/knobs.txt" #--- Files below needed for VALIDATION experiment Alexnet7.loss1_result_file = "tuner_results/mobilenet/loss_1/batch1/promise_tuner/high_confidence/promise_confs.txt" Alexnet7.loss2_result_file = "tuner_results/mobilenet/loss_2/batch1/promise_tuner/high_confidence/promise_confs.txt" -Alexnet7.autotuner_runs = 1000 +Alexnet7.autotuner_runs = 1500 Alexnet7.tuner_accuracy = 84.8 Alexnet7.promise_accuracy = 84.8 Alexnet7.validation_accuracy = 84.4 @@ -271,18 +284,19 @@ Alexnet8.start_promise_range = 1 #Alexnet8.skip_layer_str = "0" Alexnet8.skip_layer_str = "7_0_1" Alexnet8.base_dir = "../build_tuner/tuner_results/mobilenet_shallow/" -Alexnet8.result_dir_1 = "../build_tuner/tuner_results/mobilenet_shallow/loss_1/batch17" -Alexnet8.result_dir_2 = "../build_tuner/tuner_results/mobilenet_shallow/loss_2/batch17" -Alexnet8.result_dir_3 = "../build_tuner/tuner_results/mobilenet_shallow/loss_3/batch17" +Alexnet8.result_dir_1 = "../build_tuner/tuner_results/mobilenet_shallow/loss_1/" + batch_id +Alexnet8.result_dir_2 = "../build_tuner/tuner_results/mobilenet_shallow/loss_2/" + batch_id +Alexnet8.result_dir_3 = "../build_tuner/tuner_results/mobilenet_shallow/loss_3/" + batch_id Alexnet8.tensor_desc_file = "../build_tuner/tuner_results/mobilenet_shallow/mobilenet_shallow_ops.txt" Alexnet8.layer_file = "../build_tuner/tuner_results/mobilenet_shallow/mobilenet_shallow_layer_comp.txt" Alexnet8.cost_file = "../build_tuner/tuner_results/mobilenet_shallow/op_cost.txt" +Alexnet8.layer_knobs = "../opentuner/data/mobilenet_shallow/knobs.txt" Alexnet8.loss1_result_file = "../build_tuner/tuner_results/mobilenet_shallow/loss_1/batch2/promise_tuner/high_confidence/promise_selected_confs.txt" Alexnet8.loss2_result_file = "../build_tuner/tuner_results/mobilenet_shallow/loss_2/batch2/promise_tuner/high_confidence/promise_selected_confs.txt" -Alexnet8.autotuner_runs = 1000 +Alexnet8.autotuner_runs = 1500 Alexnet8.tuner_accuracy = 87.6 Alexnet8.promise_accuracy = 87.59 Alexnet8.validation_accuracy = 88.5 @@ -291,7 +305,7 @@ bench_tuner_data["mobilenet_shallow"] = Alexnet8 - +""" Alexnet9 = Benchmark() Alexnet9.tuner_binary = "fc4_clipped" Alexnet9.promise_binary = "" @@ -442,6 +456,6 @@ Pipeline5.validation_accuracy = 95 bench_tuner_data["pipeline_GSM"] = Pipeline5 - +""" diff --git a/llvm/projects/hpvm-tensor-rt/bin/tuner_src/run_algo_tuner.py b/llvm/projects/hpvm-tensor-rt/bin/tuner_src/run_algo_tuner.py new file mode 100644 index 0000000000000000000000000000000000000000..2df75fbfc4e7568361747f75f06a4b818a8f99be --- /dev/null +++ b/llvm/projects/hpvm-tensor-rt/bin/tuner_src/run_algo_tuner.py @@ -0,0 +1,102 @@ + + +import os +import subprocess +from error_sensitivity import select_skip_layers + + +def runAlgoTunerCmd(Bench, dir_prefix, result_dir, acc_threshold, autotuner_runs): + + tuner_cmd = "python2 ../opentuner/autotuner/algo_tuner.py " + tuner_cmd += " --test-limit " + tuner_cmd += str(autotuner_runs) + tuner_cmd += " --binary ./" + tuner_cmd += Bench.promise_binary + tuner_cmd += " --num-layers " + tuner_cmd += str(Bench.num_layers) + tuner_cmd += " --result-dir " + tuner_cmd += dir_prefix + tuner_cmd += result_dir + "/algo_tuner/" + tuner_cmd += " --accuracy " + tuner_cmd += str(Bench.promise_accuracy - acc_threshold) + tuner_cmd += " --cost-file " + tuner_cmd += Bench.cost_file + tuner_cmd += " --knobs-config " + tuner_cmd += "../opentuner/data/global_knobs.txt" + tuner_cmd += " --layer-knobs " + tuner_cmd += Bench.layer_knobs + + + print (tuner_cmd) + + p = subprocess.Popen(tuner_cmd, shell=True) + p.wait() + + +""" + +def promiseTunerLoss1(Bench, dir_prefix): + + tuner_runs = int(Bench.autotuner_runs / 3) + + skip_layers1 = "0" + skip_layers2 = "0_" + select_skip_layers(Bench, 30) + skip_layers3 = "0_" + select_skip_layers(Bench, 50) + + runPromiseTunerCmd(Bench, dir_prefix, Bench.result_dir_1, 0.85, tuner_runs, skip_layers1) + runPromiseTunerCmd(Bench, dir_prefix, Bench.result_dir_1, 0.85, tuner_runs, skip_layers2) + runPromiseTunerCmd(Bench, dir_prefix, Bench.result_dir_1, 0.85, tuner_runs, skip_layers3) + + +def promiseTunerLoss2(Bench, dir_prefix): + + tuner_runs = int(Bench.autotuner_runs / 3) + + skip_layers1 = "0" + skip_layers2 = "0_" + select_skip_layers(Bench, 20) + skip_layers3 = "0_" + select_skip_layers(Bench, 40) + + runPromiseTunerCmd(Bench, dir_prefix, Bench.result_dir_2, 1.7, tuner_runs, skip_layers1) + runPromiseTunerCmd(Bench, dir_prefix, Bench.result_dir_2, 1.7, tuner_runs, skip_layers2) + runPromiseTunerCmd(Bench, dir_prefix, Bench.result_dir_2, 1.7, tuner_runs, skip_layers3) + + + +def promiseTunerLoss3(Bench, dir_prefix): + + tuner_runs = int (Bench.autotuner_runs / 3) + + skip_layers1 = "0" + skip_layers2 = "0_" + select_skip_layers(Bench, 10) + skip_layers3 = "0_" + select_skip_layers(Bench, 30) + + runPromiseTunerCmd(Bench, dir_prefix, Bench.result_dir_3, 2.5, tuner_runs, skip_layers1) + runPromiseTunerCmd(Bench, dir_prefix, Bench.result_dir_3, 2.5, tuner_runs, skip_layers2) + runPromiseTunerCmd(Bench, dir_prefix, Bench.result_dir_3, 2.5, tuner_runs, skip_layers3) + + +""" + + +BASELINE = True + + +def runAlgoBench(Bench): + + # NOTE-IMP: Changing current directory to one with promise binaries + dir_prefix = "../build_tuner/" + + + if BASELINE: + tuner_runs = Bench.autotuner_runs + runAlgoTunerCmd(Bench, dir_prefix, Bench.result_dir_1, 0.85, tuner_runs) + runAlgoTunerCmd(Bench, dir_prefix, Bench.result_dir_2, 1.7, tuner_runs) + runAlgoTunerCmd(Bench, dir_prefix, Bench.result_dir_3, 2.5, tuner_runs) + + else: + promiseTunerLoss1(Bench, dir_prefix) + promiseTunerLoss2(Bench, dir_prefix) + promiseTunerLoss3(Bench, dir_prefix) + + + diff --git a/llvm/projects/hpvm-tensor-rt/bin/tuner_src/run_autotuner.py b/llvm/projects/hpvm-tensor-rt/bin/tuner_src/run_autotuner.py index 2d4a3bb9ca0189e7889abeca2888f985d1bbe380..8f2ded4680af9351fa4e3b571d16eb3725316af1 100644 --- a/llvm/projects/hpvm-tensor-rt/bin/tuner_src/run_autotuner.py +++ b/llvm/projects/hpvm-tensor-rt/bin/tuner_src/run_autotuner.py @@ -5,16 +5,17 @@ import subprocess import shutil from swing_selection import loadLayerDesc -from error_sensitivity import test_sensitivity, test_sensitivity2, test_sensitivity3 +from error_sensitivity import test_sensitivity, test_sensitivity2, test_sensitivity3, test_sensitivity4 from benchmarks import bench_tuner_data from run_psnr import runPSNRTuner from run_ha_tuner import runTunerBench from run_hs_tuner import runPromiseBench +from run_algo_tuner import runAlgoBench from compute_confs import computePSNRBenchSwings, computeBenchSwings from validation import runPromiseBenchValidation, runPromiseBenchValidation2, runBenchValidation from profiling import startProfile, stopProfile, dumpProfiles from utils import createResultDirs - +from benchmarks import batch_id @@ -52,44 +53,44 @@ def computeLayerSwings(): -gpu = 1 + def runPromiseTuner(): - if gpu == 2: - start = startProfile("LeNet") - runPromiseBench(bench_tuner_data["lenet_keras"]) - stopProfile("LeNet", start) - - start = startProfile("Alexnet") - runPromiseBench(bench_tuner_data["alexnet_cifar10"]) - stopProfile("Alexnet", start) + + start = startProfile("MobileNet") + runPromiseBench(bench_tuner_data["mobilenet_cifar10"]) + stopProfile("MobileNet", start) + + start = startProfile("Alexnet") + runPromiseBench(bench_tuner_data["alexnet_cifar10"]) + stopProfile("Alexnet", start) - start = startProfile("Alexnet2") - runPromiseBench(bench_tuner_data["alexnet2_cifar10"]) - stopProfile("Alexnet2", start) + start = startProfile("Alexnet2") + runPromiseBench(bench_tuner_data["alexnet2_cifar10"]) + stopProfile("Alexnet2", start) - start = startProfile("ResNet") - runPromiseBench(bench_tuner_data["resnet18_cifar10"]) - stopProfile("ResNet", start) + start = startProfile("VGG16_10") + runPromiseBench(bench_tuner_data["vgg16_cifar10"]) + stopProfile("VGG16_10", start) - if gpu == 1: - - start = startProfile("VGG16_10") - runPromiseBench(bench_tuner_data["vgg16_cifar10"]) - stopProfile("VGG16_10", start) - - start = startProfile("VGG16_100") - runPromiseBench(bench_tuner_data["vgg16_cifar100"]) - stopProfile("VGG16_100", start) + start = startProfile("VGG16_100") + runPromiseBench(bench_tuner_data["vgg16_cifar100"]) + stopProfile("VGG16_100", start) + + start = startProfile("ResNet") + runPromiseBench(bench_tuner_data["resnet18_cifar10"]) + stopProfile("ResNet", start) - start = startProfile("MobileNet") - runPromiseBench(bench_tuner_data["mobilenet_cifar10"]) - stopProfile("MobileNet", start) + start = startProfile("MobileNet-SH") + runPromiseBench(bench_tuner_data["mobilenet_shallow"]) + stopProfile("MobileNet-SH", start) + + start = startProfile("LeNet") + runPromiseBench(bench_tuner_data["lenet_keras"]) + stopProfile("LeNet", start) + - start = startProfile("MobileNet-SH") - runPromiseBench(bench_tuner_data["mobilenet_shallow"]) - stopProfile("MobileNet-SH", start) #runPSNRPromiseBench("pipeline_GEOM") #runPSNRPromiseBench("pipeline_GEMO") @@ -97,20 +98,47 @@ def runPromiseTuner(): #runPSNRPromiseBench("pipeline_GSM") #runPSNRPromiseBench("pipeline_GSME") - dumpProfiles("time_profile_17.txt") + dumpProfiles("time_profile" + batch_id + ".txt") + + def runPromiseValidation(): - #runPromiseBenchValidation(bench_tuner_data["mobilenet_shallow"]) - - #runPromiseBenchValidation("mobilenet_cifar10") - #runPromiseBenchValidation("resnet18_cifar10") - #runPromiseBenchValidation("alexnet2_cifar10") - #runPromiseBenchValidation("vgg_cifar100") - #runPromiseBenchValidation("vgg16_cifar10") - runPromiseBenchValidation2(bench_tuner_data["lenet_keras"]) + start = startProfile("AlexNet") + runPromiseBenchValidation2(bench_tuner_data["alexnet_cifar10"]) + stopProfile("AlexNet", start) + + start = startProfile("AlexNet2") + runPromiseBenchValidation2(bench_tuner_data["alexnet2_cifar10"]) + stopProfile("AlexNet2", start) + + start = startProfile("VGG16_100") + runPromiseBenchValidation2(bench_tuner_data["vgg16_cifar100"]) + stopProfile("VGG16_100", start) + + start = startProfile("VGG16_10") + runPromiseBenchValidation2(bench_tuner_data["vgg16_cifar10"]) + stopProfile("VGG16_10", start) + #runPromiseBenchValidation2(bench_tuner_data["lenet_keras"]) + + start = startProfile("ResNet") + runPromiseBenchValidation2(bench_tuner_data["resnet18_cifar10"]) + stopProfile("ResNet", start) + + start = startProfile("MobileNet_SH") + runPromiseBenchValidation2(bench_tuner_data["mobilenet_shallow"]) + stopProfile("MobileNet_SH", start) + + start = startProfile("MobileNet") + runPromiseBenchValidation2(bench_tuner_data["mobilenet_cifar10"]) + stopProfile("MobileNet", start) + + + dumpProfiles("validation_prof" + batch_id + ".txt") + + def runAutotuner(): @@ -135,8 +163,44 @@ def runAutotuner(): def runSensAnalysis(): + + start = startProfile("LeNet") + test_sensitivity4(bench_tuner_data["lenet_keras"]) + stopProfile("LeNet", start) + + """ + start = startProfile("AlexNet") + test_sensitivity4(bench_tuner_data["alexnet_cifar10"]) + stopProfile("AlexNet", start) + + start = startProfile("AlexNet2") + test_sensitivity4(bench_tuner_data["alexnet2_cifar10"]) + stopProfile("AlexNet2", start) + + start = startProfile("ResNet") + test_sensitivity4(bench_tuner_data["resnet18_cifar10"]) + stopProfile("ResNet", start) + + start = startProfile("MobileNet") + test_sensitivity4(bench_tuner_data["mobilenet_cifar10"]) + stopProfile("MobileNet", start) + + start = startProfile("MobileNet_SH") + test_sensitivity4(bench_tuner_data["mobilenet_shallow"]) + stopProfile("MobileNet_SH", start) + + start = startProfile("VGG_10") + test_sensitivity4(bench_tuner_data["vgg16_cifar10"]) + stopProfile("VGG16_10", start) + + start = startProfile("VGG_100") + test_sensitivity4(bench_tuner_data["vgg16_cifar100"]) + stopProfile("VGG16_100", start) + + dumpProfiles("sens_time_prof.txt") """ + start = startProfile("LeNet") test_sensitivity3(bench_tuner_data["lenet_keras"]) stopProfile("LeNet", start) @@ -148,8 +212,7 @@ def runSensAnalysis(): start = startProfile("AlexNet2") test_sensitivity3(bench_tuner_data["alexnet2_cifar10"]) stopProfile("AlexNet2", start) - """ - + start = startProfile("ResNet") test_sensitivity3(bench_tuner_data["resnet18_cifar10"]) stopProfile("ResNet", start) @@ -163,7 +226,6 @@ def runSensAnalysis(): test_sensitivity3(bench_tuner_data["mobilenet_shallow"]) stopProfile("MobileNet_SH", start) - """ start = startProfile("VGG_10") test_sensitivity3(bench_tuner_data["vgg16_cifar10"]) stopProfile("VGG16_10", start) @@ -171,9 +233,7 @@ def runSensAnalysis(): start = startProfile("VGG_100") test_sensitivity3(bench_tuner_data["vgg16_cifar100"]) stopProfile("VGG16_100", start) - - """ - + dumpProfiles("sens_time_prof.txt") @@ -200,9 +260,38 @@ def runSensAnalysis(): test_sensitivity(bench_tuner_data["vgg16_cifar100"]) """ - + + +def runAlgoTuner(): + + Bench = bench_tuner_data["mobilenet_shallow"] + runAlgoBench(Bench) + + Bench = bench_tuner_data["mobilenet_cifar10"] + runAlgoBench(Bench) + + Bench = bench_tuner_data["vgg16_cifar10"] + runAlgoBench(Bench) + + Bench = bench_tuner_data["lenet_keras"] + runAlgoBench(Bench) + + Bench = bench_tuner_data["alexnet2_cifar10"] + runAlgoBench(Bench) + + Bench = bench_tuner_data["alexnet_cifar10"] + runAlgoBench(Bench) + + Bench = bench_tuner_data["vgg16_cifar100"] + runAlgoBench(Bench) + + Bench = bench_tuner_data["resnet18_cifar10"] + runAlgoBench(Bench) + + + if __name__ == "__main__": createResultDirs(bench_tuner_data) @@ -213,8 +302,10 @@ if __name__ == "__main__": #computeLayerSwings() - runPromiseTuner() + #runPromiseTuner() + runAlgoTuner() + #runPromiseValidation() #runSensAnalysis() diff --git a/llvm/projects/hpvm-tensor-rt/opentuner/autotuner/algo_tuner.py b/llvm/projects/hpvm-tensor-rt/opentuner/autotuner/algo_tuner.py index 784625de26bac8d08b59a69bd4ccf1a060de11fc..0d2f1ff481258b7d2605e98468cf6ebd66bffd64 100644 --- a/llvm/projects/hpvm-tensor-rt/opentuner/autotuner/algo_tuner.py +++ b/llvm/projects/hpvm-tensor-rt/opentuner/autotuner/algo_tuner.py @@ -84,7 +84,8 @@ def createFlagsFile(file_name, cfg): f = open(file_name, "w+") cmd_config = "" - for flag in tunerData.tuning_flags: + for i in range(tunerData.num_layers): # flag in tunerData.tuning_flags: + flag = tunerData.tuning_flags[i] flag_value = cfg[flag] cmd_config += str(flag_value) + "\n"