gem5
|
#include <shader.hh>
Classes | |
class | TickEvent |
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 | |
Tick | frequency () const |
Tick | ticks (int numCycles) const |
Tick | getClock () const |
Tick | curCycle () const |
Tick | tickToCycles (Tick val) const |
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 | exec () |
bool | busy () |
void | ScheduleAdd (uint32_t *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 (RequestPtr req, MemCmd cmd, void *data, bool suppress_func_errors, int cu_id) |
void | registerCU (int cu_id, ComputeUnit *compute_unit) |
void | handshake (GpuDispatcher *dispatcher) |
bool | dispatch_workgroups (NDRange *ndr) |
Addr | mmap (int length) |
void | functionalTLBAccess (PacketPtr pkt, int cu_id, BaseTLB::Mode mode) |
void | updateContext (int cid) |
void | hostWakeUp (BaseCPU *cpu) |
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... | |
Enums::PwrState | pwrState () const |
std::string | pwrStateName () const |
std::vector< double > | pwrStateWeights () const |
Returns the percentage residency for each power state. More... | |
void | computeStats () |
Record stats values like state residency by computing the time difference from previous update. More... | |
void | pwrState (Enums::PwrState) |
void | regStats () override |
Register statistics for this 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 | resetStats () |
Reset statistics associated with this object. 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 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 | |
EventManager (EventManager &em) | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
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) |
void | setCurTick (Tick newVal) |
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 Clocked | |
void | updateClockPeriod () const |
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 |
TickEvent | tickEvent |
bool | timingSim |
hsail_mode_e | hsail_mode |
int | impl_kern_boundary_sync |
int | separate_acquire_release |
int | coissue_return |
int | trace_vgpr_all |
int | n_cu |
int | n_wf |
int | globalMemSize |
int | funcargs_size |
int | nextSchedCu |
uint32_t | sa_n |
std::vector< uint32_t * > | sa_val |
std::vector< uint64_t > | sa_when |
std::vector< int32_t > | sa_x |
std::vector< ComputeUnit * > | cuList |
uint64_t | tick_cnt |
uint64_t | box_tick_cnt |
uint64_t | start_tick_cnt |
GpuDispatcher * | dispatcher |
Protected Attributes | |
Tick | clock |
Protected Attributes inherited from ClockedObject | |
Enums::PwrState | _currPwrState |
To keep track of the current power state. More... | |
Tick | prvEvalTick |
Stats::Scalar | numPwrStateTransitions |
Stats::Distribution | pwrStateClkGateDist |
Stats::Vector | pwrStateResidencyTicks |
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... | |
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 () |
Get the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
static void | unserializeGlobals (CheckpointIn &cp) |
Static Public Attributes inherited from Serializable | |
static int | ckptCount = 0 |
static int | ckptMaxCount = 0 |
static int | ckptPrevCount = -1 |
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... | |
typedef ShaderParams Shader::Params |
enum Shader::hsail_mode_e |
Shader::Shader | ( | const Params * | p | ) |
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 342 of file shader.cc.
References cuList, doFunctionalAccess(), and ChunkGenerator::done().
Referenced by GpuDispatcher::accessUserVar(), ReadMem(), and WriteMem().
|
inline |
bool Shader::dispatch_workgroups | ( | NDRange * | ndr | ) |
Definition at line 171 of file shader.cc.
References cuList, curTick(), DPRINTF, HsaQueueEntry::gdSize, NDRange::globalWgId, n_cu, nextSchedCu, NDRange::q, EventManager::schedule(), Event::scheduled(), tickEvent, ticks(), NDRange::wg_disp_rem, NDRange::wgId, and HsaQueueEntry::wgSize.
Referenced by GpuDispatcher::exec().
void Shader::doFunctionalAccess | ( | RequestPtr | req, |
MemCmd | cmd, | ||
void * | data, | ||
bool | suppress_func_errors, | ||
int | cu_id | ||
) |
Definition at line 226 of file shader.cc.
References cuList, Packet::dataStatic(), fatal, functionalTLBAccess(), Request::getSize(), Request::getVaddr(), BaseTLB::Read, MemCmd::ReadReq, Packet::req, roundDown(), Packet::setSuppressFuncError(), X86ISA::size(), Request::splitOnVaddr(), BaseTLB::Write, and MemCmd::WriteReq.
Referenced by AccessMem().
void Shader::exec | ( | ) |
|
inline |
Definition at line 89 of file shader.hh.
References clock, and SimClock::Frequency.
void Shader::functionalTLBAccess | ( | PacketPtr | pkt, |
int | cu_id, | ||
BaseTLB::Mode | mode | ||
) |
Definition at line 391 of file shader.cc.
References cuList, dispatcher, gpuTc, n_cu, safe_cast(), Packet::senderState, MasterPort::sendFunctional(), and GpuDispatcher::tlbPort.
Referenced by doFunctionalAccess().
void Shader::handshake | ( | GpuDispatcher * | dispatcher | ) |
Definition at line 220 of file shader.cc.
References dispatcher.
Referenced by GpuDispatcher::GpuDispatcher().
void Shader::hostWakeUp | ( | BaseCPU * | cpu | ) |
Definition at line 129 of file shader.cc.
References cpuPointer, gpuTc, panic, ThreadContext::status(), ThreadContext::Suspended, and ThreadContext::threadId().
Referenced by GpuDispatcher::exec().
|
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 106 of file shader.cc.
References cpuPointer, and gpuTc.
Addr Shader::mmap | ( | int | length | ) |
Definition at line 73 of file shader.cc.
References Process::allocateMem(), DPRINTF, ThreadContext::getProcessPtr(), gpuTc, length, Process::memState, Process::mmapGrowsDown(), AlphaISA::PageBytes, and roundUp().
bool Shader::processTimingPacket | ( | PacketPtr | pkt | ) |
void Shader::ReadMem | ( | uint64_t | address, |
void * | ptr, | ||
uint32_t | sz, | ||
int | cu_id | ||
) |
Definition at line 359 of file shader.cc.
References AccessMem(), and MemCmd::ReadReq.
Referenced by GpuDispatcher::notifyWgCompl(), and GpuDispatcher::write().
void Shader::ReadMem | ( | uint64_t | address, |
void * | ptr, | ||
uint32_t | sz, | ||
int | cu_id, | ||
bool | suppress_func_errors | ||
) |
Definition at line 365 of file shader.cc.
References AccessMem(), and MemCmd::ReadReq.
|
inline |
void Shader::ScheduleAdd | ( | uint32_t * | val, |
Tick | when, | ||
int | x | ||
) |
Definition at line 312 of file shader.cc.
References sa_n, sa_val, sa_when, sa_x, and tick_cnt.
Referenced by LocalMemPipeline::exec(), and GlobalMemPipeline::exec().
|
inline |
Definition at line 91 of file shader.hh.
References clock.
Referenced by dispatch_workgroups(), ConditionRegisterState::exec(), VectorRegisterFile::exec(), Wavefront::exec(), HsailISA::LdInst< MemDataType, DestDataType, AddrOperandType >::execute(), HsailISA::StInst< MemDataType, SrcDataType, AddrOperandType >::execute(), HsailISA::AtomicInst< MemDataType, AddrOperandType, NumSrcOperands, HasDst >::execute(), ComputeUnit::init(), HsailISA::Call::MagicAtomicNRAddGlobalU32Reg(), HsailISA::Call::MagicAtomicNRAddGroupU32Reg(), HsailISA::Call::MagicLoadGlobalU32Reg(), GpuDispatcher::notifyWgCompl(), LdsState::processPacket(), GpuDispatcher::scheduleDispatch(), Wavefront::updateResources(), and GpuDispatcher::write().
void Shader::updateContext | ( | int | cid | ) |
Definition at line 121 of file shader.cc.
References cpuPointer, and gpuTc.
Referenced by GpuDispatcher::exec().
void Shader::WriteMem | ( | uint64_t | address, |
void * | ptr, | ||
uint32_t | sz, | ||
int | cu_id | ||
) |
Definition at line 372 of file shader.cc.
References AccessMem(), and MemCmd::WriteReq.
Referenced by GpuDispatcher::notifyWgCompl(), and GpuDispatcher::write().
void Shader::WriteMem | ( | uint64_t | address, |
void * | ptr, | ||
uint32_t | sz, | ||
int | cu_id, | ||
bool | suppress_func_errors | ||
) |
Definition at line 378 of file shader.cc.
References AccessMem(), and MemCmd::WriteReq.
|
protected |
Definition at line 81 of file shader.hh.
Referenced by curCycle(), frequency(), getClock(), ticks(), and tickToCycles().
int Shader::coissue_return |
Definition at line 125 of file shader.hh.
Referenced by LocalMemPipeline::exec(), and GlobalMemPipeline::exec().
BaseCPU* Shader::cpuPointer |
Definition at line 100 of file shader.hh.
Referenced by hostWakeUp(), init(), and updateContext().
SimpleThread* Shader::cpuThread |
std::vector<ComputeUnit*> Shader::cuList |
Definition at line 159 of file shader.hh.
Referenced by AccessMem(), busy(), dispatch_workgroups(), doFunctionalAccess(), exec(), functionalTLBAccess(), GpuDispatcher::getNumCUs(), GpuDispatcher::getStaticContextSize(), registerCU(), Shader(), GpuDispatcher::wfSize(), and ~Shader().
GpuDispatcher* Shader::dispatcher |
Definition at line 165 of file shader.hh.
Referenced by HsailISA::Ret::execute(), functionalTLBAccess(), handshake(), and ComputeUnit::DataPort::recvTimingResp().
int Shader::funcargs_size |
Definition at line 143 of file shader.hh.
Referenced by ComputeUnit::init(), and GpuDispatcher::setFuncargsSize().
int Shader::globalMemSize |
Definition at line 133 of file shader.hh.
Referenced by GlobalMemPipeline::init().
ThreadContext* Shader::gpuTc |
Definition at line 99 of file shader.hh.
Referenced by functionalTLBAccess(), hostWakeUp(), init(), FetchUnit::initiateFetch(), mmap(), ComputeUnit::sendRequest(), and updateContext().
hsail_mode_e Shader::hsail_mode |
Definition at line 117 of file shader.hh.
Referenced by Wavefront::exec().
int Shader::impl_kern_boundary_sync |
Definition at line 120 of file shader.hh.
Referenced by ComputeUnit::StartWorkgroup().
int Shader::n_cu |
Definition at line 129 of file shader.hh.
Referenced by busy(), dispatch_workgroups(), exec(), functionalTLBAccess(), Shader(), and ~Shader().
int Shader::n_wf |
Definition at line 131 of file shader.hh.
Referenced by ComputeUnit::AllAtBarrier(), FetchUnit::exec(), ScoreboardCheckStage::exec(), FetchUnit::init(), ComputeUnit::init(), ComputeUnit::isSimdDone(), ComputeUnit::ReadyWorkgroup(), ComputeUnit::StartWorkgroup(), and ComputeUnit::~ComputeUnit().
int Shader::nextSchedCu |
Definition at line 146 of file shader.hh.
Referenced by dispatch_workgroups().
uint32_t Shader::sa_n |
Definition at line 149 of file shader.hh.
Referenced by exec(), and ScheduleAdd().
std::vector<uint32_t*> Shader::sa_val |
Definition at line 152 of file shader.hh.
Referenced by exec(), and ScheduleAdd().
std::vector<uint64_t> Shader::sa_when |
Definition at line 154 of file shader.hh.
Referenced by exec(), and ScheduleAdd().
std::vector<int32_t> Shader::sa_x |
Definition at line 156 of file shader.hh.
Referenced by exec(), and ScheduleAdd().
uint64_t Shader::tick_cnt |
Definition at line 161 of file shader.hh.
Referenced by ConditionRegisterState::exec(), VectorRegisterFile::exec(), exec(), HsailISA::LdInst< MemDataType, DestDataType, AddrOperandType >::execute(), HsailISA::StInst< MemDataType, SrcDataType, AddrOperandType >::execute(), HsailISA::AtomicInst< MemDataType, AddrOperandType, NumSrcOperands, HasDst >::execute(), ComputeUnit::init(), HsailISA::Call::MagicAtomicNRAddGlobalU32Reg(), HsailISA::Call::MagicAtomicNRAddGroupU32Reg(), HsailISA::Call::MagicLoadGlobalU32Reg(), ScheduleAdd(), and ComputeUnit::updateEvents().
TickEvent Shader::tickEvent |
Definition at line 113 of file shader.hh.
Referenced by dispatch_workgroups().
bool Shader::timingSim |
Definition at line 116 of file shader.hh.
Referenced by FetchUnit::init(), and ComputeUnit::sendRequest().