1212import analyze
1313from analyze import Logs , Block
1414
15- # Some reference point to compute occupancies against.
16- # This would ideally be the maximum possible occupancy so that the .cost property will never be negative
17- OCCUPANCY_REFERENCE_POINT = 10
18-
19- SPILL_COST_WEIGHT = 0
20-
2115
2216class BlockProcessingError (Exception ):
2317 block : Block
@@ -38,20 +32,10 @@ class DagInfo:
3832 relative_cost : int
3933 length : int
4034 is_optimal : bool
41- # Spill cost is not absolute for SCF = TARGET. By recording the baseline, we can adjust the costs.
42- target_occupancy : Optional [int ]
43- spill_cost : int
4435
4536 @property
4637 def cost (self ):
47- cost = self .lower_bound + self .relative_cost
48- if self .target_occupancy is not None :
49- # TargetOcc - SC is a "complement"-like operation, meaning that it undoes itself.
50- actual_occupancy = self .target_occupancy - self .spill_cost
51- absolute_spill_cost = OCCUPANCY_REFERENCE_POINT - actual_occupancy
52- cost += SPILL_COST_WEIGHT * absolute_spill_cost
53-
54- return cost
38+ return self .lower_bound + self .relative_cost
5539
5640
5741class MismatchKind (Enum ):
@@ -155,12 +139,9 @@ def extract_dag_info(logs: Logs) -> Dict[str, List[List[DagInfo]]]:
155139 for block in blocks :
156140 try :
157141 best_result = try_first (block , 'BestResult' , 'HeuristicResult' )[- 1 ]
158- best_result_info = try_first (block , 'DagSolvedOptimally' , 'DagTimedOut' , 'HeuristicResult' )[- 1 ]
159142 is_optimal = best_result .get ('optimal' , False ) or best_result ['cost' ] == 0 or \
160143 'INFO: Marking SLIL list schedule as optimal due to zero PERP.' in block .raw_log
161144
162- target_occ = block .single ('TargetOccupancy' )['target' ] if 'TargetOccupancy' in block else None
163-
164145 dags .setdefault (block .name , []).append (DagInfo (
165146 id = block .name ,
166147 benchmark = block .benchmark ,
@@ -170,8 +151,6 @@ def extract_dag_info(logs: Logs) -> Dict[str, List[List[DagInfo]]]:
170151 relative_cost = best_result ['cost' ],
171152 length = best_result ['length' ],
172153 is_optimal = is_optimal ,
173- spill_cost = best_result_info ['spill_cost' ],
174- target_occupancy = target_occ ,
175154 ))
176155 except Exception as ex :
177156 raise BlockProcessingError ('Failed when processing block' , block ) from ex
@@ -370,8 +349,6 @@ def print_small_summary(mismatches: List[Mismatch]):
370349
371350 parser .add_argument ('-q' , '--quiet' , action = 'store_true' ,
372351 help = 'Only print mismatch info, and only if there are mismatches' )
373- parser .add_argument ('--scw' , '--spill-cost-weight' , type = int , required = True ,
374- help = 'The weight of the spill cost in the cost calculation. Only relevant if the reported spill costs are not absolute (e.g. SCF = TARGET); put any value otherwise.' , dest = 'spill_cost_weight' , metavar = 'SCW' )
375352 parser .add_argument ('--no-summarize-largest-cost-difference' , action = 'store_true' ,
376353 help = 'Do not summarize the mismatches with the biggest difference in cost' )
377354 parser .add_argument ('--no-summarize-smallest-mismatches' , action = 'store_true' ,
@@ -392,7 +369,6 @@ def print_small_summary(mismatches: List[Mismatch]):
392369 NUM_SMALLEST_BLOCKS_PRINT = args .num_smallest_mismatches_print
393370 MISSING_LOWER_BOUND_DUMP_COUNT = args .missing_lb_dump_count
394371 MISSING_LOWER_BOUND_DUMP_LINES = args .missing_lb_dump_lines
395- SPILL_COST_WEIGHT = args .spill_cost_weight
396372
397373 main (
398374 args .first , args .second ,
0 commit comments