From faf9ac0a752e5205440c29b53a6821b0f713927f Mon Sep 17 00:00:00 2001
From: Hashim Sharif <hsharif3@miranda.cs.illinois.edu>
Date: Mon, 5 Apr 2021 18:00:50 -0500
Subject: [PATCH] Creating 2 sources for Sampling and Perforation Tests

---
 hpvm/projects/hpvm-tensor-rt/CMakeLists.txt      |  8 ++++++--
 .../hpvm-tensor-rt/tests/perforation_tests.cc    | 16 ++++++++++++++++
 .../hpvm-tensor-rt/tests/sampling_tests.cc       | 16 ++++++++++++++++
 .../tests/{unit_tests.cc => tests.h}             | 13 +++----------
 4 files changed, 41 insertions(+), 12 deletions(-)
 create mode 100644 hpvm/projects/hpvm-tensor-rt/tests/perforation_tests.cc
 create mode 100644 hpvm/projects/hpvm-tensor-rt/tests/sampling_tests.cc
 rename hpvm/projects/hpvm-tensor-rt/tests/{unit_tests.cc => tests.h} (98%)

diff --git a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
index cbabc8bbe0..be42ebec07 100644
--- a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
+++ b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
@@ -140,8 +140,12 @@ 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 tests/unit_tests.cc)
-target_link_libraries(unit_tests tensor_runtime_online)
+add_executable(sampling_tests tests/sampling_tests.cc)
+target_link_libraries(sampling_tests tensor_runtime_online)
+
+add_executable(perforation_tests tests/perforation_tests.cc)
+target_link_libraries(perforation_tests tensor_runtime_online)
+
 
 # -- Compile tensor_runtime.ll if possible
 if(INDEP_BUILD)
diff --git a/hpvm/projects/hpvm-tensor-rt/tests/perforation_tests.cc b/hpvm/projects/hpvm-tensor-rt/tests/perforation_tests.cc
new file mode 100644
index 0000000000..c36a2c81d0
--- /dev/null
+++ b/hpvm/projects/hpvm-tensor-rt/tests/perforation_tests.cc
@@ -0,0 +1,16 @@
+
+#include "tests.h"
+
+
+int main() {
+
+  llvm_hpvm_initTensorRt(0);
+
+  UnitTestResults unitTestResults;
+  
+  testPerforation(unitTestResults);
+  
+  unitTestResults.printSummary();
+
+  return 0;
+}
diff --git a/hpvm/projects/hpvm-tensor-rt/tests/sampling_tests.cc b/hpvm/projects/hpvm-tensor-rt/tests/sampling_tests.cc
new file mode 100644
index 0000000000..087511413e
--- /dev/null
+++ b/hpvm/projects/hpvm-tensor-rt/tests/sampling_tests.cc
@@ -0,0 +1,16 @@
+
+#include "tests.h"
+
+
+int main() {
+
+  llvm_hpvm_initTensorRt(0);
+
+  UnitTestResults unitTestResults;
+  
+  testSampling(unitTestResults); 
+  
+  unitTestResults.printSummary();
+
+  return 0;
+}
diff --git a/hpvm/projects/hpvm-tensor-rt/tests/unit_tests.cc b/hpvm/projects/hpvm-tensor-rt/tests/tests.h
similarity index 98%
rename from hpvm/projects/hpvm-tensor-rt/tests/unit_tests.cc
rename to hpvm/projects/hpvm-tensor-rt/tests/tests.h
index e60e455e5a..d9bf90a6c5 100644
--- a/hpvm/projects/hpvm-tensor-rt/tests/unit_tests.cc
+++ b/hpvm/projects/hpvm-tensor-rt/tests/tests.h
@@ -1,4 +1,5 @@
 
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -460,17 +461,9 @@ void testSampling_1_1(UnitTestResults &unitTestResults) {
 
 
 
-int main() {
-
-  llvm_hpvm_initTensorRt(0);
-
-  UnitTestResults unitTestResults;
+void testSampling(UnitTestResults &unitTestResults){
 
   testSampling_3_3(unitTestResults);
   testSampling_1_1(unitTestResults);
-  testPerforation(unitTestResults);
-  unitTestResults.printSummary();
-
-
-  return 0;
 }
+
-- 
GitLab