@@ -459,9 +459,7 @@ class RegisterPressureTracker {
459
459
if (!I)
460
460
return V;
461
461
462
- bool IsAddrSpaceCast = isa<AddrSpaceCastInst>(I);
463
-
464
- if (isNoOpInst (I, CTX) || IsAddrSpaceCast) {
462
+ if (isNoOpInst (I, CTX)) {
465
463
return getRealOp (I->getOperand (0 ));
466
464
}
467
465
return V;
@@ -570,10 +568,7 @@ class RegisterPressureTracker {
570
568
}
571
569
572
570
int32_t estimateOrUpdateImpl (Instruction *I, bool Update) {
573
- auto *Intr = dyn_cast<GenIntrinsicInst>(I);
574
- bool IsNoOpIntr = Intr && (Intr->getIntrinsicID () == GenISAIntrinsic::GenISA_ptr_to_pair);
575
-
576
- if (IGCLLVM::isDebugOrPseudoInst (*I) || I->isLifetimeStartOrEnd () || isNoOpInst (I, CTX) || IsNoOpIntr) {
571
+ if (IGCLLVM::isDebugOrPseudoInst (*I) || I->isLifetimeStartOrEnd () || isNoOpInst (I, CTX)) {
577
572
// NoOp instructions do not change register pressure
578
573
if (Update)
579
574
PrintDumpLevel (VerbosityLevel::High, " NoOp instruction: " << getName (I) << " \n " );
@@ -998,20 +993,8 @@ class BBScheduler {
998
993
999
994
int32_t MaxOriginalRegpressure = 0 ;
1000
995
bool OriginalScheduleCanHaveSpills = false ;
1001
-
1002
- PrintDump (" Original schedule: " << BBName << " \n " );
1003
996
for (auto &I : *BB) {
1004
- std::string Info;
1005
- if (isa<PHINode>(&I)) {
1006
- // PHIs are already included in the initial regpressure
1007
- Info = formatDebugInfo (RPT.getCurrentPressure (), 0 , " Phi" , getVectorShuffleString (&I, VSA, RCA));
1008
- } else {
1009
- int32_t Estimate = RPT.update (&I);
1010
- Info = formatDebugInfo (RPT.getCurrentPressure (), Estimate, " OG" , getVectorShuffleString (&I, VSA, RCA));
1011
- }
1012
- PrintDump (Info);
1013
- PrintInstructionDump (&I);
1014
-
997
+ RPT.update (&I);
1015
998
MaxOriginalRegpressure = std::max (MaxOriginalRegpressure, RPT.getCurrentPressure ());
1016
999
if (RPT.isRegpressureCritical ()) {
1017
1000
OriginalScheduleCanHaveSpills = true ;
@@ -1219,45 +1202,6 @@ class BBScheduler {
1219
1202
SchedulingConfig &C;
1220
1203
llvm::raw_ostream *LogStream;
1221
1204
1222
- // Helper function to format debug information string
1223
- static std::string formatDebugInfo (int32_t CurrentPressure, int32_t Estimate, const std::string Type,
1224
- const std::string AddString = " " ) {
1225
- const int ESTIMATION_NUMBERS_WIDTH = 12 ;
1226
- const int INFO_WIDTH = 20 ;
1227
- std::string Info = std::to_string (CurrentPressure) + " , " + std::to_string (Estimate);
1228
- Info.resize (ESTIMATION_NUMBERS_WIDTH, ' ' );
1229
- Info = " (" + Info + " ) " + Type + " : " ;
1230
- Info.resize (INFO_WIDTH, ' ' );
1231
-
1232
- if (!AddString.empty ()) {
1233
- Info += AddString;
1234
- }
1235
-
1236
- return Info;
1237
- }
1238
-
1239
- // Helper function to get vector shuffle string
1240
- static std::string getVectorShuffleString (Instruction *I, VectorShuffleAnalysis *VSA, RematChainsAnalysis *RCA) {
1241
- auto *DT = VSA->getDestVector (I);
1242
- auto *V2SP = VSA->getVectorToScalarsPattern (I);
1243
- auto *RCP = RCA->getRematChainPattern (I);
1244
-
1245
- std::string VS_String = " " ;
1246
- if (RCP) {
1247
- VS_String = " REM " ;
1248
- } else if (DT && DT->isNoOp ()) {
1249
- VS_String = " NOP " ;
1250
- } else if (DT && DT->isVectorShuffle ()) {
1251
- VS_String = " VS " ;
1252
- } else if (DT && !DT->isVectorShuffle ()) {
1253
- VS_String = " SCA " ;
1254
- } else if (V2SP) {
1255
- VS_String = " V2S " ;
1256
- }
1257
-
1258
- return VS_String;
1259
- }
1260
-
1261
1205
class InstructionNode {
1262
1206
public:
1263
1207
InstructionNode (Instruction *I, uint32_t N) : I(I), OriginalPosition(N) {
@@ -1278,9 +1222,8 @@ class BBScheduler {
1278
1222
1279
1223
void print (llvm::raw_ostream &LogStream) {
1280
1224
if (IGC_IS_FLAG_ENABLED (DumpCodeScheduling)) {
1281
- const int INFO_WIDTH = 16 ;
1282
- std::string Info = " #" + std::to_string (OriginalPosition) + " , MW: " + std::to_string (MaxWeight) + " " ;
1283
- Info.resize (INFO_WIDTH, ' ' );
1225
+ std::string Info = " Node #" + std::to_string (OriginalPosition) + " , MW: " + std::to_string (MaxWeight) + " " ;
1226
+ Info.resize (23 , ' ' );
1284
1227
LogStream << Info;
1285
1228
I->print (LogStream);
1286
1229
LogStream << " \n " ;
@@ -2392,8 +2335,31 @@ class BBScheduler {
2392
2335
}
2393
2336
}
2394
2337
2395
- std::string Info = formatDebugInfo (
2396
- RT.getCurrentPressure (), RT.estimate (Node->I ), " Im" , getVectorShuffleString (Node->I , VSA, RCA));
2338
+ std::string Info = std::to_string (RT.getCurrentPressure ()) + " , " + std::to_string (RT.estimate (Node->I ));
2339
+ Info.resize (11 , ' ' );
2340
+ Info = " (" + Info + " ) Im: " ;
2341
+ Info.resize (20 , ' ' );
2342
+
2343
+ auto *V2SP = VSA->getVectorToScalarsPattern (Node->I );
2344
+ auto *RCP = RCA->getRematChainPattern (Node->I );
2345
+
2346
+ if (RCP) {
2347
+ VS_String = " REM" ;
2348
+ }
2349
+ if (DT && DT->isVectorShuffle ()) {
2350
+ VS_String = " VS " ;
2351
+ }
2352
+ if (DT && !DT->isVectorShuffle ()) {
2353
+ VS_String = " SCA" ;
2354
+ }
2355
+ if (DT && DT->isNoOp ()) {
2356
+ VS_String = " NOP" ;
2357
+ }
2358
+ if (V2SP) {
2359
+ VS_String = " V2S" ;
2360
+ }
2361
+
2362
+ Info += VS_String + " " ;
2397
2363
2398
2364
PrintDump (Info);
2399
2365
Node->print (*LogStream);
@@ -2510,11 +2476,27 @@ class BBScheduler {
2510
2476
AllInstructionsScheduledByRP = false ;
2511
2477
}
2512
2478
2513
- std::string ChoosingMode = ChooseByRP ? " RP" : " MW" ;
2514
- ChoosingMode += CanClone ? " *" : " " ;
2515
- std::string Info = formatDebugInfo (RT.getCurrentPressure (), RT.estimate (Node->I ),
2516
- ChoosingMode,
2517
- getVectorShuffleString (Node->I , VSA, RCA));
2479
+ // Dump the info
2480
+ std::string Info = std::to_string (RT.getCurrentPressure ()) + " , " + std::to_string (RT.estimate (Node->I ));
2481
+ Info.resize (11 , ' ' );
2482
+ Info = " (" + Info + " ) " + (ChooseByRP ? " RP" : " MW" ) + " : " ;
2483
+ Info.resize (20 , ' ' );
2484
+
2485
+ auto *DT = VSA->getDestVector (Node->I );
2486
+
2487
+ std::string VS_String = " " ;
2488
+ if (DT && DT->isVectorShuffle ()) {
2489
+ VS_String = " VS " ;
2490
+ }
2491
+ if (DT && !DT->isVectorShuffle ()) {
2492
+ VS_String = " SCA" ;
2493
+ }
2494
+ if (DT && DT->isNoOp ()) {
2495
+ VS_String = " NOP" ;
2496
+ }
2497
+
2498
+ Info += VS_String + (CanClone ? " * " : " " );
2499
+
2518
2500
PrintDump (Info);
2519
2501
Node->print (*LogStream);
2520
2502
0 commit comments