Skip to content

Commit 87662ff

Browse files
committed
[AMDGPU] Rmove unnecssary RecedeCycle.
1 parent 6061486 commit 87662ff

File tree

2 files changed

+3
-72
lines changed

2 files changed

+3
-72
lines changed

llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp

Lines changed: 3 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -280,39 +280,6 @@ void GCNHazardRecognizer::processBundle() {
280280
CurrCycleInstr = nullptr;
281281
}
282282

283-
void GCNHazardRecognizer::processBundleBottomUp() {
284-
// Walk through the instructions in this bundle in bottom-up order.
285-
// We only use this during post-RA scheduling, so hazard recognizer mode
286-
// should never be active here (it always runs top-down).
287-
assert(!IsHazardRecognizerMode &&
288-
"Bottom-up scheduling shouldn't run in hazard recognizer mode");
289-
290-
// Step through each instruction in the bundle in bottom-up order.
291-
MachineBasicBlock::instr_iterator MI =
292-
std::next(CurrCycleInstr->getIterator());
293-
MachineBasicBlock::instr_iterator E =
294-
CurrCycleInstr->getParent()->instr_end();
295-
296-
// Evict stale entries to maintain a fixed lookahead window.
297-
// TODO: Hazard detection is not yet implemented. This scheduling
298-
// is intended for GFX11 and newer.
299-
for (; MI != E && MI->isInsideBundle(); ++MI) {
300-
CurrCycleInstr = &*MI;
301-
302-
// Remove up to (MaxLookAhead - 1) oldest entries.
303-
for (unsigned I = 0, E = MaxLookAhead - 1; I < E && !EmittedInstrs.empty();
304-
++I)
305-
EmittedInstrs.pop_back();
306-
307-
EmittedInstrs.push_back(CurrCycleInstr);
308-
309-
// Keep only the most recent MaxLookAhead entries
310-
EmittedInstrs.resize(MaxLookAhead);
311-
}
312-
313-
CurrCycleInstr = nullptr;
314-
}
315-
316283
void GCNHazardRecognizer::runOnInstruction(MachineInstr *MI) {
317284
assert(IsHazardRecognizerMode);
318285

@@ -450,41 +417,9 @@ void GCNHazardRecognizer::AdvanceCycle() {
450417
}
451418

452419
void GCNHazardRecognizer::RecedeCycle() {
453-
// If no instruction was issued this cycle, pop the oldest placeholder.
454-
if (!CurrCycleInstr) {
455-
if (!EmittedInstrs.empty())
456-
EmittedInstrs.pop_back();
457-
return;
458-
}
459-
460-
// If this is a bundle header, handle the entire bundle here.
461-
if (CurrCycleInstr->isBundle()) {
462-
processBundleBottomUp();
463-
return;
464-
}
465-
466-
unsigned NumWaitStates = TII.getNumWaitStates(*CurrCycleInstr);
467-
if (!NumWaitStates) {
468-
CurrCycleInstr = nullptr;
469-
return;
470-
}
471-
472-
// Add current instruction to the emitted list.
473-
EmittedInstrs.push_back(CurrCycleInstr);
474-
475-
// Model remaining wait states by removing older placeholders.
476-
for (unsigned I = 1, E = std::min(NumWaitStates, getMaxLookAhead()); I < E;
477-
++I) {
478-
if (!EmittedInstrs.empty())
479-
EmittedInstrs.pop_back();
480-
}
481-
482-
// getMaxLookahead() is the largest number of wait states we will ever need
483-
// to insert, so there is no point in keeping track of more than that many
484-
// wait states.
485-
EmittedInstrs.resize(getMaxLookAhead());
486-
487-
CurrCycleInstr = nullptr;
420+
if (IsHazardRecognizerMode || ST.getGeneration() < AMDGPUSubtarget::GFX11)
421+
llvm_unreachable(
422+
"hazard recognizer does not support bottom-up scheduling.");
488423
}
489424

490425
//===----------------------------------------------------------------------===//

llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ class GCNHazardRecognizer final : public ScheduleHazardRecognizer {
6969
// Advance over a MachineInstr bundle. Look for hazards in the bundled
7070
// instructions.
7171
void processBundle();
72-
// Recede over a MachineInstr bundle. Adds bundled instructions to the
73-
// EmittedInstrs queue in bottom-up scheduling mode.
74-
// TODO: Hazard detection is not yet implemented.
75-
void processBundleBottomUp();
7672

7773
// Run on an individual instruction in hazard recognizer mode. This can be
7874
// used on a newly inserted instruction before returning from PreEmitNoops.

0 commit comments

Comments
 (0)