@@ -39,6 +39,31 @@ enum class BLOCKS_TO_KEEP {
39
39
ALL
40
40
};
41
41
42
+ // Where to perform graph transformations; flag enum
43
+ enum class GT_POSITION : uint32_t {
44
+ NONE = 0x0 ,
45
+ // Run on all blocks before the heuristic
46
+ BEFORE_HEURISTIC = 0x1 ,
47
+ // Run only if the heuristic scheduler doesn't prove the schedule optimal
48
+ AFTER_HEURISTIC = 0x2 ,
49
+ };
50
+
51
+ inline GT_POSITION operator |(GT_POSITION lhs, GT_POSITION rhs) {
52
+ return (GT_POSITION)((uint32_t )lhs | (uint32_t )rhs);
53
+ }
54
+
55
+ inline GT_POSITION operator &(GT_POSITION lhs, GT_POSITION rhs) {
56
+ return (GT_POSITION)((uint32_t )lhs & (uint32_t )rhs);
57
+ }
58
+
59
+ inline GT_POSITION &operator |=(GT_POSITION &lhs, GT_POSITION rhs) {
60
+ return lhs = lhs | rhs;
61
+ }
62
+
63
+ inline GT_POSITION &operator &=(GT_POSITION &lhs, GT_POSITION rhs) {
64
+ return lhs = lhs & rhs;
65
+ }
66
+
42
67
class ListScheduler ;
43
68
44
69
class SchedRegion {
@@ -48,7 +73,8 @@ class SchedRegion {
48
73
int16_t sigHashSize, LB_ALG lbAlg, SchedPriorities hurstcPrirts,
49
74
SchedPriorities enumPrirts, bool vrfySched,
50
75
Pruning PruningStrategy, SchedulerType HeurSchedType,
51
- SPILL_COST_FUNCTION spillCostFunc = SCF_PERP);
76
+ SPILL_COST_FUNCTION spillCostFunc,
77
+ GT_POSITION GraphTransPosition);
52
78
// Destroys the region. Must be overriden by child classes.
53
79
virtual ~SchedRegion () {}
54
80
@@ -205,6 +231,9 @@ class SchedRegion {
205
231
// TODO(max): Document.
206
232
int16_t sigHashSize_;
207
233
234
+ // Where to apply graph transformations
235
+ GT_POSITION GraphTransPosition_;
236
+
208
237
// The pruning technique to use for this region.
209
238
Pruning prune_;
210
239
@@ -224,6 +253,11 @@ class SchedRegion {
224
253
// The best schedule found so far (may be heuristic or enumerator generated)
225
254
InstSchedule *bestSched_;
226
255
256
+ void CalculateUpperBounds (bool BbSchedulerEnabled);
257
+ void CalculateLowerBounds (bool BbSchedulerEnabled);
258
+
259
+ bool IsLowerBoundSet_ = false ;
260
+ bool IsUpperBoundSet_ = false ;
227
261
// TODO(max): Document.
228
262
InstCount schedLwrBound_;
229
263
// TODO(max): Document.
@@ -244,6 +278,8 @@ class SchedRegion {
244
278
// TODO(max): Document.
245
279
InstCount crntSlotNum_;
246
280
281
+ bool needsTransitiveClosure (Milliseconds rgnTimeout) const ;
282
+
247
283
// protected accessors:
248
284
SchedulerType GetHeuristicSchedulerType () const { return HeurSchedType_; }
249
285
@@ -324,6 +360,13 @@ class SchedRegion {
324
360
325
361
FUNC_RESULT runACO (InstSchedule *ReturnSched, InstSchedule *InitSched,
326
362
bool IsPostBB);
363
+
364
+ FUNC_RESULT applyGraphTransformations (bool BbScheduleEnabled,
365
+ InstSchedule *heuristicSched,
366
+ bool &isLstOptml,
367
+ InstSchedule *&bestSched);
368
+ FUNC_RESULT applyGraphTransformation (GraphTrans *GT);
369
+ void updateBoundsAfterGraphTransformations (bool BbSchedulerEnabled);
327
370
};
328
371
329
372
} // namespace opt_sched
0 commit comments