From 9e890e90129df9e1c7d1da513cb68f765663be71 Mon Sep 17 00:00:00 2001 From: Elizabeth <hashim.sharif91@gmail.com> Date: Tue, 8 Oct 2019 16:49:37 -0500 Subject: [PATCH] Fixed bug in time/energy storage --- .../build_pldi/table_generator.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 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 7c85f2adb4..ff0f9b37c0 100644 --- a/llvm/projects/hpvm-tensor-rt/build_pldi/table_generator.py +++ b/llvm/projects/hpvm-tensor-rt/build_pldi/table_generator.py @@ -126,13 +126,9 @@ class TableGenerator: # Don't need to copy the file over --> can use the original file as a reference soc_operations_file = open(soc_operations_file_name, "r") - table_file = open(self.__table_filename, "w") + table_file = open(table_file_path, "w") - # Read header line to get layer name and # operations in layer - # Get ops in each layer using the dict # TODO possible for operations in the same layer to not have the same # of cols? - # Need to store a list of all 2nd level dict keys we go through! - # at the very end --> then generate the header and write everything in curr_line = soc_operations_file.readline().strip() @@ -140,7 +136,7 @@ class TableGenerator: # First line is always the layers line (#layer_name,num_ops) layer_name, num_ops = self.__parse_layer_info_line(curr_line) print("FIRST LINE", layer_name, num_ops) - + # Get each operation in the layer ops_in_layer = [] header = ["**", layer_name, str(num_ops), "_"] @@ -154,7 +150,7 @@ class TableGenerator: # Iterate through time/energy data for each approx type for approx_type in operation_data: curr_op.append(operation_data[approx_type]["time"]) - curr_op.append(operation_data[approx_type]["time"]) + curr_op.append(operation_data[approx_type]["energy"]) # CRITICAL ASSUMPTION: All ops within a layer have the same # cols # Only fill out the header once for the layer @@ -164,10 +160,9 @@ class TableGenerator: ops_in_layer.append(' '.join(curr_op)) # Getting all operation rows and then writing everything because # calls to write() are slow (memory vs time tradeoff) - #print("%s" % ' '.join(header)) - #print("%s" % '\n'.join(ops_in_layer)) - table_file.write("%s\n" % ' '.join(header)) - table_file.write("%s\n" % '\n'.join(ops_in_layer)) + print("%s" % ' '.join(header)) + print("%s" % '\n'.join(ops_in_layer)) + table_file.write("%s\n%s\n" % (' '.join(header), '\n'.join(ops_in_layer))) curr_line = soc_operations_file.readline().strip() -- GitLab