From 276a50e55e8752b50e1e0f0c74f4a548e5910584 Mon Sep 17 00:00:00 2001
From: Elizabeth <hashim.sharif91@gmail.com>
Date: Wed, 9 Oct 2019 17:48:58 -0500
Subject: [PATCH] Added support for command line args

---
 .../build_pldi/table_generator.py             | 23 +++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/llvm/projects/hpvm-tensor-rt/build_pldi/table_generator.py b/llvm/projects/hpvm-tensor-rt/build_pldi/table_generator.py
index 36247ee173..2c57eaf5be 100644
--- a/llvm/projects/hpvm-tensor-rt/build_pldi/table_generator.py
+++ b/llvm/projects/hpvm-tensor-rt/build_pldi/table_generator.py
@@ -2,9 +2,21 @@ import glob
 import os 
 import subprocess
 import shutil 
+import sys
 
 from collections import defaultdict
 
+'''
+FORMAT
+
+** LayerName NumOpsInLayer <cols>
+OpName Col1Val Col2Val ...
+
+** Conv1 1 h2f_time h2f_energy fp32_time fp32_energy f2h_time f2h_energy fp16_perf_time fp16_perf_energy fp16_time fp16_energy
+Conv1 51.8808 97.2844 319.582 601.966 12.81 18.758 388.092 650.649 340.037 590.664
+
+'''
+
 class TableGenerator: 
 
     __ops_header_delimiter = "#"
@@ -53,7 +65,7 @@ class TableGenerator:
         3. Writes the internal table to <network_name>_tensors.txt file and uses the 
         <network_name>_ops.txt file as a guideline in terms of row order 
         '''
-        self.__run_inputted_binaries()
+        #self.__run_inputted_binaries()
         self.__build_internal_table()
         self.__output_table_to_file()
 
@@ -282,8 +294,11 @@ class TableGenerator:
 
 
 if __name__ == "__main__":
-    binary_dir_path = "/home/nvidia/Gitlab/hpvm/llvm/projects/hpvm-tensor-rt/build_pldi/mobilenet"
-    num_iters = 1 
-    profiler_binary_name = "/home/nvidia/awesome_profiler/pp"
+    if len(sys.argv) != 4:
+        print("python table_generator.py <binary dir path> <num itrs> <profiler bin path>")
+        exit(1)
+    binary_dir_path = sys.argv[1]
+    num_iters = int(sys.argv[2]) 
+    profiler_binary_name = sys.argv[3]
     table_gen = TableGenerator(binary_dir_path, num_iters, profiler_binary_name)
     table_gen.generate_table()
-- 
GitLab