gem5  v20.1.0.0
Public Member Functions | Private Attributes | List of all members
AQLRingBuffer Class Reference

Internal ring buffer which is used to prefetch/store copies of the in-memory HSA ring buffer. More...

#include <hsa_packet_processor.hh>

Public Member Functions

std::string name ()
 
 AQLRingBuffer (uint32_t size, const std::string name)
 
int allocEntry (uint32_t nBufReq)
 
bool freeEntry (void *pkt)
 
void saveHostDispAddr (Addr host_pkt_addr, int num_pkts, int ix)
 the kernel may try to read from the dispatch packet, so we need to keep the host address that corresponds to each of the dispatch packets this AQL buffer is storing. More...
 
Addr hostDispAddr () const
 
bool dispPending () const
 
bool isLastOutstandingPkt () const
 Packets aren't guaranteed to be completed in-order, and we need to know when the last packet is finished in order to un-set the barrier bit. More...
 
uint32_t nFree () const
 
void * ptr (uint32_t ix)
 
uint32_t numObjs () const
 
uint32_t objSize () const
 
uint64_t dispIdx () const
 
uint64_t wrIdx () const
 
uint64_t rdIdx () const
 
uint64_t * rdIdxPtr ()
 
void incRdIdx (uint64_t value)
 
void incWrIdx (uint64_t value)
 
void incDispIdx (uint64_t value)
 
uint64_t compltnPending ()
 

Private Attributes

std::vector< hsa_kernel_dispatch_packet_t_aqlBuf
 
std::string _name
 
std::vector< Addr_hostDispAddresses
 
std::vector< bool > _aqlComplete
 
uint64_t _wrIdx
 
uint64_t _rdIdx
 
uint64_t _dispIdx
 

Detailed Description

Internal ring buffer which is used to prefetch/store copies of the in-memory HSA ring buffer.

Each packet in the queue has three implicit states tracked by a packet's relative location to the write, read, and dispatch pointers.

FREE: Entry is empty ALLOCATED: Entry has been allocated for a packet, but the DMA has not yet completed SUBMITTED: Packet has been submitted to the HSADevice, but has not yet completed

Definition at line 117 of file hsa_packet_processor.hh.

Constructor & Destructor Documentation

◆ AQLRingBuffer()

AQLRingBuffer::AQLRingBuffer ( uint32_t  size,
const std::string  name 
)

Member Function Documentation

◆ allocEntry()

int AQLRingBuffer::allocEntry ( uint32_t  nBufReq)

Definition at line 642 of file hsa_packet_processor.cc.

References DPRINTF, incWrIdx(), nFree(), and wrIdx().

Referenced by HSAPacketProcessor::getCommandsFromHost().

◆ compltnPending()

uint64_t AQLRingBuffer::compltnPending ( )
inline

Definition at line 197 of file hsa_packet_processor.hh.

References _dispIdx, and _rdIdx.

Referenced by HSAPacketProcessor::RQLEntry::compltnPending().

◆ dispIdx()

uint64_t AQLRingBuffer::dispIdx ( ) const
inline

◆ dispPending()

bool AQLRingBuffer::dispPending ( ) const
inline

◆ freeEntry()

bool AQLRingBuffer::freeEntry ( void *  pkt)

◆ hostDispAddr()

Addr AQLRingBuffer::hostDispAddr ( ) const
inline

◆ incDispIdx()

void AQLRingBuffer::incDispIdx ( uint64_t  value)
inline

Definition at line 196 of file hsa_packet_processor.hh.

References _dispIdx.

Referenced by HSAPacketProcessor::QueueProcessEvent::process().

◆ incRdIdx()

void AQLRingBuffer::incRdIdx ( uint64_t  value)
inline

Definition at line 194 of file hsa_packet_processor.hh.

References _rdIdx.

Referenced by freeEntry().

◆ incWrIdx()

void AQLRingBuffer::incWrIdx ( uint64_t  value)
inline

Definition at line 195 of file hsa_packet_processor.hh.

