gem5
v20.1.0.0
|
#include <shader.hh>
Public Types | |
enum | hsail_mode_e { SIMT, VECTOR_SCALAR } |
typedef ShaderParams | Params |
Public Types inherited from ClockedObject | |
typedef ClockedObjectParams | Params |
Parameters of ClockedObject. More... | |
Public Types inherited from SimObject | |
typedef SimObjectParams | Params |
Public Member Functions | |
GPUDispatcher & | dispatcher () |
void | sampleLoad (const Tick accessTime) |
void | sampleStore (const Tick accessTime) |
void | sampleInstRoundTrip (std::vector< Tick > roundTripTime) |
void | sampleLineRoundTrip (const std::map< Addr, std::vector< Tick >> &roundTripTime) |
const ApertureRegister & | gpuVmApe () const |
const ApertureRegister & | ldsApe () const |
const ApertureRegister & | scratchApe () const |
bool | isGpuVmApe (Addr addr) const |
bool | isLdsApe (Addr addr) const |
bool | isScratchApe (Addr addr) const |
Addr | getScratchBase () |
Addr | getHiddenPrivateBase () |
void | initShHiddenPrivateBase (Addr queueBase, uint32_t offset) |
void | regStats () |
Callback to set stat parameters. More... | |
Shader (const Params *p) | |
~Shader () | |
virtual void | init () |
init() is called after all C++ SimObjects have been created and all ports are connected. More... | |
void | execScheduledAdds () |
void | ScheduleAdd (int *val, Tick when, int x) |
bool | processTimingPacket (PacketPtr pkt) |
void | AccessMem (uint64_t address, void *ptr, uint32_t size, int cu_id, MemCmd cmd, bool suppress_func_errors) |
void | ReadMem (uint64_t address, void *ptr, uint32_t sz, int cu_id) |
void | ReadMem (uint64_t address, void *ptr, uint32_t sz, int cu_id, bool suppress_func_errors) |
void | WriteMem (uint64_t address, void *ptr, uint32_t sz, int cu_id) |
void | WriteMem (uint64_t address, void *ptr, uint32_t sz, int cu_id, bool suppress_func_errors) |
void | doFunctionalAccess (const RequestPtr &req, MemCmd cmd, void *data, bool suppress_func_errors, int cu_id) |
void | registerCU (int cu_id, ComputeUnit *compute_unit) |
void | prepareInvalidate (HSAQueueEntry *task) |
void | prepareFlush (GPUDynInstPtr gpuDynInst) |
dispatcher/shader arranges flush requests to the CUs More... | |
bool | dispatchWorkgroups (HSAQueueEntry *task) |
Addr | mmap (int length) |
void | functionalTLBAccess (PacketPtr pkt, int cu_id, BaseTLB::Mode mode) |
void | updateContext (int cid) |
void | notifyCuSleep () |
Public Member Functions inherited from ClockedObject | |
ClockedObject (const ClockedObjectParams *p) | |
const Params * | params () const |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
Public Member Functions inherited from SimObject | |
const Params * | params () const |
SimObject (const Params *_params) | |
virtual | ~SimObject () |
virtual const std::string | name () const |
virtual void | loadState (CheckpointIn &cp) |
loadState() is called on each SimObject when restoring from a checkpoint. More... | |
virtual void | initState () |
initState() is called on each SimObject when not restoring from a checkpoint. More... | |
virtual void | regProbePoints () |
Register probe points for this object. More... | |
virtual void | regProbeListeners () |
Register probe listeners for this object. More... | |
ProbeManager * | getProbeManager () |
Get the probe manager for this object. More... | |
virtual Port & | getPort (const std::string &if_name, PortID idx=InvalidPortID) |
Get a port with a given name and index. More... | |
virtual void | startup () |
startup() is the final initialization call before simulation. More... | |
DrainState | drain () override |
Provide a default implementation of the drain interface for objects that don't need draining. More... | |
virtual void | memWriteback () |
Write back dirty buffers to memory using functional writes. More... | |
virtual void | memInvalidate () |
Invalidate the contents of memory buffers. More... | |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
Public Member Functions inherited from EventManager | |
EventQueue * | eventQueue () const |
void | schedule (Event &event, Tick when) |
void | deschedule (Event &event) |
void | reschedule (Event &event, Tick when, bool always=false) |
void | schedule (Event *event, Tick when) |
void | deschedule (Event *event) |
void | reschedule (Event *event, Tick when, bool always=false) |
void | wakeupEventQueue (Tick when=(Tick) -1) |
This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers. More... | |
void | setCurTick (Tick newVal) |
EventManager (EventManager &em) | |
Event manger manages events in the event queue. More... | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
Public Member Functions inherited from Serializable | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. More... | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. More... | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Public Member Functions inherited from Drainable | |
DrainState | drainState () const |
Return the current drain state of an object. More... | |
virtual void | notifyFork () |
Notify a child process of a fork. More... | |
Public Member Functions inherited from Stats::Group | |
Group (Group *parent, const char *name=nullptr) | |
Construct a new statistics group. More... | |
virtual | ~Group () |
virtual void | resetStats () |
Callback to reset stats. More... | |
virtual void | preDumpStats () |
Callback before stats are dumped. More... | |
void | addStat (Stats::Info *info) |
Register a stat with this group. More... | |
const std::map< std::string, Group * > & | getStatGroups () const |
Get all child groups associated with this object. More... | |
const std::vector< Info * > & | getStats () const |
Get all stats associated with this object. More... | |
void | addStatGroup (const char *name, Group *block) |
Add a stat block as a child of this block. More... | |
const Info * | resolveStat (std::string name) const |
Resolve a stat by its name within this group. More... | |
Group ()=delete | |
Group (const Group &)=delete | |
Group & | operator= (const Group &)=delete |
Public Member Functions inherited from Clocked | |
void | updateClockPeriod () |
Update the tick to the current tick. More... | |
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 caller to determine a future cycle. More... | |
Cycles | curCycle () const |
Determine the current cycle, corresponding to a tick aligned to a clock edge. More... | |
Tick | nextCycle () const |
Based on the clock of the object, determine the start tick of the first cycle that is at least one cycle in the future. More... | |
uint64_t | frequency () const |
Tick | clockPeriod () const |
double | voltage () const |
Cycles | ticksToCycles (Tick t) const |
Tick | cyclesToTicks (Cycles c) const |
Public Attributes | |
SimpleThread * | cpuThread |
ThreadContext * | gpuTc |
BaseCPU * | cpuPointer |
EventFunctionWrapper | tickEvent |
bool | timingSim |
hsail_mode_e | hsail_mode |
int | impl_kern_launch_acq |
int | impl_kern_end_rel |
int | coissue_return |
int | trace_vgpr_all |
int | n_cu |
int | n_wf |
int | globalMemSize |
int | nextSchedCu |
uint32_t | sa_n |
std::vector< int * > | sa_val |
std::vector< uint64_t > | sa_when |
std::vector< int32_t > | sa_x |
std::vector< ComputeUnit * > | cuList |
GPUCommandProcessor & | gpuCmdProc |
GPUDispatcher & | _dispatcher |
Stats::Scalar | shaderActiveTicks |
Statistics. More... | |
Stats::Vector | vectorInstSrcOperand |
Stats::Vector | vectorInstDstOperand |
int64_t | max_valu_insts |
int64_t | total_valu_insts |
Public Attributes inherited from ClockedObject | |
PowerState * | powerState |
Additional Inherited Members | |
Static Public Member Functions inherited from SimObject | |
static void | serializeAll (CheckpointOut &cp) |
Serialize all SimObjects in the system. More... | |
static SimObject * | find (const char *name) |
Find the SimObject with the given name and return a pointer to it. More... | |
Static Public Member Functions inherited from Serializable | |
static const std::string & | currentSection () |
Gets the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
Serializes all the SimObjects. More... | |
static void | unserializeGlobals (CheckpointIn &cp) |
Protected Member Functions inherited from Drainable | |
Drainable () | |
virtual | ~Drainable () |
virtual void | drainResume () |
Resume execution after a successful drain. More... | |
void | signalDrainDone () const |
Signal that an object is drained. More... | |
Protected Member Functions inherited from Clocked | |
Clocked (ClockDomain &clk_domain) | |
Create a clocked object and set the clock domain based on the parameters. More... | |
Clocked (Clocked &)=delete | |
Clocked & | operator= (Clocked &)=delete |
virtual | ~Clocked () |
Virtual destructor due to inheritance. More... | |
void | resetClock () const |
Reset the object's clock using the current global tick value. More... | |
virtual void | clockPeriodUpdated () |
A hook subclasses can implement so they can do any extra work that's needed when the clock rate is changed. More... | |
Protected Attributes inherited from SimObject | |
const SimObjectParams * | _params |
Cached copy of the object parameters. More... | |
Protected Attributes inherited from EventManager | |
EventQueue * | eventq |
A pointer to this object's event queue. More... | |
typedef ShaderParams Shader::Params |
enum Shader::hsail_mode_e |
Shader::Shader | ( | const Params * | p | ) |
Definition at line 54 of file shader.cc.
References execScheduledAdds().
Shader::~Shader | ( | ) |
void Shader::AccessMem | ( | uint64_t | address, |
void * | ptr, | ||
uint32_t | size, | ||
int | cu_id, | ||
MemCmd | cmd, | ||
bool | suppress_func_errors | ||
) |
Definition at line 450 of file shader.cc.
References cuList, doFunctionalAccess(), and ChunkGenerator::done().
Referenced by ReadMem(), and WriteMem().
GPUDispatcher & Shader::dispatcher | ( | ) |
Definition at line 96 of file shader.cc.
References _dispatcher.
Referenced by Gcn3ISA::Inst_SOPP__S_ENDPGM::execute(), and ComputeUnit::DataPort::recvTimingResp().
bool Shader::dispatchWorkgroups | ( | HSAQueueEntry * | task | ) |
Definition at line 235 of file shader.cc.
References _activeCus, _lastInactiveTick, cuList, curTick(), HSAQueueEntry::dispComplete(), DPRINTF, HSAQueueEntry::globalWgId(), HSAQueueEntry::markWgDispatch(), n_cu, nextSchedCu, panic_if, Event::scheduled(), and tickEvent.
Referenced by GPUDispatcher::exec().
void Shader::doFunctionalAccess | ( | const RequestPtr & | req, |
MemCmd | cmd, | ||
void * | data, | ||
bool | suppress_func_errors, | ||
int | cu_id | ||
) |
Definition at line 358 of file shader.cc.
References cuList, data, Packet::dataStatic(), fatal, functionalTLBAccess(), BaseTLB::Read, MemCmd::ReadReq, Packet::req, roundDown(), Packet::setSuppressFuncError(), BaseTLB::Write, and MemCmd::WriteReq.
Referenced by AccessMem().
void Shader::execScheduledAdds | ( | ) |
void Shader::functionalTLBAccess | ( | PacketPtr | pkt, |
int | cu_id, | ||
BaseTLB::Mode | mode | ||
) |
Definition at line 501 of file shader.cc.
References cuList, gpuTc, ArmISA::mode, and Packet::senderState.
Referenced by doFunctionalAccess().
|
inline |
Definition at line 186 of file shader.hh.
References shHiddenPrivateBaseVmid.
Referenced by GPUDynInst::resolveFlatSegment().
|
inline |
Definition at line 180 of file shader.hh.
References _scratchApe, and ApertureRegister::base.
Referenced by GPUDynInst::resolveFlatSegment().
|
inline |
|
virtual |
init() is called after all C++ SimObjects have been created and all ports are connected.
Initializations that are independent of unserialization but rely on a fully instantiated and connected SimObject graph should be done here.
Reimplemented from SimObject.
Definition at line 135 of file shader.cc.
References cpuPointer, BaseCPU::getContext(), and gpuTc.
|
inline |
Definition at line 192 of file shader.hh.
References ArmISA::offset, panic_if, and shHiddenPrivateBaseVmid.
Referenced by Wavefront::initRegState().
|
inline |
Definition at line 155 of file shader.hh.
References _gpuVmApe, addr, ApertureRegister::base, and ApertureRegister::limit.
|
inline |
Definition at line 163 of file shader.hh.
References _ldsApe, addr, ApertureRegister::base, and ApertureRegister::limit.
Referenced by GPUDynInst::doApertureCheck().
|
inline |
Definition at line 171 of file shader.hh.
References _scratchApe, addr, ApertureRegister::base, and ApertureRegister::limit.
|
inline |
Addr Shader::mmap | ( | int | length | ) |
Definition at line 102 of file shader.cc.
References Process::allocateMem(), DPRINTF, ThreadContext::getProcessPtr(), gpuTc, length, Process::memState, Process::mmapGrowsDown(), ArmISA::PageBytes, and roundUp().
void Shader::notifyCuSleep | ( | ) |
Definition at line 591 of file shader.cc.
References _activeCus, _lastInactiveTick, cuList, curTick(), panic_if, and shaderActiveTicks.
Referenced by ComputeUnit::exec().
void Shader::prepareFlush | ( | GPUDynInstPtr | gpuDynInst | ) |
dispatcher/shader arranges flush requests to the CUs
Definition at line 222 of file shader.cc.
References _dispatcher, cuList, GPUDispatcher::getOutstandingWbs(), and GPUDispatcher::updateWbCounter().
Referenced by Gcn3ISA::Inst_SOPP__S_ENDPGM::execute().
void Shader::prepareInvalidate | ( | HSAQueueEntry * | task | ) |
Definition at line 194 of file shader.cc.
References _dispatcher, cuList, HSAQueueEntry::dispatchId(), HSAQueueEntry::isInvStarted(), n_cu, HSAQueueEntry::outstandingInvs(), and GPUDispatcher::updateInvCounter().
Referenced by GPUDispatcher::exec().
bool Shader::processTimingPacket | ( | PacketPtr | pkt | ) |
void Shader::ReadMem | ( | uint64_t | address, |
void * | ptr, | ||
uint32_t | sz, | ||
int | cu_id | ||
) |
Definition at line 468 of file shader.cc.
References AccessMem(), and MemCmd::ReadReq.
void Shader::ReadMem | ( | uint64_t | address, |
void * | ptr, | ||
uint32_t | sz, | ||
int | cu_id, | ||
bool | suppress_func_errors | ||
) |
Definition at line 474 of file shader.cc.
References AccessMem(), and MemCmd::ReadReq.
|
inline |
|
virtual |
Callback to set stat parameters.
This callback is typically used for complex stats (e.g., distributions) that need parameters in addition to a name and a description. Stat names and descriptions should typically be set from the constructor usingo from the constructor using the ADD_STAT macro.
Reimplemented from Stats::Group.
Definition at line 278 of file shader.cc.
References allLatencyDist, cacheBlockRoundTrip, ccprintf(), coalsrLineAddresses, cuList, Stats::DataWrap< Derived, InfoProxyType >::desc(), Stats::DataWrap< Derived, InfoProxyType >::flags(), gmEnqueueLatency, gmToCompleteLatency, Stats::VectorBase< Derived, Stor >::init(), Stats::Distribution::init(), initToCoalesceLatency, loadLatencyDist, SimObject::name(), Stats::DataWrap< Derived, InfoProxyType >::name(), Stats::oneline, Stats::pdf, Stats::Group::regStats(), rubyNetworkLatency, shaderActiveTicks, storeLatencyDist, vectorInstDstOperand, and vectorInstSrcOperand.
void Shader::sampleInstRoundTrip | ( | std::vector< Tick > | roundTripTime | ) |
Definition at line 542 of file shader.cc.
References gmEnqueueLatency, gmToCompleteLatency, initToCoalesceLatency, InstMemoryHopMax, rubyNetworkLatency, Stats::DistBase< Derived, Stor >::sample(), ArmISA::t1, ArmISA::t2, ArmISA::t3, ArmISA::t4, and ArmISA::t5.
Referenced by GlobalMemPipeline::exec().
void Shader::sampleLineRoundTrip | ( | const std::map< Addr, std::vector< Tick >> & | roundTripTime | ) |
Definition at line 562 of file shader.cc.
References cacheBlockRoundTrip, coalsrLineAddresses, and Stats::DistBase< Derived, Stor >::sample().
Referenced by GlobalMemPipeline::exec().
void Shader::sampleLoad | ( | const Tick | accessTime | ) |
Definition at line 535 of file shader.cc.
References allLatencyDist, loadLatencyDist, and Stats::DistBase< Derived, Stor >::sample().
Referenced by GlobalMemPipeline::exec().
void Shader::sampleStore | ( | const Tick | accessTime | ) |
Definition at line 525 of file shader.cc.
References allLatencyDist, Stats::DistBase< Derived, Stor >::sample(), and storeLatencyDist.
Referenced by GlobalMemPipeline::exec().
void Shader::ScheduleAdd | ( | int * | val, |
Tick | when, | ||
int | x | ||
) |
Definition at line 431 of file shader.cc.
References curTick(), DPRINTF, EventManager::reschedule(), sa_n, sa_val, sa_when, sa_x, Event::scheduled(), tickEvent, X86ISA::val, Event::when(), and RiscvISA::x.
Referenced by LocalMemPipeline::exec(), GlobalMemPipeline::exec(), and ScalarMemPipeline::exec().
|
inline |
Definition at line 149 of file shader.hh.
References _scratchApe.
void Shader::updateContext | ( | int | cid | ) |
Definition at line 150 of file shader.cc.
References cpuPointer, BaseCPU::getContext(), and gpuTc.
Referenced by GPUDispatcher::exec().
void Shader::WriteMem | ( | uint64_t | address, |
void * | ptr, | ||
uint32_t | sz, | ||
int | cu_id | ||
) |
Definition at line 482 of file shader.cc.
References AccessMem(), and MemCmd::WriteReq.
void Shader::WriteMem | ( | uint64_t | address, |
void * | ptr, | ||
uint32_t | sz, | ||
int | cu_id, | ||
bool | suppress_func_errors | ||
) |
Definition at line 488 of file shader.cc.
References AccessMem(), and MemCmd::WriteReq.
|
private |
Definition at line 96 of file shader.hh.
Referenced by dispatchWorkgroups(), and notifyCuSleep().
GPUDispatcher& Shader::_dispatcher |
Definition at line 250 of file shader.hh.
Referenced by dispatcher(), prepareFlush(), and prepareInvalidate().
|
private |
Definition at line 90 of file shader.hh.
Referenced by gpuVmApe(), and isGpuVmApe().
|
private |
Definition at line 99 of file shader.hh.
Referenced by dispatchWorkgroups(), and notifyCuSleep().
|
private |
Definition at line 91 of file shader.hh.
Referenced by isLdsApe(), and ldsApe().
|
private |
Definition at line 92 of file shader.hh.
Referenced by getScratchBase(), isScratchApe(), and scratchApe().
|
private |
Definition at line 102 of file shader.hh.
Referenced by regStats(), sampleLoad(), and sampleStore().
|
private |
Definition at line 119 of file shader.hh.
Referenced by regStats(), and sampleLineRoundTrip().
|
private |
Definition at line 118 of file shader.hh.
Referenced by regStats(), and sampleLineRoundTrip().
int Shader::coissue_return |
Definition at line 222 of file shader.hh.
Referenced by LocalMemPipeline::exec(), GlobalMemPipeline::exec(), and ScalarMemPipeline::exec().
BaseCPU* Shader::cpuPointer |
Definition at line 134 of file shader.hh.
Referenced by init(), and updateContext().
SimpleThread* Shader::cpuThread |
std::vector<ComputeUnit*> Shader::cuList |
Definition at line 247 of file shader.hh.
Referenced by AccessMem(), dispatchWorkgroups(), doFunctionalAccess(), functionalTLBAccess(), notifyCuSleep(), prepareFlush(), prepareInvalidate(), registerCU(), regStats(), and ~Shader().
int Shader::globalMemSize |
Definition at line 231 of file shader.hh.
Referenced by GlobalMemPipeline::init().
|
private |
Definition at line 112 of file shader.hh.
Referenced by regStats(), and sampleInstRoundTrip().
|
private |
Definition at line 113 of file shader.hh.
Referenced by regStats(), and sampleInstRoundTrip().
GPUCommandProcessor& Shader::gpuCmdProc |
ThreadContext* Shader::gpuTc |
Definition at line 133 of file shader.hh.
Referenced by functionalTLBAccess(), init(), FetchUnit::initiateFetch(), mmap(), ComputeUnit::sendRequest(), ComputeUnit::sendScalarRequest(), and updateContext().
hsail_mode_e Shader::hsail_mode |
Definition at line 215 of file shader.hh.
Referenced by Wavefront::exec().
int Shader::impl_kern_end_rel |
Definition at line 220 of file shader.hh.
Referenced by Gcn3ISA::Inst_SOPP__S_ENDPGM::execute(), and ComputeUnit::injectGlobalMemFence().
int Shader::impl_kern_launch_acq |
Definition at line 218 of file shader.hh.
Referenced by GPUDispatcher::exec().
|
private |
Definition at line 110 of file shader.hh.
Referenced by regStats(), and sampleInstRoundTrip().
|
private |
Definition at line 103 of file shader.hh.
Referenced by regStats(), and sampleLoad().
int64_t Shader::max_valu_insts |
Definition at line 260 of file shader.hh.
Referenced by ComputeUnit::updateInstStats().
int Shader::n_cu |
Definition at line 226 of file shader.hh.
Referenced by dispatchWorkgroups(), prepareInvalidate(), and ~Shader().
int Shader::n_wf |
Definition at line 228 of file shader.hh.
Referenced by ComputeUnit::dispWorkgroup(), FetchUnit::exec(), ScoreboardCheckStage::exec(), ComputeUnit::hasDispResources(), FetchUnit::init(), ComputeUnit::isVectorAluIdle(), ComputeUnit::regStats(), ComputeUnit::releaseWFsFromBarrier(), Wavefront::setStatus(), and ComputeUnit::~ComputeUnit().
int Shader::nextSchedCu |
Definition at line 234 of file shader.hh.
Referenced by dispatchWorkgroups().
|
private |
Definition at line 111 of file shader.hh.
Referenced by regStats(), and sampleInstRoundTrip().
uint32_t Shader::sa_n |
Definition at line 237 of file shader.hh.
Referenced by execScheduledAdds(), and ScheduleAdd().
std::vector<int*> Shader::sa_val |
Definition at line 240 of file shader.hh.
Referenced by execScheduledAdds(), and ScheduleAdd().
std::vector<uint64_t> Shader::sa_when |
Definition at line 242 of file shader.hh.
Referenced by execScheduledAdds(), and ScheduleAdd().
std::vector<int32_t> Shader::sa_x |
Definition at line 244 of file shader.hh.
Referenced by execScheduledAdds(), and ScheduleAdd().
Stats::Scalar Shader::shaderActiveTicks |
Statistics.
Definition at line 255 of file shader.hh.
Referenced by notifyCuSleep(), and regStats().
|
private |
Definition at line 93 of file shader.hh.
Referenced by getHiddenPrivateBase(), and initShHiddenPrivateBase().
|
private |
Definition at line 104 of file shader.hh.
Referenced by regStats(), and sampleStore().
EventFunctionWrapper Shader::tickEvent |
Definition at line 211 of file shader.hh.
Referenced by dispatchWorkgroups(), execScheduledAdds(), and ScheduleAdd().
bool Shader::timingSim |
Definition at line 214 of file shader.hh.
Referenced by FetchUnit::init(), and ComputeUnit::sendRequest().
int64_t Shader::total_valu_insts |
Definition at line 261 of file shader.hh.
Referenced by ComputeUnit::updateInstStats().
Stats::Vector Shader::vectorInstDstOperand |
Definition at line 257 of file shader.hh.
Referenced by Wavefront::exec(), and regStats().
Stats::Vector Shader::vectorInstSrcOperand |
Definition at line 256 of file shader.hh.
Referenced by Wavefront::exec(), and regStats().