53 cuPort(
name() +
".port", this),
54 maximumSize(params->size),
56 bankConflictPenalty(params->bankConflictPenalty),
60 "Number of LDS banks should be positive number");
61 fatal_if((params->banks & (params->banks - 1)) != 0,
62 "Number of LDS banks should be a power of 2");
64 "cannot allocate an LDS with a size less than 1");
66 "the LDS should be an even number");
73 LdsStateParams::create()
85 fatal_if(!x_parent,
"x_parent should not be nullptr");
87 "should not be setting the parent twice");
107 "did not get the right sort of sender state");
117 unsigned *numBankAccesses)
119 int bank_conflicts = 0;
128 for (
int i = 0;
i < groups;
i++) {
131 addr_array.resize(numBanks, 0);
133 bank.resize(
banks, 0);
137 for (
int j = 0;
j < numBanks;
j++) {
138 if (gpuDynInst->exec_mask[(
i*numBanks)+
j]) {
139 addr_array[
j] = gpuDynInst->addr[(
i*numBanks)+
j];
141 addr_array[
j] = std::numeric_limits<Addr>::max();
145 if (gpuDynInst->isLoad() || gpuDynInst->isStore()) {
147 for (
int j = 0;
j < numBanks; ++
j) {
148 for (
int j0 = 0; j0 <
j; j0++) {
149 if (addr_array[j] != std::numeric_limits<Addr>::max()
150 && addr_array[
j] == addr_array[j0]) {
151 addr_array[
j] = std::numeric_limits<Addr>::max();
157 for (
int j = 0;
j < numBanks; ++
j) {
158 if (addr_array[
j] != std::numeric_limits<Addr>::max()) {
159 int bankId = addr_array[
j] %
banks;
161 max_bank = std::max(max_bank, bank[bankId]);
166 (*numBankAccesses)++;
169 bank_conflicts += max_bank;
172 "Max bank conflicts should match num of work items per instr");
173 return bank_conflicts;
182 return ownerLds->processPacket(packet);
200 unsigned bankAccesses = 0;
215 Tick processingTime =
249 fatal(
"not implemented");
259 assert(ownerLds->isRetryResp());
260 ownerLds->setRetryResp(
false);
270 fatal(
"not implemented");
291 gpuDynInst->initiateAcc(gpuDynInst);
301 panic(
"have not handled timing responses being NACK'd when sent" #define panic(...)
This implements a cprintf based panic() function.
GPUDynInstPtr getDynInstr(PacketPtr packet)
virtual void process()
wake up at this time and perform specified actions
#define fatal(...)
This implements a cprintf based fatal() function.
const std::string & name()
Tick earliestReturnTime() const
Tick when() const
Get the time that the event is scheduled.
std::queue< std::pair< Tick, PacketPtr > > returnQueue
void makeTimingResponse()
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
bool processPacket(PacketPtr packet)
process an incoming packet, add it to the return queue
Stats::Distribution ldsBankConflictDist
std::shared_ptr< GPUDynInst > GPUDynInstPtr
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the master port by calling its corresponding receive function...
virtual void recvRetry()
receive a retry
bool scheduled() const
Determine if the current event is scheduled.
SenderState * predecessor
uint64_t Tick
Tick count type.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
GPUDynInstPtr getMemInst() const
unsigned countBankConflicts(PacketPtr packet, unsigned *bankAccesses)
derive the gpu mem packet from the packet and then count the bank conflicts
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
virtual void recvRespRetry()
receive a retry for a response
virtual const std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
A virtual base opaque structure used to hold state associated with the packet (e.g., an MSHR), specific to a SimObject that sees the packet.
SenderState is information carried along with the packet, esp.
SenderState * senderState
This packet's sender state.
Tick ticks(int numCycles) const
Stats::Scalar ldsBankAccesses
bool process()
look for packets to return at this time
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void setParent(ComputeUnit *x_parent)
set the parent and name based on the parent
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
virtual bool recvTimingReq(PacketPtr pkt)
receive the packet from the CU