38#include "debug/AMDGPUMem.hh"
39#include "params/AMDGPUMemoryManager.hh"
47 cacheLineSize(
p.
system->cacheLineSize()),
48 _requestorId(
p.
system->getRequestorId(this))
62 std::forward_as_tuple(
requestId), std::tuple<>{});
72 uint8_t *dataPtr =
new uint8_t[gen.
size()];
73 std::memcpy(dataPtr,
data + (gen.
complete()/
sizeof(uint8_t)),
85 DPRINTF(AMDGPUMem,
"Request to %#lx needs retry\n", gen.
addr());
88 DPRINTF(AMDGPUMem,
"Write request to %#lx sent\n", gen.
addr());
100 uint8_t *dataPtr =
data;
106 std::forward_as_tuple(
requestId), std::tuple<>{});
117 dataPtr += gen.
size();
127 DPRINTF(AMDGPUMem,
"Request to %#lx needs retry\n", gen.
addr());
130 DPRINTF(AMDGPUMem,
"Read request to %#lx sent\n", gen.
addr());
149 assert(
status.outstandingChunks != 0);
150 status.outstandingChunks--;
151 DPRINTF(AMDGPUMem,
"Received Response for %#x. %d chunks remain, sent "
152 "last = %d, requestId = %ld\n", sender_state->
_addr,
156 if (!
status.outstandingChunks &&
status.sentLastChunk) {
159 DPRINTF(AMDGPUMem,
"Calling callback for request %ld\n",
164 DPRINTF(AMDGPUMem,
"Deleting status for request %ld\n",
177 for (
const auto &pkt : retries) {
178 if (!sendTimingReq(pkt)) {
181 DPRINTF(AMDGPUMem,
"Retry for %#lx sent\n", pkt->getAddr());
Declaration and inline definition of ChunkGenerator object.
std::deque< PacketPtr > retries
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the peer.
AMDGPUMemoryManager & gpu_mem
void recvReqRetry() override
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
std::unordered_map< uint64_t, RequestStatus > requestStatus
AMDGPUMemoryManager(const AMDGPUMemoryManagerParams &p)
const RequestorID _requestorId
void writeRequest(Addr addr, uint8_t *data, int size, Request::Flags flag, Event *callback)
Write size amount of data to device memory at addr using flags and callback.
void readRequest(Addr addr, uint8_t *data, int size, Request::Flags flag, Event *callback)
Read size amount of data from device memory at addr using flags and callback.
This class takes an arbitrary memory region (address/length pair) and generates a series of appropria...
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
static PacketPtr createWrite(const RequestPtr &req)
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
SenderState * senderState
This packet's sender state.
void pushSenderState(SenderState *sender_state)
Push a new sender state to the packet and make the current sender state the predecessor of the new on...
static PacketPtr createRead(const RequestPtr &req)
Constructor-like methods that return Packets based on Request objects.
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
bool last() const
Is this the last chunk?
Addr addr() const
Return starting address of current chunk.
Addr complete() const
Number of bytes we have already chunked up.
bool done() const
Are we done? That is, did the last call to next() advance past the end of the region?
Addr size() const
Return size in bytes of current chunk.
bool next()
Advance generator to next chunk.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
T safe_cast(U &&ref_or_ptr)
std::shared_ptr< Request > RequestPtr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
std::string csprintf(const char *format, const Args &...args)
const std::string & name()