gem5
v20.0.0.0
|
#include <shader.hh>
Public Types | |
enum | hsail_mode_e { SIMT, VECTOR_SCALAR } |
typedef ShaderParams | Params |
![]() | |
typedef ClockedObjectParams | Params |
Parameters of ClockedObject. More... | |
![]() | |
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 |
void | processTick () |
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 (const 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) |
![]() | |
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... | |
![]() | |
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... | |
const Params * | params () const |
SimObject (const Params *_params) | |
![]() | |
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) |
EventManager (EventManager &em) | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
![]() | |
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) |
![]() | |
DrainState | drainState () const |
Return the current drain state of an object. More... | |
virtual void | notifyFork () |
Notify a child process of a fork. More... | |
![]() | |
Group (Group *parent, const char *name=nullptr) | |
Construct a new statistics group. More... | |
virtual | ~Group () |
virtual void | regStats () |
Callback to set stat parameters. More... | |
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 |
![]() | |
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_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 |
![]() | |
PowerState * | powerState |
Protected Attributes | |
Tick | clock |
![]() | |
const SimObjectParams * | _params |
Cached copy of the object parameters. More... | |
![]() | |
EventQueue * | eventq |
A pointer to this object's event queue. More... | |
Additional Inherited Members | |
![]() | |
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 const std::string & | currentSection () |
Gets the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
static void | unserializeGlobals (CheckpointIn &cp) |
![]() | |
Drainable () | |
virtual | ~Drainable () |
virtual void | drainResume () |
Resume execution after a successful drain. More... | |
void | signalDrainDone () const |
Signal that an object is drained. More... | |
![]() | |
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... | |
typedef ShaderParams Shader::Params |
enum Shader::hsail_mode_e |
Shader::Shader | ( | const Params * | p | ) |
Definition at line 51 of file shader.cc.
References box_tick_cnt, coissue_return, EventBase::CPU_Tick_Pri, cuList, globalMemSize, hsail_mode, ArmISA::i, impl_kern_boundary_sync, n_cu, n_wf, nextSchedCu, MipsISA::p, processTick(), sa_n, separate_acquire_release, SIMT, start_tick_cnt, tick_cnt, timingSim, and trace_vgpr_all.
Referenced by hostWakeUp().
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 332 of file shader.cc.
References cuList, doFunctionalAccess(), and ChunkGenerator::done().
Referenced by GpuDispatcher::accessUserVar(), ReadMem(), and WriteMem().
bool Shader::busy | ( | ) |
|
inline |
bool Shader::dispatch_workgroups | ( | NDRange * | ndr | ) |
Definition at line 172 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 | ( | const RequestPtr & | req, |
MemCmd | cmd, | ||
void * | data, | ||
bool | suppress_func_errors, | ||
int | cu_id | ||
) |
Definition at line 227 of file shader.cc.
References cuList, Packet::dataStatic(), fatal, functionalTLBAccess(), BaseTLB::Read, MemCmd::ReadReq, Packet::req, roundDown(), Packet::setSuppressFuncError(), BaseTLB::Write, and MemCmd::WriteReq.
Referenced by AccessMem().
void Shader::exec | ( | ) |
Definition at line 149 of file shader.cc.
References box_tick_cnt, cuList, curTick(), ArmISA::i, n_cu, sa_n, sa_val, sa_when, sa_x, start_tick_cnt, and tick_cnt.
Referenced by processTick().
|
inline |
Definition at line 89 of file shader.hh.
References SimClock::Frequency.
void Shader::functionalTLBAccess | ( | PacketPtr | pkt, |
int | cu_id, | ||
BaseTLB::Mode | mode | ||
) |
Definition at line 382 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 221 of file shader.cc.
References dispatcher.
Referenced by GpuDispatcher::GpuDispatcher().
void Shader::hostWakeUp | ( | BaseCPU * | cpu | ) |
Definition at line 130 of file shader.cc.
References BaseCPU::activateContext(), cpuPointer, gpuTc, panic, Shader(), 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 107 of file shader.cc.
References cpuPointer, BaseCPU::getContext(), and gpuTc.
Addr Shader::mmap | ( | int | length | ) |
Definition at line 74 of file shader.cc.
References Process::allocateMem(), DPRINTF, ThreadContext::getProcessPtr(), gpuTc, length, Process::memState, Process::mmapGrowsDown(), ArmISA::PageBytes, and roundUp().
void Shader::processTick | ( | ) |
bool Shader::processTimingPacket | ( | PacketPtr | pkt | ) |
void Shader::ReadMem | ( | uint64_t | address, |
void * | ptr, | ||
uint32_t | sz, | ||
int | cu_id | ||
) |
Definition at line 350 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 356 of file shader.cc.
References AccessMem(), and MemCmd::ReadReq.
|
inline |
Definition at line 188 of file shader.hh.
References length, and ArmISA::mode.
void Shader::ScheduleAdd | ( | uint32_t * | val, |
Tick | when, | ||
int | x | ||
) |
Definition at line 313 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.
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(), processTick(), GpuDispatcher::scheduleDispatch(), Wavefront::updateResources(), and GpuDispatcher::write().
void Shader::updateContext | ( | int | cid | ) |
Definition at line 122 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 363 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 369 of file shader.cc.
References AccessMem(), and MemCmd::WriteReq.
uint64_t Shader::box_tick_cnt |
int Shader::coissue_return |
Definition at line 115 of file shader.hh.
Referenced by LocalMemPipeline::exec(), GlobalMemPipeline::exec(), and Shader().
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 149 of file shader.hh.
Referenced by AccessMem(), busy(), dispatch_workgroups(), doFunctionalAccess(), exec(), functionalTLBAccess(), GpuDispatcher::getNumCUs(), GpuDispatcher::getStaticContextSize(), Shader(), GpuDispatcher::wfSize(), and ~Shader().
GpuDispatcher* Shader::dispatcher |
Definition at line 155 of file shader.hh.
Referenced by HsailISA::Ret::execute(), Gcn3ISA::Inst_SOPP__S_ENDPGM::execute(), functionalTLBAccess(), and handshake().
int Shader::funcargs_size |
Definition at line 133 of file shader.hh.
Referenced by ComputeUnit::init(), and GpuDispatcher::setFuncargsSize().
int Shader::globalMemSize |
Definition at line 123 of file shader.hh.
Referenced by GlobalMemPipeline::init(), and Shader().
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 107 of file shader.hh.
Referenced by Wavefront::exec(), and Shader().
int Shader::impl_kern_boundary_sync |
Definition at line 110 of file shader.hh.
Referenced by Shader(), and ComputeUnit::StartWorkgroup().
int Shader::n_cu |
Definition at line 119 of file shader.hh.
Referenced by busy(), dispatch_workgroups(), exec(), functionalTLBAccess(), Shader(), and ~Shader().
int Shader::n_wf |
Definition at line 121 of file shader.hh.
Referenced by ComputeUnit::AllAtBarrier(), FetchUnit::exec(), ScoreboardCheckStage::exec(), FetchUnit::init(), ComputeUnit::init(), ComputeUnit::isSimdDone(), ComputeUnit::ReadyWorkgroup(), Shader(), ComputeUnit::StartWorkgroup(), and ComputeUnit::~ComputeUnit().
int Shader::nextSchedCu |
Definition at line 136 of file shader.hh.
Referenced by dispatch_workgroups(), and Shader().
uint32_t Shader::sa_n |
Definition at line 139 of file shader.hh.
Referenced by exec(), ScheduleAdd(), and Shader().
std::vector<uint32_t*> Shader::sa_val |
Definition at line 142 of file shader.hh.
Referenced by exec(), and ScheduleAdd().
std::vector<uint64_t> Shader::sa_when |
Definition at line 144 of file shader.hh.
Referenced by exec(), and ScheduleAdd().
std::vector<int32_t> Shader::sa_x |
Definition at line 146 of file shader.hh.
Referenced by exec(), and ScheduleAdd().
int Shader::separate_acquire_release |
uint64_t Shader::start_tick_cnt |
uint64_t Shader::tick_cnt |
Definition at line 151 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(), Shader(), and ComputeUnit::updateEvents().
EventFunctionWrapper Shader::tickEvent |
Definition at line 103 of file shader.hh.
Referenced by dispatch_workgroups(), and processTick().
bool Shader::timingSim |
Definition at line 106 of file shader.hh.
Referenced by FetchUnit::init(), ComputeUnit::sendRequest(), and Shader().