Go to the documentation of this file.
34 #ifndef __LDS_STATE_HH__
35 #define __LDS_STATE_HH__
40 #include <unordered_map>
46 #include "params/LdsState.hh"
227 std::unordered_map<uint32_t,
231 std::unordered_map<uint32_t,
259 unsigned *numBankAccesses);
304 "reference count should not be below zero");
318 "reference count should not be below zero or at zero to"
337 auto dispatchIter =
chunkMap.find(dispatchId);
339 "could not locate this dispatch id [%d]", dispatchId);
341 auto workgroup = dispatchIter->second.find(wgId);
342 fatal_if(workgroup == dispatchIter->second.end(),
343 "could not find this workgroup id within this dispatch id"
344 " did[%d] wgid[%d]", dispatchId, wgId);
346 auto refCountIter =
refCounter.find(dispatchId);
348 fatal(
"could not locate this dispatch id [%d]", dispatchId);
350 auto workgroup = refCountIter->second.find(wgId);
351 if (workgroup == refCountIter->second.end()) {
352 fatal(
"could not find this workgroup id within this dispatch id"
353 " did[%d] wgid[%d]", dispatchId, wgId);
359 fatal(
"should not reach this point");
374 "duplicate workgroup ID asking for space in the LDS "
375 "did[%d] wgid[%d]", dispatchId, wgId);
384 panic_if(!value.second,
"was unable to allocate a new chunkMap");
400 "fetch for unknown dispatch ID did[%d]", dispatchId);
403 "fetch for unknown workgroup ID wgid[%d] in dispatch ID did[%d]",
471 if (if_name ==
"cuPort") {
475 fatal(
"cannot resolve the port name " + if_name);
495 auto dispatchIter =
chunkMap.find(x_dispatchId);
497 if (dispatchIter ==
chunkMap.end()) {
498 fatal(
"dispatch id not found [%d]", x_dispatchId);
500 auto workgroupIter = dispatchIter->second.find(x_wgId);
501 if (workgroupIter == dispatchIter->second.end()) {
502 fatal(
"workgroup id [%d] not found in dispatch id [%d]",
503 x_wgId, x_dispatchId);
508 "releasing more space than was allocated");
538 #endif // __LDS_STATE_HH__
#define fatal(...)
This implements a cprintf based fatal() function.
virtual void recvRetry()
receive a retry
A ResponsePort is a specialization of a port.
void loadData(PacketPtr packet)
void write(const uint32_t index, const T value)
a write operation
LdsState & operator=(const LdsState &)=delete
CuSidePort is the LDS Port closer to the CU side.
virtual void process()
wake up at this time and perform specified actions
AddrRange getAddrRange() const
uint64_t Tick
Tick count type.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
bool returnQueuePush(std::pair< Tick, PacketPtr > thePair)
add this to the queue of packets to be returned
virtual bool recvTimingReq(PacketPtr pkt)
receive the packet from the CU
ComputeUnit * getComputeUnit() const
ComputeUnit * getParent() const
const Params * params() const
bool process()
look for packets to return at this time
an event to allow event-driven execution
Tick when() const
Get the time that the event is scheduled.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
virtual Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
int getRefCounter(const uint32_t dispatchId, const uint32_t wgId) const
return the current reference count for this workgroup id
std::vector< uint8_t > chunk
vector< EventQueue * > mainEventQueue
Array for main event queues.
std::unordered_map< uint32_t, std::unordered_map< uint32_t, int32_t > > refCounter
the lds reference counter The key is the workgroup ID and dispatch ID The value is the number of wave...
Port & getPort(const std::string &if_name, PortID idx)
Get a port with a given name and index.
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
std::queue< std::pair< Tick, PacketPtr > > returnQueue
Tick earliestReturnTime() const
virtual void recvFunctional(PacketPtr pkt)
receive a packet in functional mode
LdsState(const Params *params)
the default constructor that works with SWIG
void storeData(PacketPtr packet)
Ports are used to interface objects to each other.
virtual AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
GPUDynInstPtr getDynInstr(PacketPtr packet)
CuSidePort(const std::string &_name, LdsState *_ownerLds)
std::size_t ldsSize(const uint32_t x_wgId)
get the allocated size for this workgroup
std::unordered_map< uint32_t, std::unordered_map< uint32_t, LdsChunk > > chunkMap
unsigned countBankConflicts(PacketPtr packet, unsigned *bankAccesses)
derive the gpu mem packet from the packet and then count the bank conflicts
virtual void recvRangeChange()
bool releaseSpace(const uint32_t x_dispatchId, const uint32_t x_wgId)
give back the space
void atomicOperation(PacketPtr packet)
void setParent(ComputeUnit *x_parent)
set the parent and name based on the parent
bool processPacket(PacketPtr packet)
process an incoming packet, add it to the return queue
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
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...
TickEvent(LdsState *_ldsState)
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.
T read(const uint32_t index)
a read operation
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
LdsChunk(const uint32_t x_size)
std::shared_ptr< GPUDynInst > GPUDynInstPtr
this represents a slice of the overall LDS, intended to be associated with an individual workgroup
void setRetryResp(const bool value)
int getBankConflictPenalty() const
virtual void recvRespRetry()
receive a retry for a response
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
int increaseRefCounter(const uint32_t dispatchId, const uint32_t wgId)
use the dynamic wave id to create or just increase the reference count
LdsChunk * getLdsChunk(const uint32_t dispatchId, const uint32_t wgId)
static SimObject * find(const char *name)
Find the SimObject with the given name and return a pointer to it.
Tick curTick()
The current simulated tick.
bool canReserve(uint32_t x_size) const
can this much space be reserved for a workgroup?
std::vector< uint8_t >::size_type size() const
get the size of this chunk
Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17