36 #ifndef __LDS_STATE_HH__
37 #define __LDS_STATE_HH__
42 #include <unordered_map>
46 #include "enums/MemType.hh"
50 #include "params/LdsState.hh"
75 fatal_if(!
chunk.size(),
"cannot read from an LDS chunk of size 0");
76 fatal_if(index >=
chunk.size(),
"out-of-bounds access to an LDS chunk");
77 T *p0 = (T *) (&(
chunk.at(index)));
88 fatal_if(!
chunk.size(),
"cannot write to an LDS chunk of size 0");
89 fatal_if(index >=
chunk.size(),
"out-of-bounds access to an LDS chunk");
90 T *p0 = (T *) (&(
chunk.at(index)));
216 std::unordered_map<uint32_t,
220 std::unordered_map<uint32_t,
248 unsigned *numBankAccesses);
293 "reference count should not be below zero");
307 "reference count should not be below zero or at zero to"
326 auto dispatchIter =
chunkMap.find(dispatchId);
328 "could not locate this dispatch id [%d]", dispatchId);
330 auto workgroup = dispatchIter->second.find(wgId);
331 fatal_if(workgroup == dispatchIter->second.end(),
332 "could not find this workgroup id within this dispatch id"
333 " did[%d] wgid[%d]", dispatchId, wgId);
335 auto refCountIter =
refCounter.find(dispatchId);
337 fatal(
"could not locate this dispatch id [%d]", dispatchId);
339 auto workgroup = refCountIter->second.find(wgId);
340 if (workgroup == refCountIter->second.end()) {
341 fatal(
"could not find this workgroup id within this dispatch id"
342 " did[%d] wgid[%d]", dispatchId, wgId);
348 fatal(
"should not reach this point");
363 "duplicate workgroup ID asking for space in the LDS "
364 "did[%d] wgid[%d]", dispatchId, wgId);
368 "request would ask for more space than is available");
441 if (if_name ==
"cuPort") {
445 fatal(
"cannot resolve the port name " + if_name);
465 auto dispatchIter =
chunkMap.find(x_dispatchId);
467 if (dispatchIter ==
chunkMap.end()) {
468 fatal(
"dispatch id not found [%d]", x_dispatchId);
470 auto workgroupIter = dispatchIter->second.find(x_wgId);
471 if (workgroupIter == dispatchIter->second.end()) {
472 fatal(
"workgroup id [%d] not found in dispatch id [%d]",
473 x_wgId, x_dispatchId);
478 "releasing more space than was allocated");
508 #endif // __LDS_STATE_HH__
void atomicOperation(PacketPtr packet)
GPUDynInstPtr getDynInstr(PacketPtr packet)
an event to allow event-driven execution
virtual void process()
wake up at this time and perform specified actions
std::queue< std::pair< Tick, PacketPtr > > returnQueue
std::vector< uint8_t > chunk
TickEvent(LdsState *_ldsState)
bool returnQueuePush(std::pair< Tick, PacketPtr > thePair)
add this to the queue of packets to be returned
virtual void recvFunctional(PacketPtr pkt)
receive a packet in functional mode
LdsState(const Params *params)
the default constructor that works with SWIG
vector< EventQueue * > mainEventQueue
Array for main event queues.
bool processPacket(PacketPtr packet)
process an incoming packet, add it to the return queue
A SlavePort is a specialisation of a port.
this represents a slice of the overall LDS, intended to be associated with an individual workgroup ...
AddrRange getAddrRange() const
A BaseSlavePort is a protocol-agnostic slave port, responsible only for the structural connection to ...
CuSidePort(const std::string &_name, LdsState *_ownerLds)
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
std::shared_ptr< GPUDynInst > GPUDynInstPtr
void loadData(PacketPtr packet)
virtual void recvRangeChange()
void setRetryResp(const bool value)
virtual void recvRetry()
receive a retry
Tick curTick()
The current simulated tick.
Tick earliestReturnTime() const
int getRefCounter(const uint32_t dispatchId, const uint32_t wgId) const
return the current reference count for this workgroup id
std::size_t ldsSize(const uint32_t x_wgId)
get the allocated size for this workgroup
Tick when() const
Get the time that the event is scheduled.
virtual AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
uint64_t Tick
Tick count type.
LdsState & operator=(const LdsState &)=delete
bool canReserve(uint32_t x_size) const
can this much space be reserved for a workgroup?
unsigned countBankConflicts(PacketPtr packet, unsigned *bankAccesses)
derive the gpu mem packet from the packet and then count the bank conflicts
virtual void recvRespRetry()
receive a retry for a response
std::unordered_map< uint32_t, std::unordered_map< uint32_t, int32_t > > refCounter
int increaseRefCounter(const uint32_t dispatchId, const uint32_t wgId)
use the dynamic wave id to create or just increase the reference count
int decreaseRefCounter(const uint32_t dispatchId, const uint32_t wgId)
decrease the reference count after making sure it is in the list give back this chunk if the ref coun...
T read(const uint32_t index)
a read operation
int getBankConflictPenalty() const
virtual Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the master port.
LdsChunk(const uint32_t x_size)
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
ComputeUnit * getComputeUnit() const
static SimObject * find(const char *name)
Find the SimObject with the given name and return a pointer to it.
std::unordered_map< uint32_t, std::unordered_map< uint32_t, LdsChunk > > chunkMap
void storeData(PacketPtr packet)
virtual BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx)
Get a slave port with a given name and index.
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
LdsChunk * reserveSpace(const uint32_t dispatchId, const uint32_t wgId, const uint32_t size)
assign a parent and request this amount of space be set aside for this wgid
const SimObjectParams * _params
Cached copy of the object parameters.
const Params * params() const
void write(const uint32_t index, const T value)
a write operation
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
bool releaseSpace(const uint32_t x_dispatchId, const uint32_t x_wgId)
give back the space
fatal_if(p->js_features.size() > 16,"Too many job slot feature registers specified (%i)\n", p->js_features.size())
ComputeUnit * getParent() const
bool process()
look for packets to return at this time
std::vector< uint8_t >::size_type size() const
get the size of this chunk
CuSidePort is the LDS Port closer to the CU side.
void setParent(ComputeUnit *x_parent)
set the parent and name based on the parent
virtual bool recvTimingReq(PacketPtr pkt)
receive the packet from the CU