gpu-compute: Init CU object for pipe stages in their ctors
This change updates the constructors of the CU's pipe stages/memory pipelines to accept a pointer to their parent CU. Because the CU creates these objects, and can pass a pointer to itself to these object via their constructors, this is the safer way to initalize these classes. Change-Id: I0b3732ce7c03781ee15332dac7a21c097ad387a4 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29945 Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com> Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Anthony Gutierrez
parent
ea52df816d
commit
0c5d671ea1
@@ -66,9 +66,14 @@ ComputeUnit::ComputeUnit(const Params *p) : ClockedObject(p),
|
||||
numScalarALUs(p->num_scalar_cores),
|
||||
vrfToCoalescerBusWidth(p->vrf_to_coalescer_bus_width),
|
||||
coalescerToVrfBusWidth(p->coalescer_to_vrf_bus_width),
|
||||
registerManager(p->register_manager), fetchStage(p),
|
||||
scoreboardCheckStage(p), scheduleStage(p, this), execStage(p),
|
||||
globalMemoryPipe(p), localMemoryPipe(p), scalarMemoryPipe(p),
|
||||
registerManager(p->register_manager),
|
||||
fetchStage(p, this),
|
||||
scoreboardCheckStage(p, this),
|
||||
scheduleStage(p, this),
|
||||
execStage(p, this),
|
||||
globalMemoryPipe(p, this),
|
||||
localMemoryPipe(p, this),
|
||||
scalarMemoryPipe(p, this),
|
||||
tickEvent([this]{ exec(); }, "Compute unit tick event",
|
||||
false, Event::CPU_Tick_Pri),
|
||||
cu_id(p->cu_id),
|
||||
@@ -788,13 +793,11 @@ ComputeUnit::init()
|
||||
dispatchList.push_back(std::make_pair(nullptr, EMPTY));
|
||||
}
|
||||
|
||||
fetchStage.init(this);
|
||||
scoreboardCheckStage.init(this);
|
||||
scheduleStage.init(this);
|
||||
execStage.init(this);
|
||||
globalMemoryPipe.init(this);
|
||||
localMemoryPipe.init(this);
|
||||
scalarMemoryPipe.init(this);
|
||||
fetchStage.init();
|
||||
scoreboardCheckStage.init();
|
||||
scheduleStage.init();
|
||||
execStage.init();
|
||||
globalMemoryPipe.init();
|
||||
|
||||
gmTokenPort.setTokenManager(memPortTokens);
|
||||
}
|
||||
|
||||
@@ -41,19 +41,19 @@
|
||||
#include "gpu-compute/vector_register_file.hh"
|
||||
#include "gpu-compute/wavefront.hh"
|
||||
|
||||
ExecStage::ExecStage(const ComputeUnitParams *p) : lastTimeInstExecuted(false),
|
||||
thisTimeInstExecuted(false), instrExecuted (false),
|
||||
executionResourcesUsed(0)
|
||||
ExecStage::ExecStage(const ComputeUnitParams *p, ComputeUnit *cu)
|
||||
: computeUnit(cu), lastTimeInstExecuted(false),
|
||||
thisTimeInstExecuted(false), instrExecuted (false),
|
||||
executionResourcesUsed(0), _name(cu->name() + ".ExecStage")
|
||||
|
||||
{
|
||||
numTransActiveIdle = 0;
|
||||
idle_dur = 0;
|
||||
}
|
||||
|
||||
void
|
||||
ExecStage::init(ComputeUnit *cu)
|
||||
ExecStage::init()
|
||||
{
|
||||
computeUnit = cu;
|
||||
_name = computeUnit->name() + ".ExecStage";
|
||||
dispatchList = &computeUnit->dispatchList;
|
||||
idle_dur = 0;
|
||||
}
|
||||
|
||||
@@ -69,9 +69,9 @@ enum DISPATCH_STATUS
|
||||
class ExecStage
|
||||
{
|
||||
public:
|
||||
ExecStage(const ComputeUnitParams* params);
|
||||
ExecStage(const ComputeUnitParams* p, ComputeUnit *cu);
|
||||
~ExecStage() { }
|
||||
void init(ComputeUnit *cu);
|
||||
void init();
|
||||
void exec();
|
||||
|
||||
std::string dispStatusToStr(int j);
|
||||
|
||||
@@ -36,11 +36,12 @@
|
||||
#include "gpu-compute/compute_unit.hh"
|
||||
#include "gpu-compute/wavefront.hh"
|
||||
|
||||
FetchStage::FetchStage(const ComputeUnitParams* p) :
|
||||
numVectorALUs(p->num_SIMDs), computeUnit(nullptr)
|
||||
FetchStage::FetchStage(const ComputeUnitParams* p, ComputeUnit *cu)
|
||||
: numVectorALUs(p->num_SIMDs), computeUnit(cu),
|
||||
_name(cu->name() + ".FetchStage")
|
||||
{
|
||||
for (int j = 0; j < numVectorALUs; ++j) {
|
||||
FetchUnit newFetchUnit(p);
|
||||
FetchUnit newFetchUnit(p, cu);
|
||||
_fetchUnit.push_back(newFetchUnit);
|
||||
}
|
||||
}
|
||||
@@ -51,14 +52,11 @@ FetchStage::~FetchStage()
|
||||
}
|
||||
|
||||
void
|
||||
FetchStage::init(ComputeUnit *cu)
|
||||
FetchStage::init()
|
||||
{
|
||||
computeUnit = cu;
|
||||
_name = computeUnit->name() + ".FetchStage";
|
||||
|
||||
for (int j = 0; j < numVectorALUs; ++j) {
|
||||
_fetchUnit[j].bindWaveList(&computeUnit->wfList[j]);
|
||||
_fetchUnit[j].init(computeUnit);
|
||||
_fetchUnit[j].init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ class Wavefront;
|
||||
class FetchStage
|
||||
{
|
||||
public:
|
||||
FetchStage(const ComputeUnitParams* params);
|
||||
FetchStage(const ComputeUnitParams* p, ComputeUnit *cu);
|
||||
~FetchStage();
|
||||
void init(ComputeUnit *cu);
|
||||
void init();
|
||||
void exec();
|
||||
void processFetchReturn(PacketPtr pkt);
|
||||
void fetch(PacketPtr pkt, Wavefront *wave);
|
||||
|
||||
@@ -45,9 +45,9 @@
|
||||
|
||||
uint32_t FetchUnit::globalFetchUnitID;
|
||||
|
||||
FetchUnit::FetchUnit(const ComputeUnitParams* params)
|
||||
: timingSim(true), computeUnit(nullptr), fetchScheduler(params),
|
||||
waveList(nullptr), fetchDepth(params->fetch_depth)
|
||||
FetchUnit::FetchUnit(const ComputeUnitParams *p, ComputeUnit *cu)
|
||||
: timingSim(true), computeUnit(cu), fetchScheduler(p),
|
||||
waveList(nullptr), fetchDepth(p->fetch_depth)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,9 +58,8 @@ FetchUnit::~FetchUnit()
|
||||
}
|
||||
|
||||
void
|
||||
FetchUnit::init(ComputeUnit *cu)
|
||||
FetchUnit::init()
|
||||
{
|
||||
computeUnit = cu;
|
||||
timingSim = computeUnit->shader->timingSim;
|
||||
fetchQueue.clear();
|
||||
fetchStatusQueue.resize(computeUnit->shader->n_wf);
|
||||
|
||||
@@ -49,9 +49,9 @@ class Wavefront;
|
||||
class FetchUnit
|
||||
{
|
||||
public:
|
||||
FetchUnit(const ComputeUnitParams* params);
|
||||
FetchUnit(const ComputeUnitParams* p, ComputeUnit *cu);
|
||||
~FetchUnit();
|
||||
void init(ComputeUnit *cu);
|
||||
void init();
|
||||
void exec();
|
||||
void bindWaveList(std::vector<Wavefront*> *list);
|
||||
void initiateFetch(Wavefront *wavefront);
|
||||
|
||||
@@ -43,19 +43,19 @@
|
||||
#include "gpu-compute/vector_register_file.hh"
|
||||
#include "gpu-compute/wavefront.hh"
|
||||
|
||||
GlobalMemPipeline::GlobalMemPipeline(const ComputeUnitParams* p) :
|
||||
computeUnit(nullptr), gmQueueSize(p->global_mem_queue_size),
|
||||
maxWaveRequests(p->max_wave_requests), inflightStores(0),
|
||||
inflightLoads(0)
|
||||
GlobalMemPipeline::GlobalMemPipeline(const ComputeUnitParams* p,
|
||||
ComputeUnit *cu)
|
||||
: computeUnit(cu), _name(cu->name() + ".GlobalMemPipeline"),
|
||||
gmQueueSize(p->global_mem_queue_size),
|
||||
maxWaveRequests(p->max_wave_requests), inflightStores(0),
|
||||
inflightLoads(0)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
GlobalMemPipeline::init(ComputeUnit *cu)
|
||||
GlobalMemPipeline::init()
|
||||
{
|
||||
computeUnit = cu;
|
||||
globalMemSize = computeUnit->shader->globalMemSize;
|
||||
_name = computeUnit->name() + ".GlobalMemPipeline";
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -56,8 +56,8 @@ class ComputeUnit;
|
||||
class GlobalMemPipeline
|
||||
{
|
||||
public:
|
||||
GlobalMemPipeline(const ComputeUnitParams *params);
|
||||
void init(ComputeUnit *cu);
|
||||
GlobalMemPipeline(const ComputeUnitParams *p, ComputeUnit *cu);
|
||||
void init();
|
||||
void exec();
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,18 +41,12 @@
|
||||
#include "gpu-compute/vector_register_file.hh"
|
||||
#include "gpu-compute/wavefront.hh"
|
||||
|
||||
LocalMemPipeline::LocalMemPipeline(const ComputeUnitParams* p) :
|
||||
computeUnit(nullptr), lmQueueSize(p->local_mem_queue_size)
|
||||
LocalMemPipeline::LocalMemPipeline(const ComputeUnitParams* p, ComputeUnit *cu)
|
||||
: computeUnit(cu), _name(cu->name() + ".LocalMemPipeline"),
|
||||
lmQueueSize(p->local_mem_queue_size)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LocalMemPipeline::init(ComputeUnit *cu)
|
||||
{
|
||||
computeUnit = cu;
|
||||
_name = computeUnit->name() + ".LocalMemPipeline";
|
||||
}
|
||||
|
||||
void
|
||||
LocalMemPipeline::exec()
|
||||
{
|
||||
|
||||
@@ -55,8 +55,7 @@ class Wavefront;
|
||||
class LocalMemPipeline
|
||||
{
|
||||
public:
|
||||
LocalMemPipeline(const ComputeUnitParams *params);
|
||||
void init(ComputeUnit *cu);
|
||||
LocalMemPipeline(const ComputeUnitParams *p, ComputeUnit *cu);
|
||||
void exec();
|
||||
std::queue<GPUDynInstPtr> &getLMRespFIFO() { return lmReturnedRequests; }
|
||||
|
||||
|
||||
@@ -43,19 +43,14 @@
|
||||
#include "gpu-compute/shader.hh"
|
||||
#include "gpu-compute/wavefront.hh"
|
||||
|
||||
ScalarMemPipeline::ScalarMemPipeline(const ComputeUnitParams* p) :
|
||||
computeUnit(nullptr), queueSize(p->scalar_mem_queue_size),
|
||||
inflightStores(0), inflightLoads(0)
|
||||
ScalarMemPipeline::ScalarMemPipeline(const ComputeUnitParams* p,
|
||||
ComputeUnit *cu)
|
||||
: computeUnit(cu), _name(cu->name() + ".ScalarMemPipeline"),
|
||||
queueSize(p->scalar_mem_queue_size),
|
||||
inflightStores(0), inflightLoads(0)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ScalarMemPipeline::init(ComputeUnit *cu)
|
||||
{
|
||||
computeUnit = cu;
|
||||
_name = computeUnit->name() + ".ScalarMemPipeline";
|
||||
}
|
||||
|
||||
void
|
||||
ScalarMemPipeline::exec()
|
||||
{
|
||||
|
||||
@@ -59,8 +59,7 @@ class ComputeUnit;
|
||||
class ScalarMemPipeline
|
||||
{
|
||||
public:
|
||||
ScalarMemPipeline(const ComputeUnitParams *params);
|
||||
void init(ComputeUnit *cu);
|
||||
ScalarMemPipeline(const ComputeUnitParams *p, ComputeUnit *cu);
|
||||
void exec();
|
||||
|
||||
std::queue<GPUDynInstPtr> &getGMReqFIFO() { return issuedRequests; }
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
#include "gpu-compute/wavefront.hh"
|
||||
|
||||
ScheduleStage::ScheduleStage(const ComputeUnitParams *p, ComputeUnit *cu)
|
||||
: vectorAluRdy(false), scalarAluRdy(false), scalarMemBusRdy(false),
|
||||
: computeUnit(cu), _name(cu->name() + ".ScheduleStage"),
|
||||
vectorAluRdy(false), scalarAluRdy(false), scalarMemBusRdy(false),
|
||||
scalarMemIssueRdy(false), glbMemBusRdy(false), glbMemIssueRdy(false),
|
||||
locMemBusRdy(false), locMemIssueRdy(false)
|
||||
{
|
||||
@@ -66,10 +67,8 @@ ScheduleStage::~ScheduleStage()
|
||||
}
|
||||
|
||||
void
|
||||
ScheduleStage::init(ComputeUnit *cu)
|
||||
ScheduleStage::init()
|
||||
{
|
||||
computeUnit = cu;
|
||||
_name = computeUnit->name() + ".ScheduleStage";
|
||||
|
||||
fatal_if(scheduler.size() != computeUnit->readyList.size(),
|
||||
"Scheduler should have same number of entries as CU's readyList");
|
||||
|
||||
@@ -57,9 +57,9 @@ struct ComputeUnitParams;
|
||||
class ScheduleStage
|
||||
{
|
||||
public:
|
||||
ScheduleStage(const ComputeUnitParams *params, ComputeUnit *cu);
|
||||
ScheduleStage(const ComputeUnitParams *p, ComputeUnit *cu);
|
||||
~ScheduleStage();
|
||||
void init(ComputeUnit *cu);
|
||||
void init();
|
||||
void exec();
|
||||
|
||||
// Stats related variables and methods
|
||||
|
||||
@@ -44,7 +44,9 @@
|
||||
#include "gpu-compute/wavefront.hh"
|
||||
#include "params/ComputeUnit.hh"
|
||||
|
||||
ScoreboardCheckStage::ScoreboardCheckStage(const ComputeUnitParams *p)
|
||||
ScoreboardCheckStage::ScoreboardCheckStage(const ComputeUnitParams *p,
|
||||
ComputeUnit *cu)
|
||||
: computeUnit(cu), _name(cu->name() + ".ScoreboardCheckStage")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -54,11 +56,8 @@ ScoreboardCheckStage::~ScoreboardCheckStage()
|
||||
}
|
||||
|
||||
void
|
||||
ScoreboardCheckStage::init(ComputeUnit *cu)
|
||||
ScoreboardCheckStage::init()
|
||||
{
|
||||
computeUnit = cu;
|
||||
_name = computeUnit->name() + ".ScoreboardCheckStage";
|
||||
|
||||
for (int unitId = 0; unitId < computeUnit->numExeUnits(); ++unitId) {
|
||||
readyList.push_back(&computeUnit->readyList[unitId]);
|
||||
}
|
||||
|
||||
@@ -70,9 +70,9 @@ class ScoreboardCheckStage
|
||||
NRDY_CONDITIONS
|
||||
};
|
||||
|
||||
ScoreboardCheckStage(const ComputeUnitParams* params);
|
||||
ScoreboardCheckStage(const ComputeUnitParams* p, ComputeUnit *cu);
|
||||
~ScoreboardCheckStage();
|
||||
void init(ComputeUnit *cu);
|
||||
void init();
|
||||
void exec();
|
||||
|
||||
// Stats related variables and methods
|
||||
|
||||
Reference in New Issue
Block a user