R600: Factorize Fetch size limit inside AMDGPUSubTarget

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182122 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vincent Lejeune 2013-05-17 16:49:55 +00:00
parent 9a9e936650
commit dcfcf1d1ff
4 changed files with 13 additions and 13 deletions

View File

@ -37,6 +37,7 @@ AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS) :
ParseSubtargetFeatures(GPU, FS); ParseSubtargetFeatures(GPU, FS);
DevName = GPU; DevName = GPU;
Device = AMDGPUDeviceInfo::getDeviceFromName(DevName, this, Is64bit); Device = AMDGPUDeviceInfo::getDeviceFromName(DevName, this, Is64bit);
TexVTXClauseSize = (Device->getGeneration() >= AMDGPUDeviceInfo::HD4XXX)?16:8;
} }
AMDGPUSubtarget::~AMDGPUSubtarget() { AMDGPUSubtarget::~AMDGPUSubtarget() {
@ -57,6 +58,10 @@ bool
AMDGPUSubtarget::hasVertexCache() const { AMDGPUSubtarget::hasVertexCache() const {
return HasVertexCache; return HasVertexCache;
} }
short
AMDGPUSubtarget::getTexVTXClauseSize() const {
return TexVTXClauseSize;
}
bool bool
AMDGPUSubtarget::isTargetELF() const { AMDGPUSubtarget::isTargetELF() const {
return false; return false;

View File

@ -37,6 +37,7 @@ private:
bool DumpCode; bool DumpCode;
bool R600ALUInst; bool R600ALUInst;
bool HasVertexCache; bool HasVertexCache;
short TexVTXClauseSize;
InstrItineraryData InstrItins; InstrItineraryData InstrItins;
@ -50,6 +51,7 @@ public:
bool isOverride(AMDGPUDeviceInfo::Caps) const; bool isOverride(AMDGPUDeviceInfo::Caps) const;
bool is64bit() const; bool is64bit() const;
bool hasVertexCache() const; bool hasVertexCache() const;
short getTexVTXClauseSize() const;
// Helper functions to simplify if statements // Helper functions to simplify if statements
bool isTargetELF() const; bool isTargetELF() const;

View File

@ -148,7 +148,7 @@ private:
for (MachineBasicBlock::iterator E = MBB.end(); I != E; ++I) { for (MachineBasicBlock::iterator E = MBB.end(); I != E; ++I) {
if (IsTrivialInst(I)) if (IsTrivialInst(I))
continue; continue;
if (AluInstCount > MaxFetchInst) if (AluInstCount >= MaxFetchInst)
break; break;
if ((IsTex && !TII->usesTextureCache(I)) || if ((IsTex && !TII->usesTextureCache(I)) ||
(!IsTex && !TII->usesVertexCache(I))) (!IsTex && !TII->usesVertexCache(I)))
@ -316,10 +316,7 @@ public:
TRI(TII->getRegisterInfo()), TRI(TII->getRegisterInfo()),
ST(tm.getSubtarget<AMDGPUSubtarget>()) { ST(tm.getSubtarget<AMDGPUSubtarget>()) {
const AMDGPUSubtarget &ST = tm.getSubtarget<AMDGPUSubtarget>(); const AMDGPUSubtarget &ST = tm.getSubtarget<AMDGPUSubtarget>();
if (ST.device()->getGeneration() <= AMDGPUDeviceInfo::HD4XXX) MaxFetchInst = ST.getTexVTXClauseSize();
MaxFetchInst = 8;
else
MaxFetchInst = 16;
} }
virtual bool runOnMachineFunction(MachineFunction &MF) { virtual bool runOnMachineFunction(MachineFunction &MF) {

View File

@ -41,11 +41,7 @@ void R600SchedStrategy::initialize(ScheduleDAGMI *dag) {
const AMDGPUSubtarget &ST = DAG->TM.getSubtarget<AMDGPUSubtarget>(); const AMDGPUSubtarget &ST = DAG->TM.getSubtarget<AMDGPUSubtarget>();
if (ST.device()->getGeneration() <= AMDGPUDeviceInfo::HD5XXX) { InstKindLimit[IDFetch] = ST.getTexVTXClauseSize();
InstKindLimit[IDFetch] = 7; // 8 minus 1 for security
} else {
InstKindLimit[IDFetch] = 15; // 16 minus 1 for security
}
} }
void R600SchedStrategy::MoveUnits(ReadyQueue *QSrc, ReadyQueue *QDst) void R600SchedStrategy::MoveUnits(ReadyQueue *QSrc, ReadyQueue *QDst)
@ -67,9 +63,9 @@ SUnit* R600SchedStrategy::pickNode(bool &IsTopNode) {
// check if we might want to switch current clause type // check if we might want to switch current clause type
bool AllowSwitchToAlu = (CurInstKind == IDOther) || bool AllowSwitchToAlu = (CurInstKind == IDOther) ||
(CurEmitted > InstKindLimit[CurInstKind]) || (CurEmitted >= InstKindLimit[CurInstKind]) ||
(Available[CurInstKind]->empty()); (Available[CurInstKind]->empty());
bool AllowSwitchFromAlu = (CurEmitted > InstKindLimit[CurInstKind]) && bool AllowSwitchFromAlu = (CurEmitted >= InstKindLimit[CurInstKind]) &&
(!Available[IDFetch]->empty() || !Available[IDOther]->empty()); (!Available[IDFetch]->empty() || !Available[IDOther]->empty());
if ((AllowSwitchToAlu && CurInstKind != IDAlu) || if ((AllowSwitchToAlu && CurInstKind != IDAlu) ||
@ -77,7 +73,7 @@ SUnit* R600SchedStrategy::pickNode(bool &IsTopNode) {
// try to pick ALU // try to pick ALU
SU = pickAlu(); SU = pickAlu();
if (SU) { if (SU) {
if (CurEmitted > InstKindLimit[IDAlu]) if (CurEmitted >= InstKindLimit[IDAlu])
CurEmitted = 0; CurEmitted = 0;
NextInstKind = IDAlu; NextInstKind = IDAlu;
} }