def __init__(self, summaries: sample_summary_pb2.SampleSummariesProto): self.summaries = summaries self._ops = {} self._ops_types = {} self.max_bits_type_width = 0 self.max_aggregate_type_width = 0 # Gather aggregate information about the number of nodes of each type and # the maximum bit widths. for summary in self.summaries.samples: # Only count the ops before optimization because we are testing the fuzzer # coverage not the optimizer. for node in summary.unoptimized_nodes: self._ops[node.op] = self._ops.get(node.op, 0) + 1 self._ops_types[(node.op, node.type)] = self._ops_types.get( (node.op, node.type), 0) + 1 if node.type == 'bits': self.max_bits_type_width = max(self.max_bits_type_width, node.width) else: self.max_aggregate_type_width = max( self.max_aggregate_type_width, node.width) # Compute aggregate timing information for each field in SampleTimingProto. self.aggregate_timing = sample_summary_pb2.SampleTimingProto() for summary in self.summaries.samples: for field_desc, value in summary.timing.ListFields(): setattr( self.aggregate_timing, field_desc.name, getattr(self.aggregate_timing, field_desc.name) + value)
def __init__(self, run_dir: Text): self._run_dir = run_dir self.timing = sample_summary_pb2.SampleTimingProto()