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 7c85f2adb487144927da142d0e96cc50a7ec504b..ff0f9b37c0f51ed8461e8b226660bde9b27de729 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()