@@ -453,19 +453,22 @@ struct SchedConfig
453
453
MASK_SETHI_ULLMAN = 1U << 2 ,
454
454
MASK_CLUSTTERING = 1U << 3 ,
455
455
MASK_HOLD_LIST = 1U << 4 ,
456
+ MASK_NOT_ITERATE = 1U << 5 ,
456
457
};
457
458
unsigned Dump : 1 ;
458
459
unsigned UseLatency : 1 ;
459
460
unsigned UseSethiUllman : 1 ;
460
461
unsigned DoClustering : 1 ;
461
462
unsigned UseHoldList : 1 ;
463
+ unsigned DoNotIterate : 1 ; // default 0 i.e. iterative latency-scheduling
462
464
463
465
explicit SchedConfig (unsigned Config)
464
466
: Dump((Config & MASK_DUMP) != 0)
465
467
, UseLatency((Config & MASK_LATENCY) != 0)
466
468
, UseSethiUllman((Config & MASK_SETHI_ULLMAN) != 0)
467
469
, DoClustering((Config & MASK_CLUSTTERING) != 0)
468
470
, UseHoldList((Config & MASK_HOLD_LIST) != 0)
471
+ , DoNotIterate((Config& MASK_NOT_ITERATE) != 0)
469
472
{
470
473
}
471
474
};
@@ -1348,14 +1351,24 @@ class LatencyQueue : public QueueBase {
1348
1351
return pseudoKills.empty () && ReadyList.empty ();
1349
1352
}
1350
1353
1351
- // moving instruction from HoldList to ReadyList
1354
+ // move instruction from HoldList to ReadyList,
1355
+ // also update current-cycle and current-group
1352
1356
void advance (unsigned &CurCycle, unsigned & CurGroup)
1353
1357
{
1354
1358
if (!config.UseHoldList ) {
1355
1359
assert (HoldList.empty ());
1360
+ // tracking cycle and group in this mode is only useful
1361
+ // for understanding the scheduling result
1362
+ if (!ReadyList.empty ()) {
1363
+ preNode* N = ReadyList.top ();
1364
+ CurCycle = std::max (CurCycle, N->getReadyCycle ());
1365
+ if (N->getInst ())
1366
+ CurGroup = std::max (CurGroup, GroupInfo[N->getInst ()]);
1367
+ }
1356
1368
return ;
1357
1369
}
1358
1370
GroupInfo[nullptr ] = CurGroup;
1371
+ // move inst out of hold-list based on current group and cycle
1359
1372
while (!HoldList.empty ()) {
1360
1373
preNode* N = HoldList.top ();
1361
1374
if (GroupInfo[N->getInst ()] <= CurGroup &&
@@ -1366,6 +1379,9 @@ class LatencyQueue : public QueueBase {
1366
1379
else
1367
1380
break ;
1368
1381
}
1382
+ // ready-list is still emtpy, then we need to move forward to
1383
+ // the next group or the next cycle so that some instructions
1384
+ // can come out of the hold-list.
1369
1385
if (ReadyList.empty () && !HoldList.empty ()) {
1370
1386
preNode* N = HoldList.top ();
1371
1387
CurCycle = std::max (CurCycle, N->getReadyCycle ());
@@ -1432,8 +1448,7 @@ bool BB_Scheduler::scheduleBlockForLatency(unsigned& MaxPressure, bool ReassignI
1432
1448
unsigned NumGrfs = kernel.getNumRegTotal ();
1433
1449
float Ratio = NumGrfs / 128 .0f ;
1434
1450
// limit the iterative approach to certain platforms for now
1435
- if (kernel.getOptions ()->getOption (vISA_preRA_ScheduleNoIterative) ||
1436
- kernel.getPlatform () < Xe_DG2 )
1451
+ if (config.DoNotIterate || kernel.getPlatform () < Xe_DG2 )
1437
1452
{
1438
1453
GTMax = GTMin = getLatencyHidingThreshold (kernel);
1439
1454
Ratio = 1 .0f ; // already adjusted inside getLatencyHidingThreshold
0 commit comments