From 85680ea58e26314cf6187c7be6b0e171b1e79fc4 Mon Sep 17 00:00:00 2001 From: Vishnu Ramadas Date: Wed, 7 Feb 2024 12:22:06 -0600 Subject: [PATCH] gpu-compute: Remove unused and redundant functions In ComputeUnit, a previous commit added a SystemHubEvent event class to the SQCPort. This was found to be unnecessary during the review process and is removed in this commit. Similarly, invBuf() which was added in FetchUnit as part of an earlier commit was found to be redundant. This commit removes it Change-Id: I6ee8d344d29e7bfade49fb9549654b71e3c4b96f --- src/gpu-compute/compute_unit.cc | 8 +++--- src/gpu-compute/compute_unit.hh | 18 ------------- src/gpu-compute/fetch_unit.cc | 45 ++++++++++----------------------- src/gpu-compute/fetch_unit.hh | 3 +-- 4 files changed, 17 insertions(+), 57 deletions(-) diff --git a/src/gpu-compute/compute_unit.cc b/src/gpu-compute/compute_unit.cc index ba4c14c4f0..e485aa6161 100644 --- a/src/gpu-compute/compute_unit.cc +++ b/src/gpu-compute/compute_unit.cc @@ -1085,11 +1085,9 @@ ComputeUnit::SQCPort::MemReqEvent::process() SenderState *sender_state = safe_cast(pkt->senderState); [[maybe_unused]] ComputeUnit *compute_unit = sqcPort.computeUnit; - if (pkt->req->systemReq()) { - assert(compute_unit->shader->systemHub); - SystemHubEvent *resp_event = new SystemHubEvent(pkt, &sqcPort); - compute_unit->shader->systemHub->sendRequest(pkt, resp_event); - } else if (!(sqcPort.sendTimingReq(pkt))) { + assert(!pkt->req->systemReq()); + + if (!(sqcPort.sendTimingReq(pkt))) { sqcPort.retries.push_back(std::pair (pkt, sender_state->wavefront)); } diff --git a/src/gpu-compute/compute_unit.hh b/src/gpu-compute/compute_unit.hh index 7e3f05d070..cfa145551f 100644 --- a/src/gpu-compute/compute_unit.hh +++ b/src/gpu-compute/compute_unit.hh @@ -698,24 +698,6 @@ class ComputeUnit : public ClockedObject const char *description() const; }; - class SystemHubEvent : public Event - { - SQCPort *sqcPort; - PacketPtr reqPkt; - - public: - SystemHubEvent(PacketPtr pkt, SQCPort *_sqcPort) - : sqcPort(_sqcPort), reqPkt(pkt) - { - setFlags(Event::AutoDelete); - } - - void - process() - { - } - }; - std::deque> retries; protected: diff --git a/src/gpu-compute/fetch_unit.cc b/src/gpu-compute/fetch_unit.cc index 3fe181b519..20b89f6384 100644 --- a/src/gpu-compute/fetch_unit.cc +++ b/src/gpu-compute/fetch_unit.cc @@ -320,7 +320,7 @@ FetchUnit::processFetchReturn(PacketPtr pkt) assert(!fetchBuf.at(wavefront->wfSlotId).hasFetchDataToProcess()); wavefront->dropFetch = false; } else { - fetchBuf.at(wavefront->wfSlotId).fetchDone(pkt->req->getVaddr()); + fetchBuf.at(wavefront->wfSlotId).fetchDone(pkt); } wavefront->pendingFetch = false; @@ -388,28 +388,6 @@ FetchUnit::FetchBufDesc::flushBuf() wavefront->wfDynId); } -void -FetchUnit::FetchBufDesc::invBuf() -{ - restartFromBranch = false; - /** - * free list may have some entries - * so we clear it here to avoid duplicates - */ - freeList.clear(); - bufferedPCs.clear(); - reservedPCs.clear(); - readPtr = bufStart; - - for (int i = 0; i < fetchDepth; ++i) { - freeList.push_back(bufStart + i * cacheLineSize); - } - - DPRINTF(GPUFetch, "WF[%d][%d]: Id%d Fetch dropped, flushing fetch " - "buffer\n", wavefront->simdId, wavefront->wfSlotId, - wavefront->wfDynId); -} - Addr FetchUnit::FetchBufDesc::nextFetchAddr() { @@ -491,20 +469,23 @@ FetchUnit::FetchBufDesc::reserveBuf(Addr vaddr) } void -FetchUnit::FetchBufDesc::fetchDone(Addr vaddr) +FetchUnit::FetchBufDesc::fetchDone(PacketPtr pkt) { - // If the return vaddr is 0, then it belongs to an SQC invalidation - // request. This request calls incLGKMInstsIssued() function in its - // execution path. Since there is no valid memory return response - // associated with this instruction, decLGKMInstsIssued() is not - // executed. Do this here to decrement the counter and invalidate - // all buffers - if (vaddr == 0) { + // If the return command is MemSyncResp, then it belongs to + // an SQC invalidation request. This request calls + // incLGKMInstsIssued() function in its execution path. + // Since there is no valid memory return response associated with + // this instruction, decLGKMInstsIssued() is not executed. Do this + // here to decrement the counter and invalidate all buffers + if (pkt->cmd == MemCmd::MemSyncResp) { wavefront->decLGKMInstsIssued(); - invBuf(); + flushBuf(); + restartFromBranch = false; return; } + Addr vaddr = pkt->req->getVaddr(); + assert(bufferedPCs.find(vaddr) == bufferedPCs.end()); DPRINTF(GPUFetch, "WF[%d][%d]: Id%d done fetching for addr %#x\n", wavefront->simdId, wavefront->wfSlotId, diff --git a/src/gpu-compute/fetch_unit.hh b/src/gpu-compute/fetch_unit.hh index 99c91b7299..85bf2472ec 100644 --- a/src/gpu-compute/fetch_unit.hh +++ b/src/gpu-compute/fetch_unit.hh @@ -104,7 +104,6 @@ class FetchUnit int reservedLines() const { return reservedPCs.size(); } bool hasFreeSpace() const { return !freeList.empty(); } void flushBuf(); - void invBuf(); Addr nextFetchAddr(); /** @@ -139,7 +138,7 @@ class FetchUnit return is_reserved; } - void fetchDone(Addr vaddr); + void fetchDone(PacketPtr ptr); /** * checks if the buffer contains valid data. this essentially