Skip to content

Commit c85c16e

Browse files
author
Martien de Jong
committed
[AIE] Add a loopclass to pinpoint a postpipeliner candidate
1 parent 8b335be commit c85c16e

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

llvm/lib/Target/AIE/AIEBasePipelinerLoopInfo.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include "AIEBasePipelinerLoopInfo.h"
1616
#include "AIEBaseInstrInfo.h"
17+
#include "AIELoopClass.h"
18+
#include "AIESlotStatistics.h"
1719
#include "Utils/AIELoopUtils.h"
1820
#include "llvm/ADT/SmallVector.h"
1921
#include "llvm/CodeGen/MachineBasicBlock.h"
@@ -751,6 +753,19 @@ bool ZeroOverheadLoop::preferPostPipeliner(SMSchedule &SMS) {
751753
return false;
752754
}
753755

756+
AIE::SlotStatistics Stats = AIE::computeSlotStatistics(*LoopBlock, &TII);
757+
int LoopClass = classifyLoop(Stats);
758+
LLVM_DEBUG(dbgs() << "Stats="; Stats.dumpShort();
759+
dbgs() << format("\nLoopClass=%d", LoopClass));
760+
switch (LoopClass) {
761+
case 1000:
762+
LLVM_DEBUG(dbgs() << format("PLI: Leaving loopclass %d for PostPipeliner\n",
763+
LoopClass));
764+
return true;
765+
default:
766+
break;
767+
}
768+
754769
unsigned NS = SMS.getMaxStageCount() + 1;
755770
int II = SMS.getInitiationInterval();
756771
if (NS > LoopMaxStageCount && II < PostPipelinerCutoff) {
@@ -853,7 +868,6 @@ createAIEBasePipelinerLoopInfo(MachineInstr *EndLoop,
853868
const AIEBaseInstrInfo &TII) {
854869
LLVM_DEBUG(dbgs() << "PLI: ----START LOOP----\n");
855870
LLVM_DEBUG(dbgs() << " Trying DownCountLoop\n");
856-
857871
DownCountLoop DCL(EndLoop, TII);
858872
auto Outcome = DCL.accept(EndLoop);
859873
if (Outcome == AIEBasePipelinerLoopInfo::Assessment::Accept) {

llvm/lib/Target/AIE/AIELoopClass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ static const KernelFeatures Kernels[] = {
7878
{45, {{900, 300, 0, 2520, 0, 0, 3360}, {45, 45, 0, 45, 45}}},
7979
{46, {{0, 0, 0, 0, 2160, 0, 120, 1080}, {0, 420, 420}}},
8080
{47, {{0, 0, 0, 0, 360, 0, 240, 360}, {0, 60, 60}}},
81+
// These are pre-regalloc
82+
{1000, {{0, 0, 0, 0, 480, 0, 480, 480}, {0, 120, 120}}},
83+
{1001, {{0, 0, 0, 0, 360, 0, 480, 720}, {0, 60, 60}}},
84+
8185
};
8286

8387
std::vector<int> getLoopClassScores(const SlotStatistics &Stats) {

0 commit comments

Comments
 (0)