References _wrIdx.

Referenced by allocEntry().

◆ isLastOutstandingPkt()

bool AQLRingBuffer::isLastOutstandingPkt ( ) const
inline

Packets aren't guaranteed to be completed in-order, and we need to know when the last packet is finished in order to un-set the barrier bit.

In order to confirm if the packet at _rdIdx is the last packet, we check if the packets ahead of _rdIdx are finished. If they are, _rdIdx is the last packet. If not, there are other outstanding packets.

Definition at line 176 of file hsa_packet_processor.hh.

References _aqlBuf, _aqlComplete, _dispIdx, _rdIdx, and ArmISA::i.

Referenced by HSAPacketProcessor::RQLEntry::isLastOutstandingPkt().

◆ name()

std::string AQLRingBuffer::name ( )
inline

Definition at line 129 of file hsa_packet_processor.hh.

References _name.

◆ nFree()

uint32_t AQLRingBuffer::nFree ( ) const
inline

Definition at line 186 of file hsa_packet_processor.hh.

References _aqlBuf, _rdIdx, and _wrIdx.

Referenced by allocEntry(), and freeEntry().

◆ numObjs()

uint32_t AQLRingBuffer::numObjs ( ) const
inline

◆ objSize()

uint32_t AQLRingBuffer::objSize ( ) const
inline

Definition at line 189 of file hsa_packet_processor.hh.

References AQL_PACKET_SIZE.

Referenced by saveHostDispAddr().

◆ ptr()

void* AQLRingBuffer::ptr ( uint32_t  ix)
inline

◆ rdIdx()

uint64_t AQLRingBuffer::rdIdx ( ) const
inline

◆ rdIdxPtr()

uint64_t* AQLRingBuffer::rdIdxPtr ( )
inline

Definition at line 193 of file hsa_packet_processor.hh.

References _rdIdx.

Referenced by HSAPacketProcessor::updateReadIndex().

◆ saveHostDispAddr()

void AQLRingBuffer::saveHostDispAddr ( Addr  host_pkt_addr,
int  num_pkts,
int  ix 
)
inline

the kernel may try to read from the dispatch packet, so we need to keep the host address that corresponds to each of the dispatch packets this AQL buffer is storing.

when we call submitPkt(), we send along the corresponding host address for the packet so the wavefront can properly initialize its SGPRs - which may include a pointer to the dispatch packet

Definition at line 144 of file hsa_packet_processor.hh.

References _hostDispAddresses, ArmISA::i, numObjs(), and objSize().

Referenced by HSAPacketProcessor::getCommandsFromHost().

◆ wrIdx()

uint64_t AQLRingBuffer::wrIdx ( ) const
inline

Member Data Documentation

◆ _aqlBuf

std::vector<hsa_kernel_dispatch_packet_t> AQLRingBuffer::_aqlBuf
private

◆ _aqlComplete

std::vector<bool> AQLRingBuffer::_aqlComplete
private

Definition at line 123 of file hsa_packet_processor.hh.

Referenced by AQLRingBuffer(), freeEntry(), and isLastOutstandingPkt().

◆ _dispIdx

uint64_t AQLRingBuffer::_dispIdx
private

◆ _hostDispAddresses

std::vector<Addr> AQLRingBuffer::_hostDispAddresses
private

Definition at line 122 of file hsa_packet_processor.hh.

Referenced by AQLRingBuffer(), hostDispAddr(), and saveHostDispAddr().

◆ _name

std::string AQLRingBuffer::_name
private

Definition at line 121 of file hsa_packet_processor.hh.

Referenced by name().

◆ _rdIdx

uint64_t AQLRingBuffer::_rdIdx
private

◆ _wrIdx

uint64_t AQLRingBuffer::_wrIdx
private

Definition at line 124 of file hsa_packet_processor.hh.

Referenced by dispPending(), incWrIdx(), nFree(), and wrIdx().


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

Generated on Wed Sep 30 2020 14:02:20 for gem5 by doxygen 1.8.17