From 41b7cead18cb9f2c910422b5e80ecf5882eb6c50 Mon Sep 17 00:00:00 2001
From: Yifan Zhao <yifanz16@illinois.edu>
Date: Tue, 30 Mar 2021 18:37:27 -0500
Subject: [PATCH] Move trt sources to test/

---
 hpvm/projects/hpvm-tensor-rt/CMakeLists.txt   | 70 ++-----------------
 .../{dnn_sources/src => tests}/unit_tests.cc  |  2 +-
 hpvm/test/CMakeLists.txt                      |  3 +-
 .../test/dnn_benchmarks/hpvm-c/CMakeLists.txt |  1 -
 .../tensor-rt-src/CMakeLists.txt              | 40 +++++++++++
 .../fp16/alexnet2_cifar10_half.cc             |  3 +-
 .../fp16/alexnet_cifar10_half.cc              |  2 +-
 .../tensor-rt-src}/fp16/lenet_mnist_half.cc   |  2 +-
 .../fp16/mobilenet_cifar10_half.cc}           |  3 +-
 .../fp16/resnet18_cifar10_half.cc             |  3 +-
 .../fp16/vgg16_cifar100_half.cc               |  2 +-
 .../tensor-rt-src}/fp16/vgg16_cifar10_half.cc |  2 +-
 .../tensor-rt-src}/fp32/alexnet2_cifar10.cc   |  3 +-
 .../tensor-rt-src}/fp32/alexnet_cifar10.cc    |  2 +-
 .../tensor-rt-src}/fp32/alexnet_imagenet.cc   |  3 +-
 .../tensor-rt-src}/fp32/lenet_mnist.cc        |  2 +-
 .../tensor-rt-src/fp32/mobilenet_cifar10.cc}  |  3 +-
 .../tensor-rt-src}/fp32/resnet18_cifar10.cc   |  3 +-
 .../tensor-rt-src}/fp32/resnet50_imagenet.cc  |  3 +-
 .../tensor-rt-src}/fp32/vgg16_cifar10.cc      |  2 +-
 .../tensor-rt-src}/fp32/vgg16_cifar100.cc     |  2 +-
 .../tensor-rt-src}/fp32/vgg16_imagenet.cc     |  2 +-
 22 files changed, 65 insertions(+), 93 deletions(-)
 rename hpvm/projects/hpvm-tensor-rt/{dnn_sources/src => tests}/unit_tests.cc (99%)
 create mode 100644 hpvm/test/dnn_benchmarks/tensor-rt-src/CMakeLists.txt
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp16/alexnet2_cifar10_half.cc (97%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp16/alexnet_cifar10_half.cc (98%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp16/lenet_mnist_half.cc (97%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src/fp16/mobilenet_half.cc => test/dnn_benchmarks/tensor-rt-src/fp16/mobilenet_cifar10_half.cc} (99%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp16/resnet18_cifar10_half.cc (99%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp16/vgg16_cifar100_half.cc (99%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp16/vgg16_cifar10_half.cc (99%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp32/alexnet2_cifar10.cc (97%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp32/alexnet_cifar10.cc (98%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp32/alexnet_imagenet.cc (98%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp32/lenet_mnist.cc (97%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src/fp32/mobilenet.cc => test/dnn_benchmarks/tensor-rt-src/fp32/mobilenet_cifar10.cc} (99%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp32/resnet18_cifar10.cc (99%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp32/resnet50_imagenet.cc (99%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp32/vgg16_cifar10.cc (99%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp32/vgg16_cifar100.cc (99%)
 rename hpvm/{projects/hpvm-tensor-rt/dnn_sources/src => test/dnn_benchmarks/tensor-rt-src}/fp32/vgg16_imagenet.cc (99%)

diff --git a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
index e53d6c4d3c..4c92c55341 100644
--- a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
+++ b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
@@ -22,13 +22,7 @@ configure_file(
 )
 
 # -- Default include directories
-set(
-  INCLUDES
-  # Have to add these because of tensor_runtime.ll (see below)
-  ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} ${CUDNN_INCLUDE_PATH}
-  ./tensor_runtime/include ${CMAKE_CURRENT_BINARY_DIR}/tensor_runtime/include
-  ./dnn_sources/include  # TODO: remove this.
-)
+set(INCLUDES ./tensor_runtime/include ${CMAKE_CURRENT_BINARY_DIR}/tensor_runtime/include)
 
 # Build gpu_profiler and soc_simulator (dependencies)
 add_library(gpu_profiler SHARED gpu_profiler/profiler.cpp)
@@ -142,7 +136,7 @@ add_tensor_runtime(tensor_runtime_online -DONLINE_PROFILING=true -DFP16_tuning=f
 add_dependencies(tensor_runtime_online tensor_runtime)
 
 # Adding rule for the debugging source
-add_executable(unit_tests dnn_sources/src/unit_tests.cc)
+add_executable(unit_tests tests/unit_tests.cc)
 target_link_libraries(unit_tests tensor_runtime_online)
 
 # -- Compile tensor_runtime.ll if possible
@@ -167,7 +161,9 @@ endif()
 # If some clang-9 is found, create a tensor_runtime.ll from tensor_signatures.cc
 if(CLANG_NAME)
   message(STATUS "Creating tensor_runtime.ll in ${TENSOR_RT_LL_PREFIX}")
-  foreach(dir ${INCLUDES})
+  # Manually add cuda includes because add_custom_command doesn't handle them
+  # (unlike add_library which has CUDA-lang support).
+  foreach(dir ${INCLUDES} ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} ${CUDNN_INCLUDE_PATH})
     list(APPEND INCLUDE_COMPILER_STRINGS "-I${dir}")
   endforeach()
   add_custom_command(
@@ -177,59 +173,3 @@ if(CLANG_NAME)
     -o ${TENSOR_RT_LL_PREFIX}/tensor_runtime.ll
   )
 endif()
-
-
-#**************** FP32 TensorRT Source Builds *********** 
-
-add_executable(lenet_mnist_fp32 dnn_sources/src/fp32/lenet_mnist.cc)
-target_link_libraries(lenet_mnist_fp32 tensor_runtime_online)
-
-add_executable(alexnet_cifar10_fp32 dnn_sources/src/fp32/alexnet_cifar10.cc)
-target_link_libraries(alexnet_cifar10_fp32 tensor_runtime_online)
-
-add_executable(alexnet2_cifar10_fp32 dnn_sources/src/fp32/alexnet2_cifar10.cc)
-target_link_libraries(alexnet2_cifar10_fp32 tensor_runtime_online)
-
-add_executable(vgg16_cifar10_fp32 dnn_sources/src/fp32/vgg16_cifar10.cc)
-target_link_libraries(vgg16_cifar10_fp32 tensor_runtime_online)
-
-add_executable(resnet18_cifar10_fp32 dnn_sources/src/fp32/resnet18_cifar10.cc)
-target_link_libraries(resnet18_cifar10_fp32 tensor_runtime_online)
-
-add_executable(vgg16_cifar100_fp32 dnn_sources/src/fp32/vgg16_cifar100.cc)
-target_link_libraries(vgg16_cifar100_fp32 tensor_runtime_online)
-
-add_executable(mobilenet_cifar10_fp32 dnn_sources/src/fp32/mobilenet.cc)
-target_link_libraries(mobilenet_cifar10_fp32 tensor_runtime_online)
-
-add_executable(alexnet_imagenet_fp32 dnn_sources/src/fp32/alexnet_imagenet.cc)
-target_link_libraries(alexnet_imagenet_fp32 tensor_runtime_online)
-
-add_executable(vgg16_imagenet_fp32 dnn_sources/src/fp32/vgg16_imagenet.cc)
-target_link_libraries(vgg16_imagenet_fp32 tensor_runtime_online)
-
-add_executable(resnet50_imagenet_fp32 dnn_sources/src/fp32/resnet50_imagenet.cc)
-target_link_libraries(resnet50_imagenet_fp32 tensor_runtime_online)
-
-#********* FP16 TensorRT Source Builds ****** 
-
-add_executable(lenet_mnist_fp16 dnn_sources/src/fp16/lenet_mnist_half.cc)
-target_link_libraries(lenet_mnist_fp16 tensor_runtime_online)
-
-add_executable(alexnet_cifar10_fp16 dnn_sources/src/fp16/alexnet_cifar10_half.cc)
-target_link_libraries(alexnet_cifar10_fp16 tensor_runtime_online)
-
-add_executable(alexnet2_cifar10_fp16 dnn_sources/src/fp16/alexnet2_cifar10_half.cc)
-target_link_libraries(alexnet2_cifar10_fp16 tensor_runtime_online)
-
-add_executable(resnet18_cifar10_fp16 dnn_sources/src/fp16/resnet18_cifar10_half.cc)
-target_link_libraries(resnet18_cifar10_fp16 tensor_runtime_online)
-
-add_executable(vgg16_cifar10_fp16 dnn_sources/src/fp16/vgg16_cifar10_half.cc)
-target_link_libraries(vgg16_cifar10_fp16 tensor_runtime_online)
-
-add_executable(vgg16_cifar100_fp16 dnn_sources/src/fp16/vgg16_cifar100_half.cc)
-target_link_libraries(vgg16_cifar100_fp16 tensor_runtime_online)
-
-add_executable(mobilenet_cifar10_fp16 dnn_sources/src/fp16/mobilenet_half.cc)
-target_link_libraries(mobilenet_cifar10_fp16 tensor_runtime_online)
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/unit_tests.cc b/hpvm/projects/hpvm-tensor-rt/tests/unit_tests.cc
similarity index 99%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/unit_tests.cc
rename to hpvm/projects/hpvm-tensor-rt/tests/unit_tests.cc
index 746f62bce1..ffb4c3a809 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/unit_tests.cc
+++ b/hpvm/projects/hpvm-tensor-rt/tests/unit_tests.cc
@@ -6,7 +6,7 @@
 #include <string.h>
 #include "tensor_runtime.h"
 #include "tensor_cpu_runtime.h"
-#include "utils.h"
+#include "tensorUtils.h"
 #include "tensor_custom_ops_cpu.h"
 
 using namespace std;
diff --git a/hpvm/test/CMakeLists.txt b/hpvm/test/CMakeLists.txt
index 660003538f..cb548b84dc 100644
--- a/hpvm/test/CMakeLists.txt
+++ b/hpvm/test/CMakeLists.txt
@@ -1,4 +1,5 @@
 include(../cmake/TestFile.cmake)  # Generation of `.test` files in CMake
 add_subdirectory(hpvm_pass)  # Passes test suite
-add_subdirectory(dnn_benchmarks/hpvm-c)  # DNN accuracy test suite
+add_subdirectory(dnn_benchmarks/hpvm-c)  # HPVM-C DNN accuracy test suite
+add_subdirectory(dnn_benchmarks/tensor-rt-src)  # tensor_runtime DNN (build only, no tests)
 add_subdirectory(dnn_benchmarks/profiling)  # hpvm-profiler test suite
diff --git a/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt b/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt
index 033023b761..6664827014 100644
--- a/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt
+++ b/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt
@@ -49,7 +49,6 @@ endforeach(dir)
 
 # Install an accuracy comparator under build/bin for test suite.
 set(BIN_DIR ${LLVM_BINARY_DIR}/${LLVM_TOOLS_INSTALL_DIR})
-message("BIN_DIR = ${BIN_DIR}")
 add_custom_command(
   OUTPUT ${BIN_DIR}/check_dnn_acc.py
   COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/check_dnn_acc.py ${BIN_DIR}
diff --git a/hpvm/test/dnn_benchmarks/tensor-rt-src/CMakeLists.txt b/hpvm/test/dnn_benchmarks/tensor-rt-src/CMakeLists.txt
new file mode 100644
index 0000000000..6e22eba674
--- /dev/null
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/CMakeLists.txt
@@ -0,0 +1,40 @@
+#**************** FP32 and FP16 TensorRT Source Builds *********** 
+# Don't put binaries in build/bin. This doesn't affect global setting.
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+set(MODEL_PARAMS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../model_params/")
+set(test_compile_targets "")
+function(add_trt_source target_name filepath)
+  set(generated_file_path "${CMAKE_CURRENT_BINARY_DIR}/${target_name}.cpp")
+  configure_file(${filepath} ${generated_file_path})
+  add_executable(${target_name} ${generated_file_path})
+  target_link_libraries(${target_name} tensor_runtime_online)
+  set(test_compile_targets ${test_compile_targets} ${target_name} PARENT_SCOPE)
+endfunction(add_trt_source)
+
+set(
+  DNN_NAMES
+  alexnet_cifar10
+  alexnet2_cifar10
+  vgg16_cifar10
+  resnet18_cifar10
+  vgg16_cifar100
+  mobilenet_cifar10
+  alexnet_imagenet
+  vgg16_imagenet
+  resnet50_imagenet
+)
+foreach(dnn_name ${DNN_NAMES})
+  # FP32 version
+  if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/fp32/${dnn_name}.cc")
+    add_trt_source(${dnn_name}_fp32 "${CMAKE_CURRENT_SOURCE_DIR}/fp32/${dnn_name}.cc")
+  endif()
+  # FP16 version
+  if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/fp16/${dnn_name}_half.cc")
+    add_trt_source(${dnn_name}_fp16 "${CMAKE_CURRENT_SOURCE_DIR}/fp16/${dnn_name}_half.cc")
+  endif()
+endforeach()
+
+message(STATUS "List of tensor_runtime DNN benchmarks: ${test_compile_targets}")
+add_custom_target(trt_dnn_benchmarks DEPENDS ${test_compile_targets})
+message(STATUS "Target name for compiling all DNN benchmarks: trt_dnn_benchmarks")
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet2_cifar10_half.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/alexnet2_cifar10_half.cc
similarity index 97%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet2_cifar10_half.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/alexnet2_cifar10_half.cc
index 206b4beed7..ab80718fd3 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet2_cifar10_half.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/alexnet2_cifar10_half.cc
@@ -10,8 +10,7 @@ void testCifarNet() {
   printf("********* Alexnet2 CIFAR-10 DNN ********** \n");
 
   std::string dir_prefix =
-      model_params_path + std::string("/alexnet2_cifar10/");
-  std::string input_path = dir_prefix + std::string("test_input.bin");
+      std::string("@MODEL_PARAMS_DIR@") + "/alexnet2_cifar10/";  std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
 
   std::string conv2d_1_w_path = dir_prefix + std::string("conv2d_1_w.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet_cifar10_half.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/alexnet_cifar10_half.cc
similarity index 98%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet_cifar10_half.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/alexnet_cifar10_half.cc
index eaf666b374..b3b69d6b69 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/alexnet_cifar10_half.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/alexnet_cifar10_half.cc
@@ -8,7 +8,7 @@ int main() {
 
   llvm_hpvm_initTensorRt(0);
 
-  std::string dir_prefix = model_params_path + std::string("/alexnet_cifar10/");
+  std::string dir_prefix = std::string("@MODEL_PARAMS_DIR@") + "/alexnet_cifar10/";
 
   std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/lenet_mnist_half.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/lenet_mnist_half.cc
similarity index 97%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/lenet_mnist_half.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/lenet_mnist_half.cc
index 9fcc382aed..44b78b9169 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/lenet_mnist_half.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/lenet_mnist_half.cc
@@ -12,7 +12,7 @@ void testLenetTanh() {
 
   int test_batch_size = 5000;
 
-  std::string dir_prefix = model_params_path + std::string("/lenet_mnist/");
+  std::string dir_prefix = std::string("@MODEL_PARAMS_DIR@") + "/lenet_mnist/";
 
   std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/mobilenet_half.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/mobilenet_cifar10_half.cc
similarity index 99%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/mobilenet_half.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/mobilenet_cifar10_half.cc
index 7857f210f9..d4423bf434 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/mobilenet_half.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/mobilenet_cifar10_half.cc
@@ -9,8 +9,7 @@ int main() {
   llvm_hpvm_initTensorRt(0);
 
   std::string dir_prefix =
-      model_params_path + std::string("/mobilenet_cifar10/");
-
+      std::string("@MODEL_PARAMS_DIR@") + "/mobilenet_cifar10/";
   std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
 
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/resnet18_cifar10_half.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/resnet18_cifar10_half.cc
similarity index 99%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/resnet18_cifar10_half.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/resnet18_cifar10_half.cc
index 40745c9986..76dea5ef08 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/resnet18_cifar10_half.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/resnet18_cifar10_half.cc
@@ -9,8 +9,7 @@ int main() {
   llvm_hpvm_initTensorRt(0);
 
   std::string dir_prefix =
-      model_params_path + std::string("/resnet18_cifar10/");
-
+      std::string("@MODEL_PARAMS_DIR@") + "/resnet18_cifar10/";
   std::string input_path = dir_prefix + std::string("test_input.bin");
 
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar100_half.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/vgg16_cifar100_half.cc
similarity index 99%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar100_half.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/vgg16_cifar100_half.cc
index de5657f63d..2772fd3da4 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar100_half.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/vgg16_cifar100_half.cc
@@ -8,7 +8,7 @@ int main() {
 
   llvm_hpvm_initTensorRt(0);
 
-  std::string dir_prefix = model_params_path + std::string("/vgg16_cifar100/");
+  std::string dir_prefix = std::string("@MODEL_PARAMS_DIR@") + "/vgg16_cifar100/";
 
   std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar10_half.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/vgg16_cifar10_half.cc
similarity index 99%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar10_half.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/vgg16_cifar10_half.cc
index 7b4318c895..954f6778b8 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp16/vgg16_cifar10_half.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp16/vgg16_cifar10_half.cc
@@ -8,7 +8,7 @@ int main() {
 
   llvm_hpvm_initTensorRt(0);
 
-  std::string dir_prefix = model_params_path + std::string("/vgg16_cifar10/");
+  std::string dir_prefix = std::string("@MODEL_PARAMS_DIR@") + "/vgg16_cifar10/";
   std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
   std::string conv2d_1_w_path = dir_prefix + std::string("conv2d_1_w.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet2_cifar10.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/alexnet2_cifar10.cc
similarity index 97%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet2_cifar10.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/alexnet2_cifar10.cc
index b69596f8f5..e7431234d7 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet2_cifar10.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/alexnet2_cifar10.cc
@@ -10,8 +10,7 @@ void testCifarNet() {
   printf("********* Alexnet2 CIFAR-10 DNN ********** \n");
 
   std::string dir_prefix =
-      model_params_path + std::string("/alexnet2_cifar10/");
-  std::string input_path = dir_prefix + std::string("test_input.bin");
+      std::string("@MODEL_PARAMS_DIR@") + "/alexnet2_cifar10/";  std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
 
   std::string conv2d_1_w_path = dir_prefix + std::string("conv2d_1_w.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_cifar10.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/alexnet_cifar10.cc
similarity index 98%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_cifar10.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/alexnet_cifar10.cc
index 2283448bc3..12c304c9b4 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_cifar10.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/alexnet_cifar10.cc
@@ -8,7 +8,7 @@ int main() {
 
   llvm_hpvm_initTensorRt(0);
 
-  std::string dir_prefix = model_params_path + std::string("/alexnet_cifar10/");
+  std::string dir_prefix = std::string("@MODEL_PARAMS_DIR@") + "/alexnet_cifar10/";
 
   std::string input_path = dir_prefix + std::string("test_input.bin");
   // std::string labels_path = dir_prefix + std::string("labels.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_imagenet.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/alexnet_imagenet.cc
similarity index 98%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_imagenet.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/alexnet_imagenet.cc
index cb01f8ba3d..b57e60c0fe 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/alexnet_imagenet.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/alexnet_imagenet.cc
@@ -9,8 +9,7 @@ int main() {
   llvm_hpvm_initTensorRt(0);
 
   std::string dir_prefix =
-      model_params_path + std::string("/alexnet_imagenet/");
-
+      std::string("@MODEL_PARAMS_DIR@") + "/alexnet_imagenet/";
   std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
   std::string conv2d_1_w_path = dir_prefix + std::string("conv2d_1_w.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/lenet_mnist.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/lenet_mnist.cc
similarity index 97%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/lenet_mnist.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/lenet_mnist.cc
index 2294c34df1..9777670722 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/lenet_mnist.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/lenet_mnist.cc
@@ -11,7 +11,7 @@ void testLenetTanh() {
 
   int test_batch_size = 5000;
 
-  std::string dir_prefix = model_params_path + std::string("/lenet_mnist/");
+  std::string dir_prefix = std::string("@MODEL_PARAMS_DIR@") + "/lenet_mnist/";
 
   std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/mobilenet.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/mobilenet_cifar10.cc
similarity index 99%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/mobilenet.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/mobilenet_cifar10.cc
index 23a738ef13..3e37bf7feb 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/mobilenet.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/mobilenet_cifar10.cc
@@ -8,8 +8,7 @@ int main() {
   llvm_hpvm_initTensorRt(0);
 
   std::string dir_prefix =
-      model_params_path + std::string("/mobilenet_cifar10/");
-  std::string input_path = dir_prefix + std::string("test_input.bin");
+      std::string("@MODEL_PARAMS_DIR@") + "/mobilenet_cifar10/";  std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
   std::string conv2d_1_w_path = dir_prefix + std::string("conv2d_1_w.bin");
   void *conv2d_1_w =
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet18_cifar10.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/resnet18_cifar10.cc
similarity index 99%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet18_cifar10.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/resnet18_cifar10.cc
index fffb02c605..c8a99419a8 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet18_cifar10.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/resnet18_cifar10.cc
@@ -9,8 +9,7 @@ int main() {
   llvm_hpvm_initTensorRt(0);
 
   std::string dir_prefix =
-      model_params_path + std::string("/resnet18_cifar10/");
-
+      std::string("@MODEL_PARAMS_DIR@") + "/resnet18_cifar10/";
   std::string input_path = dir_prefix + std::string("test_input.bin");
 
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet50_imagenet.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/resnet50_imagenet.cc
similarity index 99%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet50_imagenet.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/resnet50_imagenet.cc
index 110acf5c89..3aeabc2273 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/resnet50_imagenet.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/resnet50_imagenet.cc
@@ -9,8 +9,7 @@ int main() {
   llvm_hpvm_initTensorRt(0);
 
   std::string dir_prefix =
-      model_params_path + std::string("/resnet50_imagenet/");
-
+      std::string("@MODEL_PARAMS_DIR@") + "/resnet50_imagenet/";
   std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
   std::string conv2d_1_w_path = dir_prefix + std::string("conv2d_1_w.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar10.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/vgg16_cifar10.cc
similarity index 99%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar10.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/vgg16_cifar10.cc
index 1d2602ab28..f7fffadfc3 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar10.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/vgg16_cifar10.cc
@@ -7,7 +7,7 @@ int main() {
 
   llvm_hpvm_initTensorRt(0);
 
-  std::string dir_prefix = model_params_path + std::string("/vgg16_cifar10/");
+  std::string dir_prefix = std::string("@MODEL_PARAMS_DIR@") + "/vgg16_cifar10/";
   std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
   std::string conv2d_1_w_path = dir_prefix + std::string("conv2d_1_w.bin");
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar100.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/vgg16_cifar100.cc
similarity index 99%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar100.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/vgg16_cifar100.cc
index 85fe400f7e..d3949c7cc5 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_cifar100.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/vgg16_cifar100.cc
@@ -8,7 +8,7 @@ int main() {
 
   llvm_hpvm_initTensorRt(0);
 
-  std::string dir_prefix = model_params_path + std::string("/vgg16_cifar100/");
+  std::string dir_prefix = std::string("@MODEL_PARAMS_DIR@") + "/vgg16_cifar100/";
   std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
 
diff --git a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_imagenet.cc b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/vgg16_imagenet.cc
similarity index 99%
rename from hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_imagenet.cc
rename to hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/vgg16_imagenet.cc
index 4ab8707a0d..2bb1be2821 100644
--- a/hpvm/projects/hpvm-tensor-rt/dnn_sources/src/fp32/vgg16_imagenet.cc
+++ b/hpvm/test/dnn_benchmarks/tensor-rt-src/fp32/vgg16_imagenet.cc
@@ -8,7 +8,7 @@ int main() {
 
   llvm_hpvm_initTensorRt(0);
 
-  std::string dir_prefix = model_params_path + std::string("/vgg16_imagenet/");
+  std::string dir_prefix = std::string("@MODEL_PARAMS_DIR@") + "/vgg16_imagenet/";
 
   std::string input_path = dir_prefix + std::string("test_input.bin");
   std::string labels_path = dir_prefix + std::string("test_labels.bin");
-- 
GitLab