32 "amdgpu-barrier-signal-wait-latency",
33 cl::desc(
"Synthetic latency between S_BARRIER_SIGNAL and S_BARRIER_WAIT "
34 "to encourage scheduling independent work between them"),
47 IgnoredScopes.
insert(Context.getOrInsertSyncScopeID(
"wavefront"));
48 IgnoredScopes.
insert(Context.getOrInsertSyncScopeID(
"wavefront-one-as"));
49 IgnoredScopes.
insert(Context.getOrInsertSyncScopeID(
"singlethread-one-as"));
51 void apply(ScheduleDAGInstrs *DAG)
override;
56 SDep ForwardD = PredDep;
59 if (SuccDep == ForwardD) {
70 const SIInstrInfo *
TII =
static_cast<const SIInstrInfo *
>(DAG->
TII);
71 constexpr unsigned FenceLatency = 2000;
74 for (SUnit &SU : DAG->
SUnits) {
76 unsigned Op =
MI->getOpcode();
78 if (
Op == AMDGPU::ATOMIC_FENCE) {
86 for (SDep &PredDep : SU.
Preds) {
92 if (!
MI->mayLoad() ||
MI->mayStore())
94 addLatencyToEdge(PredDep, SU, FenceLatency);
96 }
else if (
Op == AMDGPU::S_BARRIER_WAIT) {
97 for (SDep &PredDep : SU.
Preds) {
99 const MachineInstr *PredMI = PredSU->
getInstr();
101 addLatencyToEdge(PredDep, SU, BarrierSignalWaitLatency);
110std::unique_ptr<ScheduleDAGMutation>
112 return std::make_unique<BarrierLatency>(MF);
static cl::opt< unsigned > BarrierSignalWaitLatencyOpt("amdgpu-barrier-signal-wait-latency", cl::desc("Synthetic latency between S_BARRIER_SIGNAL and S_BARRIER_WAIT " "to encourage scheduling independent work between them"), cl::init(16), cl::Hidden)
Provides AMDGPU specific target descriptions.
const HexagonInstrInfo * TII
Interface definition for SIInstrInfo.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
This is an important class for using LLVM in a threaded context.
Function & getFunction()
Return the LLVM function that this machine code represents.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
void setLatency(unsigned Lat)
Sets the latency for this edge.
unsigned getLatency() const
Returns the latency value for this edge, which roughly means the minimum number of cycles that must e...
bool isBarrier() const
Tests if this is an Order dependence that is marked as a barrier.
Scheduling unit. This is a node in the scheduling DAG.
SmallVector< SDep, 4 > Succs
All sunit successors.
LLVM_ABI void setDepthDirty()
Sets a flag in this node to indicate that its stored Depth value will require recomputation the next ...
SmallVector< SDep, 4 > Preds
All sunit predecessors.
MachineInstr * getInstr() const
Returns the representative MachineInstr for this SUnit.
A ScheduleDAG for scheduling lists of MachineInstr.
Mutate the DAG as a postpass after normal DAG building.
const TargetInstrInfo * TII
Target instruction information.
std::vector< SUnit > SUnits
The scheduling units.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
bool contains(const T &V) const
Check if the SmallSet contains the given element.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
@ SingleThread
Synchronized with respect to signal handlers executing in the same thread.
void apply(Opt *O, const Mod &M, const Mods &... Ms)
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< ScheduleDAGMutation > createAMDGPUBarrierLatencyDAGMutation(MachineFunction *MF)
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
DWARFExpression::Operation Op