LLVM 24.0.0git
SIInsertWaitcnts.cpp File Reference

Insert wait instructions for memory reads and writes. More...

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "si-insert-waitcnts"

Typedefs

using HWEvents = AMDGPU::HWEvents

Functions

 INITIALIZE_PASS_BEGIN (SIInsertWaitcntsLegacy, DEBUG_TYPE, "SI Insert Waitcnts", false, false) INITIALIZE_PASS_END(SIInsertWaitcntsLegacy
static bool updateOperandIfDifferent (MachineInstr &MI, AMDGPU::OpName OpName, unsigned NewEnc)
static bool isWaitInstr (MachineInstr &Inst)

Variables

 DEBUG_TYPE
SI Insert Waitcnts
SI Insert false

Detailed Description

Insert wait instructions for memory reads and writes.

Memory reads and writes are issued asynchronously, so we need to insert S_WAITCNT instructions when we want to access any of their results or overwrite any register that's used asynchronously.

TODO: This pass currently keeps one timeline per hardware counter. A more finely-grained approach that keeps one timeline per event type could sometimes get away with generating weaker s_waitcnt instructions. For example, when both SMEM and LDS are in flight and we need to wait for the i-th-last LDS instruction, then an lgkmcnt(i) is actually sufficient, but the pass will currently generate a conservative lgkmcnt(0) because multiple event types are in flight.

Definition in file SIInsertWaitcnts.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "si-insert-waitcnts"

Definition at line 46 of file SIInsertWaitcnts.cpp.

Typedef Documentation

◆ HWEvents

Definition at line 44 of file SIInsertWaitcnts.cpp.

Function Documentation

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( SIInsertWaitcntsLegacy ,
DEBUG_TYPE ,
"SI Insert Waitcnts" ,
false ,
false  )

◆ isWaitInstr()

◆ updateOperandIfDifferent()

bool updateOperandIfDifferent ( MachineInstr & MI,
AMDGPU::OpName OpName,
unsigned NewEnc )
static

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 1665 of file SIInsertWaitcnts.cpp.

◆ false

SI Insert false

Definition at line 1666 of file SIInsertWaitcnts.cpp.

◆ Waitcnts

SI Insert Waitcnts

Definition at line 1665 of file SIInsertWaitcnts.cpp.