36 #ifndef __DEV_HSA_HSA_PACKET_PROCESSOR__ 37 #define __DEV_HSA_HSA_PACKET_PROCESSOR__ 46 #include "params/HSAPacketProcessor.hh" 48 #define AQL_PACKET_SIZE 64 49 #define PAGE_SIZE 4096 50 #define NUM_DMA_BUFS 16 51 #define DMA_BUF_SIZE (AQL_PACKET_SIZE * NUM_DMA_BUFS) 53 #define NumSignalsPerBarrier 5 71 uint64_t hri_ptr, uint32_t size)
72 : basePointer(base_ptr), doorbellPointer(db_ptr),
73 writeIndex(0), readIndex(0),
74 numElts(size), hostReadIndexPtr(hri_ptr),
75 stalledOnDmaBufAvailability(false),
85 uint64_t
ptr(uint64_t ix)
116 std::string
name() {
return _name;}
118 int allocEntry(uint32_t nBufReq);
119 bool freeEntry(
void *pkt);
133 for (
int i = 0;
i < num_pkts; ++
i) {
142 return _hostDispAddresses[dispIdx() %
numObjs()];
148 int packet_type = (_aqlBuf[_dispIdx % _aqlBuf.size()].header
154 uint32_t
nFree()
const {
return _aqlBuf.size() - (_wrIdx - _rdIdx); }
155 void *
ptr(uint32_t ix) {
return _aqlBuf.data() + (ix % _aqlBuf.size()); }
156 uint32_t
numObjs()
const {
return _aqlBuf.size(); };
159 uint64_t
wrIdx()
const {
return _wrIdx; }
160 uint64_t
rdIdx()
const {
return _rdIdx; }
173 : qDesc(q_desc), aqlBuf(aql_buf)
193 : pendingReads(0), allRead(false), discardRead(false)
197 void handleReadDMA();
208 std::fill(values.begin(), values.end(), 1);
219 : Event(Default_Pri), hsaPP(_hsaPP), rqIdx(_rqIdx)
221 virtual void process();
222 virtual const char *description()
const;
231 : aqlProcessEvent(hsaPP, rqIdx) {}
240 void translateOrDie(Addr
vaddr, Addr &paddr);
241 void dmaVirt(DmaFnPtr, Addr host_addr,
unsigned size, Event *
event,
244 void dmaReadVirt(Addr host_addr,
unsigned size, Event *
event,
247 void dmaWriteVirt(Addr host_addr,
unsigned size, Event *
event,
249 bool processPkt(
void* pkt, uint32_t rl_idx, Addr host_pkt_addr);
250 void displayQueueDescriptor(
int pid, uint32_t rl_idx);
256 return regdQList.at(queId)->qCntxt.qDesc;
261 return regdQList.at(queId);
273 void setDeviceQueueDesc(uint64_t hostReadIndexPointer,
277 void unsetDeviceQueueDesc(uint64_t queue_id);
279 void updateReadIndex(
int, uint32_t);
280 void getCommandsFromHost(
int pid, uint32_t rl_idx);
286 void finishPkt(
void *pkt, uint32_t rl_idx);
288 void schedAQLProcessing(uint32_t rl_idx);
296 : Event(Default_Pri, AutoDelete), signalState(ss)
299 virtual const char *description()
const;
313 const char *description()
const override;
331 : pkts_ttl(_pkts_2_go), pkts_2_go(_pkts_2_go),
332 start_ix(_start_ix), rl_idx(_rl_idx)
350 uint32_t dma_buf_ix, uint num_bufs,
352 virtual void process();
353 virtual const char *description()
const;
357 #endif // __DEV_HSA_HSA_PACKET_PROCESSOR__
const Tick pktProcessDelay
void incDispIdx(uint64_t value)
RQLEntry(HSAPacketProcessor *hsaPP, uint32_t rqIdx)
const std::string & name()
QueueProcessEvent(HSAPacketProcessor *_hsaPP, uint32_t _rqIdx)
bool stalledOnDmaBufAvailability
HSAQueueDescriptor(uint64_t base_ptr, uint64_t db_ptr, uint64_t hri_ptr, uint32_t size)
std::vector< bool > _aqlComplete
#define NumSignalsPerBarrier
SignalState depSignalRdState
HSAPacketProcessor * hsaPP
dma_series_ctx(uint32_t _pkts_ttl, uint32_t _pkts_2_go, uint32_t _start_ix, uint32_t _rl_idx)
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 corresp...
HSAPacketProcessorParams Params
HSAQueueDescriptor * qDesc
std::vector< hsa_signal_value_t > values
QueueProcessEvent aqlProcessEvent
uint64_t Tick
Tick count type.
The packet has been processed in the past, but has not been reassigned to the packet processor...
Addr hostDispAddr() const
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
struct QueueContext QCntxt
std::vector< class RQLEntry * > regdQList
QueueContext(HSAQueueDescriptor *q_desc, AQLRingBuffer *aql_buf)
HSAPacketProcessor * hsaPP
std::vector< hsa_kernel_dispatch_packet_t > _aqlBuf
void incRdIdx(uint64_t value)
void incWrIdx(uint64_t value)
Internal ring buffer which is used to prefetch/store copies of the in-memory HSA ring buffer...
class RQLEntry * getRegdListEntry(uint32_t queId)
this event is used to update the read_disp_id field (the read pointer) of the MQD, which is how the host code knows the status of the HQD's read pointer
dma_series_ctx * series_ctx
uint64_t spaceRemaining()
SignalState * signalState
void finishPkt(void *pkt)
DepSignalsReadDmaEvent(SignalState *ss)
HSAQueueDescriptor * getQueueDesc(uint32_t queId)
Calls getCurrentEntry once the queueEntry has been dmaRead.
uint64_t ptr(uint64_t ix)
uint64_t hostReadIndexPtr
std::vector< Addr > _hostDispAddresses