36#include "debug/HSAPacketProcessor.hh"
39#define HWSCHDLR_EVENT_DESCRIPTION_GENERATOR(XEVENT) \
41 HWScheduler::XEVENT::description() const \
88 uint32_t size,
int doorbellSize,
89 GfxVersion gfxVersion,
97 offset = queue_id * doorbellSize;
100 panic(
"Creating an already existing queue (queueID %d)", queue_id);
108 panic(
"Attempting to create a queue (queueID %d)" \
109 " beyond PIO range", queue_id);
114 hostReadIndexPointer, size, gfxVersion);
125 QCntxt q_cntxt(q_desc, aql_buf);
130 [[maybe_unused]]
bool register_q =
134 "%s: offset = %p, qID = %d, is_regd = %s, AL size %d\n",
135 __FUNCTION__,
offset, queue_id,
136 (register_q) ?
"true" :
"false",
dbMap.size());
143 "Trying to find empty HW queue, @ %s\n", __FUNCTION__);
156 panic(
"Cannot find empty queue\n");
166 "Trying to map new queue, @ %s\n", __FUNCTION__);
206 "Trying to map next queue, @ %s\n", __FUNCTION__);
265 uint32_t al_idx =
dbMap[db_offset];
283 "Next Active ALQ %d (current %d), max ALQ %d\n",
311 "@ %s, analyzing hw queue %d\n", __FUNCTION__, rl_idx);
333 auto dbmap_iter =
dbMap.find(db_addr);
334 if (dbmap_iter ==
dbMap.end()) {
335 panic(
"Writing to a non-existing queue (db_offset %x)", db_addr);
337 uint32_t al_idx =
dbMap[db_addr];
339 activeList[al_idx].qDesc->writeIndex = doorbell_reg;
344 activeList[al_idx].qDesc->readIndex = doorbell_reg - 1;
358 assert(
qidMap.count(queue_id));
361 auto dbmap_iter =
dbMap.find(db_offset);
362 if (dbmap_iter ==
dbMap.end()) {
363 panic(
"Destroying a non-existing queue (db_offset %x)",
366 uint32_t al_idx =
dbMap[db_offset];
367 assert(
dbMap[db_offset] == dbmap_iter->second);
376 warn(
"Destroying a non-empty queue");
382 dbMap.erase(db_offset);
Internal ring buffer which is used to prefetch/store copies of the in-memory HSA ring buffer.
void setRdIdx(uint64_t value)
void setDispIdx(uint64_t value)
void setWrIdx(uint64_t value)
QueueProcessEvent aqlProcessEvent
SignalState depSignalRdState
std::vector< class RQLEntry * > regdQList
uint64_t inFlightPkts(uint32_t queId)
void getCommandsFromHost(int pid, uint32_t rl_idx)
class RQLEntry * getRegdListEntry(uint32_t queId)
void schedAQLProcessing(uint32_t rl_idx)
void unregisterQueue(uint64_t queue_id, int doorbellSize)
SchedulerWakeupEvent schedWakeupEvent
void addQCntxt(uint32_t al_idx, AQLRingBuffer *aql_buf, HSAQueueDescriptor *q_desc)
void updateRRVars(uint32_t al_idx, uint32_t rl_idx)
void registerNewQueue(uint64_t hostReadIndexPointer, uint64_t basePointer, uint64_t queue_id, uint32_t size, int doorbellSize, GfxVersion gfxVersion, Addr offset=0, uint64_t rd_idx=0)
std::map< uint32_t, uint32_t > regdListMap
void scheduleAndWakeupMappedQ()
std::map< Addr, uint32_t > dbMap
std::map< uint32_t, QCntxt > activeList
bool isRLQIdle(uint32_t rl_idx)
void write(Addr db_addr, uint64_t doorbell_reg)
HSAPacketProcessor * hsaPP
std::map< uint64_t, Addr > qidMap
bool mapQIfSlotAvlbl(uint32_t al_idx, AQLRingBuffer *aql_buf, HSAQueueDescriptor *q_desc)
virtual std::string name() const
bool scheduled() const
Determine if the current event is scheduled.
void schedule(Event &event, Tick when)
#define panic(...)
This implements a cprintf based panic() function.
#define HWSCHDLR_EVENT_DESCRIPTION_GENERATOR(XEVENT)
#define MAX_ACTIVE_QUEUES
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Tick curTick()
The universal simulation clock.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
HSAQueueDescriptor * qDesc