-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[AMDGPU] Refactor hazard recognizer for VALU-pipeline hazards. NFCI. #168801
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
base: main
Are you sure you want to change the base?
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |||||
| #ifndef LLVM_LIB_TARGET_AMDGPUHAZARDRECOGNIZERS_H | ||||||
| #define LLVM_LIB_TARGET_AMDGPUHAZARDRECOGNIZERS_H | ||||||
|
|
||||||
| #include "SIInstrInfo.h" | ||||||
| #include "llvm/ADT/BitVector.h" | ||||||
| #include "llvm/ADT/STLExtras.h" | ||||||
| #include "llvm/CodeGen/ScheduleHazardRecognizer.h" | ||||||
|
|
@@ -25,13 +26,14 @@ class MachineFunction; | |||||
| class MachineInstr; | ||||||
| class MachineOperand; | ||||||
| class MachineRegisterInfo; | ||||||
| class SIInstrInfo; | ||||||
| class SIRegisterInfo; | ||||||
| class GCNSubtarget; | ||||||
|
|
||||||
| class GCNHazardRecognizer final : public ScheduleHazardRecognizer { | ||||||
| public: | ||||||
| typedef function_ref<bool(const MachineInstr &)> IsHazardFn; | ||||||
| typedef function_ref<bool(const MachineInstr &, int WaitStates)> IsExpiredFn; | ||||||
| typedef function_ref<unsigned int(const MachineInstr &)> GetNumWaitStatesFn; | ||||||
|
|
||||||
| private: | ||||||
| // Distinguish if we are called from scheduler or hazard recognizer | ||||||
|
|
@@ -74,7 +76,9 @@ class GCNHazardRecognizer final : public ScheduleHazardRecognizer { | |||||
| // used on a newly inserted instruction before returning from PreEmitNoops. | ||||||
| void runOnInstruction(MachineInstr *MI); | ||||||
|
|
||||||
| int getWaitStatesSince(IsHazardFn IsHazard, int Limit); | ||||||
| int getWaitStatesSince( | ||||||
| IsHazardFn IsHazard, int Limit, | ||||||
| GetNumWaitStatesFn GetNumWaitStates = SIInstrInfo::getNumWaitStates); | ||||||
| int getWaitStatesSinceDef(unsigned Reg, IsHazardFn IsHazardDef, int Limit); | ||||||
| int getWaitStatesSinceSetReg(IsHazardFn IsHazard, int Limit); | ||||||
|
|
||||||
|
|
@@ -94,6 +98,9 @@ class GCNHazardRecognizer final : public ScheduleHazardRecognizer { | |||||
| int checkReadM0Hazards(MachineInstr *SMovRel); | ||||||
| int checkNSAtoVMEMHazard(MachineInstr *MI); | ||||||
| int checkFPAtomicToDenormModeHazard(MachineInstr *MI); | ||||||
| // emit V_NOP instructions. \p WaitStatesNeeded is the number of V_NOPs we | ||||||
|
Contributor
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.
Suggested change
|
||||||
| // need to insert, negative means not needed. | ||||||
|
Contributor
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. Seems silly to use
Collaborator
Author
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. I agree, but all other |
||||||
| bool emitVNops(MachineInstr *MI, int WaitStatesNeeded); | ||||||
| void fixHazards(MachineInstr *MI); | ||||||
| bool fixVcmpxPermlaneHazards(MachineInstr *MI); | ||||||
| bool fixVMEMtoScalarWriteHazards(MachineInstr *MI); | ||||||
|
|
@@ -106,7 +113,7 @@ class GCNHazardRecognizer final : public ScheduleHazardRecognizer { | |||||
| bool fixVALUTransUseHazard(MachineInstr *MI); | ||||||
| bool fixVALUTransCoexecutionHazards(MachineInstr *MI); | ||||||
| bool fixWMMAHazards(MachineInstr *MI); | ||||||
| bool fixWMMACoexecutionHazards(MachineInstr *MI); | ||||||
| int checkWMMACoexecutionHazards(MachineInstr *MI); | ||||||
| bool fixShift64HighRegBug(MachineInstr *MI); | ||||||
| bool fixVALUMaskWriteHazard(MachineInstr *MI); | ||||||
| bool fixRequiredExportPriority(MachineInstr *MI); | ||||||
|
|
||||||
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.
Don't see why you would need to move the include here
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.
I need
SIInstrInfo::getNumWaitStatesas a default value ingetWaitStatesSincedeclaration.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.
Could also just not use the defaulted argument and be explicit everywhere