Skip to content

Commit

Permalink
[AMDGPU] Remove WaitcntBrackets::MixedPendingEvents[]. NFC.
Browse files Browse the repository at this point in the history
It's trivial to derive this information from other state.
  • Loading branch information
jayfoad committed Apr 29, 2020
1 parent 1205720 commit 31c09d0
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
Expand Up @@ -264,6 +264,13 @@ class WaitcntBrackets {
return PendingEvents & (1 << E);
}

bool hasMixedPendingEvents(InstCounterType T) const {
return false;
uint32_t Events = PendingEvents & WaitEventMaskForInst[T];
// Return true if more than one bit is set in Events.
return Events & (Events - 1);
}

bool hasPendingFlat() const {
return ((LastFlat[LGKM_CNT] > ScoreLBs[LGKM_CNT] &&
LastFlat[LGKM_CNT] <= ScoreUBs[LGKM_CNT]) ||
Expand Down Expand Up @@ -323,7 +330,6 @@ class WaitcntBrackets {
uint32_t ScoreLBs[NUM_INST_CNTS] = {0};
uint32_t ScoreUBs[NUM_INST_CNTS] = {0};
uint32_t PendingEvents = 0;
bool MixedPendingEvents[NUM_INST_CNTS] = {false};
// Remember the last flat memory operation.
uint32_t LastFlat[NUM_INST_CNTS] = {0};
// wait_cnt scores for every vgpr.
Expand Down Expand Up @@ -492,11 +498,7 @@ void WaitcntBrackets::updateByEvent(const SIInstrInfo *TII,
// PendingEvents and ScoreUB need to be update regardless if this event
// changes the score of a register or not.
// Examples including vm_cnt when buffer-store or lgkm_cnt when send-message.
if (!hasPendingEvent(E)) {
if (PendingEvents & WaitEventMaskForInst[T])
MixedPendingEvents[T] = true;
PendingEvents |= 1 << E;
}
PendingEvents |= 1 << E;
setScoreUB(T, CurrScore);

if (T == EXP_CNT) {
Expand Down Expand Up @@ -744,7 +746,6 @@ void WaitcntBrackets::applyWaitcnt(InstCounterType T, unsigned Count) {
setScoreLB(T, std::max(getScoreLB(T), UB - Count));
} else {
setScoreLB(T, UB);
MixedPendingEvents[T] = false;
PendingEvents &= ~WaitEventMaskForInst[T];
}
}
Expand All @@ -755,7 +756,7 @@ bool WaitcntBrackets::counterOutOfOrder(InstCounterType T) const {
// Scalar memory read always can go out of order.
if (T == LGKM_CNT && hasPendingEvent(SMEM_ACCESS))
return true;
return MixedPendingEvents[T];
return hasMixedPendingEvents(T);
}

INITIALIZE_PASS_BEGIN(SIInsertWaitcnts, DEBUG_TYPE, "SI Insert Waitcnts", false,
Expand Down Expand Up @@ -1291,9 +1292,6 @@ bool WaitcntBrackets::merge(const WaitcntBrackets &Other) {
const uint32_t OtherEvents = Other.PendingEvents & WaitEventMaskForInst[T];
if (OtherEvents & ~OldEvents)
StrictDom = true;
if (Other.MixedPendingEvents[T] ||
(OldEvents && OtherEvents && OldEvents != OtherEvents))
MixedPendingEvents[T] = true;
PendingEvents |= OtherEvents;

// Merge scores for this counter
Expand Down

0 comments on commit 31c09d0

Please sign in to comment.