performance improvement of throughput summation

This commit is contained in:
Julian Hammer
2020-11-09 12:01:00 +01:00
parent 94086033a8
commit 2fb36406a7

View File

@@ -416,9 +416,8 @@ class ArchSemantics(ISASemantics):
@staticmethod
def get_throughput_sum(kernel):
"""Get the overall throughput sum separated by port of all instructions of a kernel."""
tp_sum = reduce(
(lambda x, y: [sum(z) for z in zip(x, y)]),
[instr['port_pressure'] for instr in kernel],
)
tp_sum = [round(x, 2) for x in tp_sum]
port_pressures = [instr['port_pressure'] for instr in kernel]
# Essentially summing up each columns of port_pressures, where each column is one port
# round is necessary to ensure termination of ArchsSemantics.assign_optimal_throughput
tp_sum = [round(sum(col), 2) for col in zip(*port_pressures)]
return tp_sum