-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AMDGPU] Simplify S_WAIT_XCNT insertion. NFC. #145682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -302,12 +302,8 @@ class WaitcntBrackets { | |
} | ||
|
||
unsigned getSgprScoresIdx(InstCounterType T) const { | ||
if (T == SmemAccessCounter) | ||
return 0; | ||
if (T == X_CNT) | ||
return 1; | ||
|
||
llvm_unreachable("Invalid SMEM counter"); | ||
assert(isSmemCounter(T) && "Invalid SMEM counter"); | ||
return T == X_CNT ? 1 : 0; | ||
} | ||
|
||
unsigned getScoreLB(InstCounterType T) const { | ||
|
@@ -325,10 +321,8 @@ class WaitcntBrackets { | |
} | ||
|
||
unsigned getRegScore(int GprNo, InstCounterType T) const { | ||
if (GprNo < NUM_ALL_VGPRS) { | ||
if (GprNo < NUM_ALL_VGPRS) | ||
return VgprScores[T][GprNo]; | ||
} | ||
assert(isSmemCounter(T)); | ||
return SgprScores[getSgprScoresIdx(T)][GprNo - NUM_ALL_VGPRS]; | ||
} | ||
|
||
|
@@ -866,7 +860,6 @@ void WaitcntBrackets::setScoreByInterval(RegInterval Interval, | |
VgprUB = std::max(VgprUB, RegNo); | ||
VgprScores[CntTy][RegNo] = Score; | ||
} else { | ||
assert(isSmemCounter(CntTy)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed because |
||
SgprUB = std::max(SgprUB, RegNo - NUM_ALL_VGPRS); | ||
SgprScores[getSgprScoresIdx(CntTy)][RegNo - NUM_ALL_VGPRS] = Score; | ||
} | ||
|
@@ -1006,12 +999,8 @@ void WaitcntBrackets::updateByEvent(const SIInstrInfo *TII, | |
} | ||
} | ||
} else if (T == X_CNT) { | ||
for (const MachineOperand &Op : Inst.all_uses()) { | ||
RegInterval Interval = getRegInterval(&Inst, MRI, TRI, Op); | ||
for (int RegNo = Interval.first; RegNo < Interval.second; ++RegNo) { | ||
setRegScore(RegNo, T, CurrScore); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Calling setRegScore in a loop over an interval was silly, because setRegScore just calls setScoreByInterval with an interval of size 1. |
||
} | ||
} | ||
for (const MachineOperand &Op : Inst.all_uses()) | ||
setScoreByOperand(&Inst, TRI, MRI, Op, T, CurrScore); | ||
} else /* LGKM_CNT || EXP_CNT || VS_CNT || NUM_INST_CNTS */ { | ||
// Match the score to the destination registers. | ||
// | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed because
getSgprScoresIdx
asserts anyway