gem5
v21.0.1.0
|
fetch buffer descriptor. More...
Public Member Functions | |
FetchBufDesc () | |
~FetchBufDesc () | |
void | allocateBuf (int fetch_depth, int cache_line_size, Wavefront *wf) |
allocate the fetch buffer space, and set the fetch depth (number of lines that may be buffered), fetch size (cache line size), and parent WF for this fetch buffer. More... | |
int | bufferedAndReservedLines () const |
int | bufferedLines () const |
int | bufferedBytes () const |
int | reservedLines () const |
bool | hasFreeSpace () const |
void | flushBuf () |
Addr | nextFetchAddr () |
void | reserveBuf (Addr vaddr) |
reserve an entry in the fetch buffer for PC = vaddr, More... | |
uint8_t * | reservedBuf (Addr vaddr) const |
return a pointer to the raw fetch buffer data. More... | |
bool | isReserved (Addr vaddr) const |
returns true if there is an entry reserved for this address, and false otherwise More... | |
void | fetchDone (Addr vaddr) |
bool | hasFetchDataToProcess () const |
checks if the buffer contains valid data. More... | |
void | decodeInsts () |
each time the fetch stage is ticked, we check if there are any data in the fetch buffer that may be decoded and sent to the IB. More... | |
void | checkWaveReleaseBuf () |
checks if the wavefront can release any of its fetch buffer entries. More... | |
void | decoder (TheGpuISA::Decoder *dec) |
bool | pcBuffered (Addr pc) const |
int | fetchBytesRemaining () const |
calculates the number of fetched bytes that have yet to be decoded. More... | |
Private Member Functions | |
void | decodeSplitInst () |
bool | splitDecode () const |
check if the next instruction to be processed out of the fetch buffer is split across the end/beginning of the fetch buffer. More... | |
Private Attributes | |
std::map< Addr, uint8_t * > | bufferedPCs |
the set of PCs (fetch addresses) that are currently buffered. More... | |
std::map< Addr, uint8_t * > | reservedPCs |
std::deque< uint8_t * > | freeList |
represents the fetch buffer free list. More... | |
uint8_t * | bufStart |
raw instruction buffer. More... | |
uint8_t * | bufEnd |
uint8_t * | readPtr |
pointer that points to the next chunk of inst data to be decoded. More... | |
int | fetchDepth |
int | maxIbSize |
int | maxFbSize |
int | cacheLineSize |
int | cacheLineBits |
bool | restartFromBranch |
Wavefront * | wavefront |
TheGpuISA::Decoder * | _decoder |
fetch buffer descriptor.
holds buffered instruction data in the fetch unit.
Definition at line 72 of file fetch_unit.hh.
|
inline |
Definition at line 75 of file fetch_unit.hh.
|
inline |
Definition at line 82 of file fetch_unit.hh.
References bufStart.
void FetchUnit::FetchBufDesc::allocateBuf | ( | int | fetch_depth, |
int | cache_line_size, | ||
Wavefront * | wf | ||
) |
allocate the fetch buffer space, and set the fetch depth (number of lines that may be buffered), fetch size (cache line size), and parent WF for this fetch buffer.
Definition at line 321 of file fetch_unit.cc.
References bufEnd, bufStart, cacheLineBits, cacheLineSize, fetchDepth, floorLog2(), freeList, ArmISA::i, isPowerOf2(), maxFbSize, Wavefront::maxIbSize, maxIbSize, panic_if, readPtr, and wavefront.
|
inline |
Definition at line 95 of file fetch_unit.hh.
References bufferedLines(), and reservedLines().
|
inline |
Definition at line 101 of file fetch_unit.hh.
References bufferedLines(), and cacheLineSize.
|
inline |
Definition at line 100 of file fetch_unit.hh.
References bufferedPCs.
Referenced by bufferedAndReservedLines(), and bufferedBytes().
void FetchUnit::FetchBufDesc::checkWaveReleaseBuf | ( | ) |
checks if the wavefront can release any of its fetch buffer entries.
this will occur when the WF's PC goes beyond any of the currently buffered cache lines.
we're using a std::map so the addresses are sorted. if this PC is not the oldest one in the map, we must be fetching from a newer block, and we can release the oldest PC's fetch buffer entry back to the free list.
Definition at line 478 of file fetch_unit.cc.
References DPRINTF, and roundDown().
void FetchUnit::FetchBufDesc::decodeInsts | ( | ) |
each time the fetch stage is ticked, we check if there are any data in the fetch buffer that may be decoded and sent to the IB.
because we are modeling the fetch buffer as a circular buffer, it is possible that an instruction can straddle the end/beginning of the fetch buffer, so decodeSplitInsts() handles that case.
Definition at line 535 of file fetch_unit.cc.
References GPUStaticInst::disassemble(), DPRINTF, and GPUStaticInst::instSize().
|
inline |
Definition at line 166 of file fetch_unit.hh.
References _decoder.
|
private |
Definition at line 573 of file fetch_unit.cc.
References GPUStaticInst::disassemble(), DPRINTF, ArmISA::i, GPUStaticInst::instSize(), and replaceBits().
int FetchUnit::FetchBufDesc::fetchBytesRemaining | ( | ) | const |
calculates the number of fetched bytes that have yet to be decoded.
Definition at line 623 of file fetch_unit.cc.
void FetchUnit::FetchBufDesc::fetchDone | ( | Addr | vaddr | ) |
this address should have an entry reserved in the fetch buffer already, however it should be invalid until the fetch completes.
Definition at line 447 of file fetch_unit.cc.
References DPRINTF, and MipsISA::vaddr.
void FetchUnit::FetchBufDesc::flushBuf | ( | ) |
free list may have some entries so we clear it here to avoid duplicates
Definition at line 345 of file fetch_unit.cc.
References DPRINTF, FetchUnit::fetchDepth, and ArmISA::i.
bool FetchUnit::FetchBufDesc::hasFetchDataToProcess | ( | ) | const |
checks if the buffer contains valid data.
this essentially tells fetch when there is data remaining that needs to be decoded into the WF's IB.
Definition at line 472 of file fetch_unit.cc.
|
inline |
Definition at line 103 of file fetch_unit.hh.
References freeList.
|
inline |
returns true if there is an entry reserved for this address, and false otherwise
Definition at line 132 of file fetch_unit.hh.
References reservedPCs, and MipsISA::vaddr.
Addr FetchUnit::FetchBufDesc::nextFetchAddr | ( | ) |
get the PC of the most recently fetched cache line, then return the address of the next line.
should not be trying to fetch a line that has already been fetched.
we do not have any buffered cache lines yet, so we assume this is the initial fetch, or the first fetch after a branch, and get the PC directly from the WF. in the case of a branch, we may not start at the beginning of a cache line, so we adjust the readPtr by the current PC's offset from the start of the line.
if we are here we have no buffered lines. in the case we flushed the buffer due to a branch, we may need to start fetching from some offset from the start of the fetch buffer, so we adjust for that here.
Definition at line 367 of file fetch_unit.cc.
References makeLineAddress().
|
inline |
Definition at line 172 of file fetch_unit.hh.
References bufferedPCs, MipsISA::pc, and reservedPCs.
void FetchUnit::FetchBufDesc::reserveBuf | ( | Addr | vaddr | ) |
reserve an entry in the fetch buffer for PC = vaddr,
we reserve buffer space, by moving it out of the free list, however we do not mark the buffered line as valid until the fetch unit for this buffer has receieved the response from the memory system.
Definition at line 422 of file fetch_unit.cc.
References DPRINTF, FetchUnit::fetchDepth, and MipsISA::vaddr.
|
inline |
return a pointer to the raw fetch buffer data.
this allows the fetch pkt to use this data directly to avoid unnecessary memcpy and malloc/new.
Definition at line 118 of file fetch_unit.hh.
References reservedPCs, and MipsISA::vaddr.
|
inline |
Definition at line 102 of file fetch_unit.hh.
References reservedPCs.
Referenced by bufferedAndReservedLines().
|
private |
check if the next instruction to be processed out of the fetch buffer is split across the end/beginning of the fetch buffer.
if a read of a raw instruction would go beyond the end of the fetch buffer, then we must perform a split decode.
Definition at line 611 of file fetch_unit.cc.
|
private |
Definition at line 237 of file fetch_unit.hh.
Referenced by decoder().
|
private |
Definition at line 220 of file fetch_unit.hh.
Referenced by allocateBuf().
|
private |
the set of PCs (fetch addresses) that are currently buffered.
bufferedPCs are valid, reservedPCs are waiting for their buffers to be filled with valid fetch data.
Definition at line 202 of file fetch_unit.hh.
Referenced by bufferedLines(), and pcBuffered().
|
private |
raw instruction buffer.
holds cache line data associated with the set of PCs (fetch addresses) that are buffered here.
Definition at line 219 of file fetch_unit.hh.
Referenced by allocateBuf(), and ~FetchBufDesc().
|
private |
Definition at line 233 of file fetch_unit.hh.
Referenced by allocateBuf().
|
private |
Definition at line 232 of file fetch_unit.hh.
Referenced by allocateBuf(), and bufferedBytes().
|
private |
Definition at line 227 of file fetch_unit.hh.
Referenced by allocateBuf().
|
private |
represents the fetch buffer free list.
holds buffer space that is currently free. each pointer in this array must have enough space to hold a cache line. in reality we have one actual fetch buffer: 'bufStart', these pointers point to addresses within bufStart that are aligned to the cache line size.
Definition at line 213 of file fetch_unit.hh.
Referenced by allocateBuf(), and hasFreeSpace().
|
private |
Definition at line 231 of file fetch_unit.hh.
Referenced by allocateBuf().
|
private |
Definition at line 229 of file fetch_unit.hh.
Referenced by allocateBuf().
|
private |
pointer that points to the next chunk of inst data to be decoded.
Definition at line 225 of file fetch_unit.hh.
Referenced by allocateBuf().
|
private |
Definition at line 203 of file fetch_unit.hh.
Referenced by isReserved(), pcBuffered(), reservedBuf(), and reservedLines().
|
private |
Definition at line 234 of file fetch_unit.hh.
|
private |
Definition at line 236 of file fetch_unit.hh.
Referenced by allocateBuf().