38 #include "debug/HSAPacketProcessor.hh" 41 #define HWSCHDLR_EVENT_DESCRIPTION_GENERATOR(XEVENT) \ 43 HWScheduler::XEVENT::description() const \ 98 Addr db_offset = queue_id;
100 panic(
"Creating an already existing queue (queueID %d)", queue_id);
104 dbMap[db_offset] = queue_id;
107 panic(
"Attempting to create a queue (queueID %d)" \
108 " beyond PIO range", queue_id);
113 hostReadIndexPointer, size);
116 QCntxt q_cntxt(q_desc, aql_buf);
121 bool M5_VAR_USED register_q =
mapQIfSlotAvlbl(queue_id, aql_buf, q_desc);
124 "%s: offset = %p, qID = %d, is_regd = %s, AL size %d\n",
125 __FUNCTION__, db_offset, queue_id,
126 (register_q) ?
"true" :
"false", dbMap.size());
133 "Trying to find empty HW queue, @ %s\n", __FUNCTION__);
146 panic(
"Cannot find empty queue\n");
156 "Trying to map new queue, @ %s\n", __FUNCTION__);
196 "Trying to map next queue, @ %s", __FUNCTION__);
255 uint32_t al_idx =
dbMap[db_offset];
265 uint32_t al_id = (
nextALId + activeQId) % MAX_ACTIVE_QUEUES;
273 "Next Active ALQ %d (current %d), max ALQ %d\n",
274 al_id,
nextALId, MAX_ACTIVE_QUEUES);
301 "@ %s, analyzing hw queue %d\n", __FUNCTION__, rl_idx);
324 auto dbmap_iter =
dbMap.find(db_addr);
325 if (dbmap_iter ==
dbMap.end()) {
326 panic(
"Writing to a non-existing queue (db_offset %x)", db_addr);
328 uint32_t al_idx =
dbMap[db_addr];
330 activeList[al_idx].qDesc->writeIndex = doorbell_reg;
349 Addr db_offset = queue_id;
350 auto dbmap_iter =
dbMap.find(db_offset);
351 if (dbmap_iter ==
dbMap.end()) {
352 panic(
"Destroying a non-existing queue (db_offset %x)",
355 uint32_t al_idx =
dbMap[db_offset];
356 assert(
dbMap[db_offset] == dbmap_iter->second);
365 warn(
"Destroying a non-empty queue");
371 dbMap.erase(db_offset);
#define panic(...)
This implements a cprintf based panic() function.
std::map< Addr, uint32_t > dbMap
bool mapQIfSlotAvlbl(uint32_t al_idx, AQLRingBuffer *aql_buf, HSAQueueDescriptor *q_desc)
#define MAX_ACTIVE_QUEUES
void unregisterQueue(uint64_t queue_id)
SignalState depSignalRdState
#define HWSCHDLR_EVENT_DESCRIPTION_GENERATOR(XEVENT)
void updateRRVars(uint32_t al_idx, uint32_t rl_idx)
void scheduleAndWakeupMappedQ()
HSAQueueDescriptor * qDesc
Tick curTick()
The current simulated tick.
std::map< uint32_t, QCntxt > activeList
QueueProcessEvent aqlProcessEvent
bool isRLQIdle(uint32_t rl_idx)
void getCommandsFromHost(int pid, uint32_t rl_idx)
void schedule(Event &event, Tick when)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void addQCntxt(uint32_t al_idx, AQLRingBuffer *aql_buf, HSAQueueDescriptor *q_desc)
bool scheduled() const
Determine if the current event is scheduled.
virtual const std::string name() const
std::vector< class RQLEntry * > regdQList
Internal ring buffer which is used to prefetch/store copies of the in-memory HSA ring buffer...
class RQLEntry * getRegdListEntry(uint32_t queId)
void schedAQLProcessing(uint32_t rl_idx)
SchedulerWakeupEvent schedWakeupEvent
std::map< uint32_t, uint32_t > regdListMap
HSAPacketProcessor * hsaPP
void write(Addr db_addr, uint32_t doorbell_reg)
void registerNewQueue(uint64_t hostReadIndexPointer, uint64_t basePointer, uint64_t queue_id, uint32_t size)