12
12
import analyze
13
13
from analyze import Logs , Block
14
14
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
-
21
15
22
16
class BlockProcessingError (Exception ):
23
17
block : Block
@@ -38,20 +32,10 @@ class DagInfo:
38
32
relative_cost : int
39
33
length : int
40
34
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
44
35
45
36
@property
46
37
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
55
39
56
40
57
41
class MismatchKind (Enum ):
@@ -155,12 +139,9 @@ def extract_dag_info(logs: Logs) -> Dict[str, List[List[DagInfo]]]:
155
139
for block in blocks :
156
140
try :
157
141
best_result = try_first (block , 'BestResult' , 'HeuristicResult' )[- 1 ]
158
- best_result_info = try_first (block , 'DagSolvedOptimally' , 'DagTimedOut' , 'HeuristicResult' )[- 1 ]
159
142
is_optimal = best_result .get ('optimal' , False ) or best_result ['cost' ] == 0 or \
160
143
'INFO: Marking SLIL list schedule as optimal due to zero PERP.' in block .raw_log
161
144
162
- target_occ = block .single ('TargetOccupancy' )['target' ] if 'TargetOccupancy' in block else None
163
-
164
145
dags .setdefault (block .name , []).append (DagInfo (
165
146
id = block .name ,
166
147
benchmark = block .benchmark ,
@@ -170,8 +151,6 @@ def extract_dag_info(logs: Logs) -> Dict[str, List[List[DagInfo]]]:
170
151
relative_cost = best_result ['cost' ],
171
152
length = best_result ['length' ],
172
153
is_optimal = is_optimal ,
173
- spill_cost = best_result_info ['spill_cost' ],
174
- target_occupancy = target_occ ,
175
154
))
176
155
except Exception as ex :
177
156
raise BlockProcessingError ('Failed when processing block' , block ) from ex
@@ -370,8 +349,6 @@ def print_small_summary(mismatches: List[Mismatch]):
370
349
371
350
parser .add_argument ('-q' , '--quiet' , action = 'store_true' ,
372
351
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' )
375
352
parser .add_argument ('--no-summarize-largest-cost-difference' , action = 'store_true' ,
376
353
help = 'Do not summarize the mismatches with the biggest difference in cost' )
377
354
parser .add_argument ('--no-summarize-smallest-mismatches' , action = 'store_true' ,
@@ -392,7 +369,6 @@ def print_small_summary(mismatches: List[Mismatch]):
392
369
NUM_SMALLEST_BLOCKS_PRINT = args .num_smallest_mismatches_print
393
370
MISSING_LOWER_BOUND_DUMP_COUNT = args .missing_lb_dump_count
394
371
MISSING_LOWER_BOUND_DUMP_LINES = args .missing_lb_dump_lines
395
- SPILL_COST_WEIGHT = args .spill_cost_weight
396
372
397
373
main (
398
374
args .first , args .second ,
0 commit comments