LLVM 20.0.0git
Public Types | Public Member Functions | List of all members
llvm::GCNHazardRecognizer Class Referencefinal

#include "Target/AMDGPU/GCNHazardRecognizer.h"

Inheritance diagram for llvm::GCNHazardRecognizer:
Inheritance graph
[legend]

Public Types

typedef function_ref< bool(const MachineInstr &)> IsHazardFn
 
- Public Types inherited from llvm::ScheduleHazardRecognizer
enum  HazardType { NoHazard , Hazard , NoopHazard }
 

Public Member Functions

 GCNHazardRecognizer (const MachineFunction &MF)
 
bool atIssueLimit () const override
 atIssueLimit - Return true if no more instructions may be issued in this cycle.
 
void EmitInstruction (SUnit *SU) override
 EmitInstruction - This callback is invoked when an instruction is emitted, to advance the hazard state.
 
void EmitInstruction (MachineInstr *MI) override
 This overload will be used when the hazard recognizer is being used by a non-scheduling pass, which does not use SUnits.
 
HazardType getHazardType (SUnit *SU, int Stalls) override
 getHazardType - Return the hazard type of emitting this node.
 
void EmitNoop () override
 EmitNoop - This callback is invoked when a noop was added to the instruction stream.
 
unsigned PreEmitNoops (MachineInstr *) override
 This overload will be used when the hazard recognizer is being used by a non-scheduling pass, which does not use SUnits.
 
unsigned PreEmitNoopsCommon (MachineInstr *)
 
void AdvanceCycle () override
 AdvanceCycle - This callback is invoked whenever the next top-down instruction to be scheduled cannot issue in the current cycle, either because of latency or resource conflicts.
 
void RecedeCycle () override
 RecedeCycle - This callback is invoked whenever the next bottom-up instruction to be scheduled cannot issue in the current cycle, either because of latency or resource conflicts.
 
bool ShouldPreferAnother (SUnit *SU) override
 ShouldPreferAnother - This callback may be invoked if getHazardType returns NoHazard.
 
void Reset () override
 Reset - This callback is invoked when a new block of instructions is about to be schedule.
 
- Public Member Functions inherited from llvm::ScheduleHazardRecognizer
 ScheduleHazardRecognizer ()=default
 
virtual ~ScheduleHazardRecognizer ()
 
unsigned getMaxLookAhead () const
 
bool isEnabled () const
 
virtual bool atIssueLimit () const
 atIssueLimit - Return true if no more instructions may be issued in this cycle.
 
virtual HazardType getHazardType (SUnit *, int Stalls=0)
 getHazardType - Return the hazard type of emitting this node.
 
virtual void Reset ()
 Reset - This callback is invoked when a new block of instructions is about to be schedule.
 
virtual void EmitInstruction (SUnit *)
 EmitInstruction - This callback is invoked when an instruction is emitted, to advance the hazard state.
 
virtual void EmitInstruction (MachineInstr *)
 This overload will be used when the hazard recognizer is being used by a non-scheduling pass, which does not use SUnits.
 
virtual unsigned PreEmitNoops (SUnit *)
 PreEmitNoops - This callback is invoked prior to emitting an instruction.
 
virtual unsigned PreEmitNoops (MachineInstr *)
 This overload will be used when the hazard recognizer is being used by a non-scheduling pass, which does not use SUnits.
 
virtual bool ShouldPreferAnother (SUnit *)
 ShouldPreferAnother - This callback may be invoked if getHazardType returns NoHazard.
 
virtual void AdvanceCycle ()
 AdvanceCycle - This callback is invoked whenever the next top-down instruction to be scheduled cannot issue in the current cycle, either because of latency or resource conflicts.
 
virtual void RecedeCycle ()
 RecedeCycle - This callback is invoked whenever the next bottom-up instruction to be scheduled cannot issue in the current cycle, either because of latency or resource conflicts.
 
virtual void EmitNoop ()
 EmitNoop - This callback is invoked when a noop was added to the instruction stream.
 
virtual void EmitNoops (unsigned Quantity)
 EmitNoops - This callback is invoked when noops were added to the instruction stream.
 

Additional Inherited Members

- Protected Attributes inherited from llvm::ScheduleHazardRecognizer
unsigned MaxLookAhead = 0
 MaxLookAhead - Indicate the number of cycles in the scoreboard state.
 

Detailed Description

Definition at line 32 of file GCNHazardRecognizer.h.

Member Typedef Documentation

◆ IsHazardFn

Definition at line 34 of file GCNHazardRecognizer.h.

Constructor & Destructor Documentation

◆ GCNHazardRecognizer()

GCNHazardRecognizer::GCNHazardRecognizer ( const MachineFunction MF)

Member Function Documentation

◆ AdvanceCycle()

void GCNHazardRecognizer::AdvanceCycle ( )
overridevirtual

AdvanceCycle - This callback is invoked whenever the next top-down instruction to be scheduled cannot issue in the current cycle, either because of latency or resource conflicts.

This should increment the internal state of the hazard recognizer so that previously "Hazard" instructions will now not be hazards.

Reimplemented from llvm::ScheduleHazardRecognizer.

Definition at line 412 of file GCNHazardRecognizer.cpp.

References llvm::ScheduleHazardRecognizer::getMaxLookAhead(), llvm::SIInstrInfo::getNumWaitStates(), and llvm::MachineInstr::isBundle().

