From fcf1d0384cf13ee8e840b01e7c5f872c3e493844 Mon Sep 17 00:00:00 2001 From: Hashim Sharif <hsharif3@tyler.cs.illinois.edu> Date: Sun, 14 Jun 2020 22:33:35 -0500 Subject: [PATCH] Fixing AlexNet weight dir paths + Fixing HINT bug --- .../dnn_sources/src/alexnet_cifar10.cc | 2 +- .../src/half/alexnet_cifar10_half.cc | 2 +- .../src/promise/alexnet_promise.cc | 4 ++-- .../approxhpvm_src.cc | 0 .../conv2d_1_b.bin | Bin .../conv2d_1_w.bin | Bin .../conv2d_2_b.bin | Bin .../conv2d_2_w.bin | Bin .../conv2d_3_b.bin | Bin .../conv2d_3_w.bin | Bin .../conv2d_4_b.bin | Bin .../conv2d_4_w.bin | Bin .../conv2d_5_b.bin | Bin .../conv2d_5_w.bin | Bin .../dense_1_b.bin | 0 .../dense_1_w.bin | Bin .../input.bin | Bin .../labels.bin | Bin .../labels32.bin | Bin .../layer_composition.txt | 0 .../layers.txt | 0 .../promise_src.cc | 0 .../src.cc | 0 .../benchmarks/alexnet/src/alexnet.cpp | 18 ++++++++++-------- .../benchmarks/alexnet/src/alexnet_loop.cpp | 2 +- .../alexnet/src/alexnet_promise.cpp | 2 +- 26 files changed, 16 insertions(+), 14 deletions(-) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/approxhpvm_src.cc (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/conv2d_1_b.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/conv2d_1_w.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/conv2d_2_b.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/conv2d_2_w.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/conv2d_3_b.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/conv2d_3_w.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/conv2d_4_b.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/conv2d_4_w.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/conv2d_5_b.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/conv2d_5_w.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/dense_1_b.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/dense_1_w.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/input.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/labels.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/labels32.bin (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/layer_composition.txt (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/layers.txt (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/promise_src.cc (100%) rename llvm/projects/hpvm-tensor-rt/model_params/{alexnet_cifar10_test => alexnet_cifar10}/src.cc (100%) diff --git a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/alexnet_cifar10.cc b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/alexnet_cifar10.cc index 68bf89546e..8129fbfafc 100644 --- a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/alexnet_cifar10.cc +++ b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/alexnet_cifar10.cc @@ -13,7 +13,7 @@ int main(){ llvm_hpvm_initTensorRt(0); - std::string dir_prefix = std::string("../model_params/alexnet_cifar10_test/"); + std::string dir_prefix = std::string("../model_params/alexnet_cifar10/"); std::string input_path = dir_prefix + std::string("input.bin"); std::string labels_path = dir_prefix + std::string("labels.bin"); diff --git a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/half/alexnet_cifar10_half.cc b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/half/alexnet_cifar10_half.cc index 8555518570..8a429862f3 100644 --- a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/half/alexnet_cifar10_half.cc +++ b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/half/alexnet_cifar10_half.cc @@ -14,7 +14,7 @@ int main(){ llvm_hpvm_initTensorRt(0); - std::string dir_prefix = std::string("../model_params/alexnet_cifar10_test/"); + std::string dir_prefix = std::string("../model_params/alexnet_cifar10/"); std::string input_path = dir_prefix + std::string("input.bin"); std::string labels_path = dir_prefix + std::string("labels.bin"); diff --git a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/promise/alexnet_promise.cc b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/promise/alexnet_promise.cc index d0f4a34167..c67eb1153e 100644 --- a/llvm/projects/hpvm-tensor-rt/dnn_sources/src/promise/alexnet_promise.cc +++ b/llvm/projects/hpvm-tensor-rt/dnn_sources/src/promise/alexnet_promise.cc @@ -55,7 +55,7 @@ int main(int argc, char* argv[]){ } - llvm_hpvm_initTensorRt(0); + llvm_hpvm_initTensorRt(1); int missed = 0; @@ -70,7 +70,7 @@ int main(int argc, char* argv[]){ int batch_count = test_input_size / batch_size; float final_accuracy = 0.0; - std::string dir_prefix = std::string("../model_params/alexnet_cifar10_test/"); + std::string dir_prefix = std::string("../model_params/alexnet_cifar10/"); std::string input_path = dir_prefix + std::string("input.bin"); std::string labels_path = dir_prefix + std::string("labels.bin"); std::string labels32_path = dir_prefix + std::string("labels32.bin"); diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/approxhpvm_src.cc b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/approxhpvm_src.cc similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/approxhpvm_src.cc rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/approxhpvm_src.cc diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_1_b.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_1_b.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_1_b.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_1_b.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_1_w.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_1_w.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_1_w.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_1_w.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_2_b.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_2_b.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_2_b.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_2_b.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_2_w.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_2_w.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_2_w.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_2_w.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_3_b.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_3_b.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_3_b.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_3_b.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_3_w.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_3_w.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_3_w.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_3_w.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_4_b.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_4_b.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_4_b.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_4_b.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_4_w.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_4_w.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_4_w.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_4_w.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_5_b.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_5_b.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_5_b.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_5_b.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_5_w.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_5_w.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/conv2d_5_w.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/conv2d_5_w.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/dense_1_b.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/dense_1_b.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/dense_1_b.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/dense_1_b.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/dense_1_w.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/dense_1_w.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/dense_1_w.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/dense_1_w.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/input.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/input.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/input.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/input.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/labels.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/labels.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/labels.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/labels.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/labels32.bin b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/labels32.bin similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/labels32.bin rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/labels32.bin diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/layer_composition.txt b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/layer_composition.txt similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/layer_composition.txt rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/layer_composition.txt diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/layers.txt b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/layers.txt similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/layers.txt rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/layers.txt diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/promise_src.cc b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/promise_src.cc similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/promise_src.cc rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/promise_src.cc diff --git a/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/src.cc b/llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/src.cc similarity index 100% rename from llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/src.cc rename to llvm/projects/hpvm-tensor-rt/model_params/alexnet_cifar10/src.cc diff --git a/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet.cpp b/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet.cpp index 7b44c7699c..897020b056 100644 --- a/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet.cpp +++ b/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet.cpp @@ -9,6 +9,8 @@ #include <tensorTypes.h> #include <tensorUtils.h> + + void var_0_node(void* t1, size_t bytes_t1, void* t2, size_t bytes_t2) { __visc__hint(visc::CUDNN_TARGET); __visc__attributes(2, t1, t2, 0); @@ -177,6 +179,8 @@ void var_20_node(void* t1, size_t bytes_t1) { __visc__return(2, r, (size_t) 0); } + + void root(void* input, size_t input_bytes, void* conv2d_1_w, size_t conv2d_1_w_bytes, void* conv2d_1_b, size_t conv2d_1_b_bytes, @@ -192,7 +196,8 @@ void root(void* input, size_t input_bytes, void* dense_1_b, size_t dense_1_b_bytes){ - __visc__hint(visc::CPU_TARGET); + __visc__hint(visc::CPU_TARGET); + __visc__attributes(13, input, conv2d_1_w, conv2d_1_b, conv2d_2_w, conv2d_2_b, conv2d_3_w, conv2d_3_b, conv2d_4_w, conv2d_4_b, conv2d_5_w, conv2d_5_b, dense_1_w, dense_1_b, 0); @@ -369,15 +374,12 @@ RootIn; int main(){ - std::string dir_prefix = std::string("../../../../../../projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/"); + std::string dir_prefix = std::string("../../../../../../projects/hpvm-tensor-rt/model_params/alexnet_cifar10/"); std::string input_path = dir_prefix + std::string("input.bin"); - //void* input = readTrainedWeights(input_path.c_str(), 0,10000,3,32,32); - void* input = create4DTensor(0,nchw,10000,3,32,32); - copyInputBatch(input_path.c_str(),0,10000,3,32,32, input); - + void* input = readTrainedWeights(input_path.c_str(), 0,5000,3,32,32); std::string labels_path = dir_prefix + std::string("labels.bin"); - uint8_t* labels = readLabels(labels_path.c_str(),10000); + uint8_t* labels = readLabels(labels_path.c_str(),5000); std::string conv2d_1_w_path = dir_prefix + std::string("conv2d_1_w.bin"); void* conv2d_1_w = readTrainedWeights(conv2d_1_w_path.c_str(), 0,64,3,11,11); std::string conv2d_1_b_path = dir_prefix + std::string("conv2d_1_b.bin"); @@ -443,7 +445,7 @@ int main(){ hpvm_request_tensor(result, 0); __visc__cleanup(); - computeAccuracy2(labels, 10000, result); + computeAccuracy2(labels, 5000, result); return 0; } diff --git a/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet_loop.cpp b/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet_loop.cpp index 82dfcb725b..09e6e25cff 100644 --- a/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet_loop.cpp +++ b/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet_loop.cpp @@ -373,7 +373,7 @@ RootIn; int main(){ - std::string dir_prefix = std::string("../../../../../../projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/"); + std::string dir_prefix = std::string("../../../../../../projects/hpvm-tensor-rt/model_params/alexnet_cifar10/"); std::string input_path = dir_prefix + std::string("input.bin"); //void* input = readTrainedWeights(input_path.c_str(), 0,5000,3,32,32); diff --git a/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet_promise.cpp b/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet_promise.cpp index 9bff465223..a7a2a9efba 100644 --- a/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet_promise.cpp +++ b/llvm/test/VISC/DNN_Benchmarks/benchmarks/alexnet/src/alexnet_promise.cpp @@ -373,7 +373,7 @@ RootIn; int main(){ - std::string dir_prefix = std::string("../../../../../../projects/hpvm-tensor-rt/model_params/alexnet_cifar10_test/"); + std::string dir_prefix = std::string("../../../../../../projects/hpvm-tensor-rt/model_params/alexnet_cifar10/"); std::string input_path = dir_prefix + std::string("input.bin"); void* input = readTrainedWeights(input_path.c_str(), 0,5000,3,32,32); -- GitLab