From 544becdb25587f6c7fb8b421d79c558436276889 Mon Sep 17 00:00:00 2001
From: Hashim Sharif <hsharif3@tyler.cs.illinois.edu>
Date: Wed, 18 Nov 2020 23:44:46 -0600
Subject: [PATCH] Fixing visc_cleanup issue with VGG16

---
 .../vgg16_imagenet/data/tuner_confs_base.txt  | 21 +++++++++++++++++++
 .../src/vgg16_imagenet_loop.cpp               | 15 ++++++-------
 2 files changed, 29 insertions(+), 7 deletions(-)
 create mode 100644 llvm/test/VISC/DNN_Benchmarks/benchmarks/vgg16_imagenet/data/tuner_confs_base.txt

diff --git a/llvm/test/VISC/DNN_Benchmarks/benchmarks/vgg16_imagenet/data/tuner_confs_base.txt b/llvm/test/VISC/DNN_Benchmarks/benchmarks/vgg16_imagenet/data/tuner_confs_base.txt
new file mode 100644
index 0000000000..cf93cd1286
--- /dev/null
+++ b/llvm/test/VISC/DNN_Benchmarks/benchmarks/vgg16_imagenet/data/tuner_confs_base.txt
@@ -0,0 +1,21 @@
+19194.623482
++++++
+conf1 1 1 72.84 0.0
+1 gpu conv fp32 11 add fp32 1 relu fp32 1
+2 gpu conv fp32 11 add fp32 1 relu fp32 1 pool_max fp32 1
+3 gpu conv fp32 11 add fp32 1 relu fp32 1
+4 gpu conv fp32 11 add fp32 1 relu fp32 1 pool_max fp32 1
+5 gpu conv fp32 11 add fp32 1 relu fp32 1
+6 gpu conv fp32 11 add fp32 1 relu fp32 1
+7 gpu conv fp32 11 add fp32 1 relu fp32 1 pool_max fp32 1
+8 gpu conv fp32 11 add fp32 1 relu fp32 1
+9 gpu conv fp32 11 add fp32 1 relu fp32 1
+10 gpu conv fp32 11 add fp32 1 relu fp32 1 pool_max fp32 1
+11 gpu conv fp32 11 add fp32 1 relu fp32 1
+12 gpu conv fp32 11 add fp32 1 relu fp32 1
+13 gpu conv fp32 11 add fp32 1 relu fp32 1 pool_max fp32 1
+14 gpu mul fp32 11 add fp32 1 relu fp32 1
+15 gpu mul fp32 11 add fp32 1 relu fp32 1
+16 gpu mul fp32 11 add fp32 1
+17 gpu softmax fp32 1
+-----
diff --git a/llvm/test/VISC/DNN_Benchmarks/benchmarks/vgg16_imagenet/src/vgg16_imagenet_loop.cpp b/llvm/test/VISC/DNN_Benchmarks/benchmarks/vgg16_imagenet/src/vgg16_imagenet_loop.cpp
index 164eba72ad..44f46b96af 100644
--- a/llvm/test/VISC/DNN_Benchmarks/benchmarks/vgg16_imagenet/src/vgg16_imagenet_loop.cpp
+++ b/llvm/test/VISC/DNN_Benchmarks/benchmarks/vgg16_imagenet/src/vgg16_imagenet_loop.cpp
@@ -1027,7 +1027,7 @@ int main(){
   startMemTracking();
   startProfiling();
 
-  unsigned int batch_size = 100;
+  unsigned int batch_size = 20;
   unsigned int test_input_size = 500;  
   unsigned int batch_count = test_input_size / batch_size;
 
@@ -1037,11 +1037,10 @@ int main(){
   
       int start = i * batch_size; 
       int end = (i + 1) * batch_size; 
-
       
       void* input = readInputBatch(input_path.c_str(), 0,
-                       start, end,
-                       3, 224, 224);
+				   start, end,
+				   3, 224, 224);
 
       args->input = input; 
       args->input_bytes = 0; 
@@ -1053,9 +1052,7 @@ int main(){
       void *result = static_cast<RootIn*>(args)->input; 
       hpvm_request_tensor(result, 0); 
 
-      __visc__cleanup(); 
-
-
+      
       llvm_hpvm_invokeRtControl(result, labels_path.c_str(), start, end);
         
       freeBatchMemory();
@@ -1064,5 +1061,9 @@ int main(){
   }
   
 
+  stopProfiling();
+  __visc__cleanup(); 
+
+
   return 0; 
 } 
-- 
GitLab