◆ atIssueLimit()

bool llvm::GCNHazardRecognizer::atIssueLimit ( ) const
inlineoverridevirtual

atIssueLimit - Return true if no more instructions may be issued in this cycle.

FIXME: remove this once MachineScheduler is the only client.

Reimplemented from llvm::ScheduleHazardRecognizer.

Definition at line 142 of file GCNHazardRecognizer.h.

◆ EmitInstruction() [1/2]

void GCNHazardRecognizer::EmitInstruction ( MachineInstr )
overridevirtual

This overload will be used when the hazard recognizer is being used by a non-scheduling pass, which does not use SUnits.

Reimplemented from llvm::ScheduleHazardRecognizer.

Definition at line 77 of file GCNHazardRecognizer.cpp.

References MI.

◆ EmitInstruction() [2/2]

void GCNHazardRecognizer::EmitInstruction ( SUnit )
overridevirtual

EmitInstruction - This callback is invoked when an instruction is emitted, to advance the hazard state.

Reimplemented from llvm::ScheduleHazardRecognizer.

Definition at line 73 of file GCNHazardRecognizer.cpp.

References EmitInstruction(), and llvm::SUnit::getInstr().

Referenced by EmitInstruction().

◆ EmitNoop()

void GCNHazardRecognizer::EmitNoop ( )
overridevirtual

EmitNoop - This callback is invoked when a noop was added to the instruction stream.

Reimplemented from llvm::ScheduleHazardRecognizer.

Definition at line 408 of file GCNHazardRecognizer.cpp.

◆ getHazardType()

ScheduleHazardRecognizer::HazardType GCNHazardRecognizer::getHazardType ( SUnit ,
int  Stalls 
)
overridevirtual

getHazardType - Return the hazard type of emitting this node.

There are three possible results. Either:

  • NoHazard: it is legal to issue this instruction on this cycle.
  • Hazard: issuing this instruction would stall the machine. If some other instruction is available, issue it first.
  • NoopHazard: issuing this instruction would break the program. If some other instruction can be issued, do so, otherwise issue a noop.

Reimplemented from llvm::ScheduleHazardRecognizer.

Definition at line 190 of file GCNHazardRecognizer.cpp.

References llvm::SUnit::getInstr(), llvm::GCNSubtarget::hasNoDataDepHazard(), llvm::GCNSubtarget::hasNSAtoVMEMBug(), llvm::GCNSubtarget::hasReadM0LdsDirectHazard(), llvm::GCNSubtarget::hasReadM0LdsDmaHazard(), llvm::GCNSubtarget::hasReadM0MovRelInterpHazard(), llvm::GCNSubtarget::hasReadM0SendMsgHazard(), llvm::ScheduleHazardRecognizer::Hazard, isDivFMas(), llvm::SIInstrInfo::isDPP(), llvm::SIInstrInfo::isDS(), llvm::SIInstrInfo::isEXP(), llvm::SIInstrInfo::isFLAT(), isLdsDma(), llvm::SIInstrInfo::isMAI(), isRFE(), isRWLane(), isSendMsgTraceDataOrGDS(), isSGetReg(), isSMovRel(), llvm::SIInstrInfo::isSMRD(), isSSetReg(), llvm::SIInstrInfo::isVALU(), llvm::SIInstrInfo::isVINTRP(), llvm::SIInstrInfo::isVMEM(), MI, llvm::ScheduleHazardRecognizer::NoHazard, and llvm::ScheduleHazardRecognizer::NoopHazard.

◆ PreEmitNoops()

unsigned GCNHazardRecognizer::PreEmitNoops ( MachineInstr )
overridevirtual

This overload will be used when the hazard recognizer is being used by a non-scheduling pass, which does not use SUnits.

Reimplemented from llvm::ScheduleHazardRecognizer.

Definition at line 326 of file GCNHazardRecognizer.cpp.

References MI, and PreEmitNoopsCommon().

◆ PreEmitNoopsCommon()

unsigned GCNHazardRecognizer::PreEmitNoopsCommon ( MachineInstr MI)

◆ RecedeCycle()

void GCNHazardRecognizer::RecedeCycle ( )
overridevirtual

RecedeCycle - This callback is invoked whenever the next bottom-up instruction to be scheduled cannot issue in the current cycle, either because of latency or resource conflicts.

Reimplemented from llvm::ScheduleHazardRecognizer.

Definition at line 450 of file GCNHazardRecognizer.cpp.

References llvm_unreachable.

◆ Reset()

void GCNHazardRecognizer::Reset ( )
overridevirtual

Reset - This callback is invoked when a new block of instructions is about to be schedule.

The hazard state should be set to an initialized state.

Reimplemented from llvm::ScheduleHazardRecognizer.

Definition at line 69 of file GCNHazardRecognizer.cpp.

◆ ShouldPreferAnother()

bool GCNHazardRecognizer::ShouldPreferAnother ( SUnit )
overridevirtual

ShouldPreferAnother - This callback may be invoked if getHazardType returns NoHazard.

If, even though there is no hazard, it would be better to schedule another available instruction, this callback should return true.

Reimplemented from llvm::ScheduleHazardRecognizer.

Definition at line 2924 of file GCNHazardRecognizer.cpp.

References llvm::SUnit::getInstr(), llvm::SUnit::isInstr(), llvm::SIInstrInfo::isMFMA(), and MI.


The documentation for this class was generated from the following files: