gem5 v24.0.0.0
|
The interface class to talk to peer gem5 processes. More...
#include <dist_iface.hh>
Classes | |
class | RecvScheduler |
Class to encapsulate information about data packets received. More... | |
class | Sync |
This class implements global sync operations among gem5 peer processes. More... | |
class | SyncEvent |
The global event to schedule periodic dist sync. More... | |
class | SyncNode |
class | SyncSwitch |
Public Types | |
typedef DistHeaderPkt::Header | Header |
Public Member Functions | |
DistIface (unsigned dist_rank, unsigned dist_size, Tick sync_start, Tick sync_repeat, EventManager *em, bool use_pseudo_op, bool is_switch, int num_nodes) | |
ctor | |
virtual | ~DistIface () |
void | packetOut (EthPacketPtr pkt, Tick send_delay) |
Send out an Ethernet packet. | |
EthPacketPtr | packetIn () |
Fetch the packet scheduled to be received next by the simulated network link. | |
DrainState | drain () override |
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight. | |
void | drainResume () override |
Resume execution after a successful drain. | |
void | init (const Event *e, Tick link_delay) |
void | startup () |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. | |
Public Member Functions inherited from gem5::Drainable | |
DrainState | drainState () const |
Return the current drain state of an object. | |
virtual void | notifyFork () |
Notify a child process of a fork. | |
Public Member Functions inherited from gem5::Serializable | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Static Public Member Functions | |
static bool | readyToExit (Tick delay) |
Initiate the exit from the simulation. | |
static bool | readyToCkpt (Tick delay, Tick period) |
Initiate taking a checkpoint. | |
static uint64_t | rankParam () |
Getter for the dist rank param. | |
static uint64_t | sizeParam () |
Getter for the dist size param. | |
static void | toggleSync (ThreadContext *tc) |
Trigger the primary to start/stop synchronization. | |
Static Public Member Functions inherited from gem5::Serializable | |
static const std::string & | currentSection () |
Gets the fully-qualified name of the active section. | |
static void | generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream) |
Generate a checkpoint file so that the serialization can be routed to it. | |
Protected Types | |
typedef DistHeaderPkt::MsgType | MsgType |
typedef DistHeaderPkt::ReqType | ReqType |
Protected Attributes | |
unsigned | rank |
The rank of this process among the gem5 peers. | |
unsigned | size |
The number of gem5 processes comprising this dist simulation. | |
unsigned | distIfaceId |
Unique id for the dist link. | |
bool | isPrimary |
Static Protected Attributes | |
static unsigned | distIfaceNum = 0 |
Number of DistIface objects (i.e. | |
Private Member Functions | |
virtual void | sendPacket (const Header &header, const EthPacketPtr &packet)=0 |
Send out a data packet to the remote end. | |
virtual void | sendCmd (const Header &header)=0 |
Send out a control command to the remote end. | |
virtual bool | recvHeader (Header &header)=0 |
Receive a header (i.e. | |
virtual void | recvPacket (const Header &header, EthPacketPtr &packet)=0 |
Receive a packet from the remote end. | |
virtual void | initTransport ()=0 |
Init hook for the underlaying transport. | |
void | spawnRecvThread (const Event *recv_done, Tick link_delay) |
spawn the receiver thread. | |
void | recvThreadFunc (Event *recv_done, Tick link_delay) |
The function executed by a receiver thread. | |
Private Attributes | |
Tick | syncStart |
Tick to schedule the first dist sync event. | |
Tick | syncRepeat |
Frequency of dist sync events in ticks. | |
std::thread * | recvThread |
Receiver thread pointer. | |
RecvScheduler | recvScheduler |
Meta information about data packets received. | |
bool | syncStartOnPseudoOp |
Use pseudoOp to start synchronization. | |
Static Private Attributes | |
static unsigned | recvThreadsNum = 0 |
Number of receiver threads (in this gem5 process) | |
static Sync * | sync = nullptr |
The singleton Sync object to perform dist synchronisation. | |
static SyncEvent * | syncEvent = nullptr |
The singleton SyncEvent object to schedule periodic dist sync. | |
static DistIface * | primary = nullptr |
The very first DistIface object created becomes the primary interface. | |
static System * | sys = nullptr |
System pointer used to wakeup sleeping threads when stopping sync. | |
static bool | isSwitch = false |
Is this node a switch? | |
Additional Inherited Members | |
Protected Member Functions inherited from gem5::Drainable | |
Drainable () | |
virtual | ~Drainable () |
void | signalDrainDone () const |
Signal that an object is drained. | |
The interface class to talk to peer gem5 processes.
Definition at line 101 of file dist_iface.hh.
Definition at line 104 of file dist_iface.hh.
|
protected |
Definition at line 107 of file dist_iface.hh.
|
protected |
Definition at line 108 of file dist_iface.hh.
gem5::DistIface::DistIface | ( | unsigned | dist_rank, |
unsigned | dist_size, | ||
Tick | sync_start, | ||
Tick | sync_repeat, | ||
EventManager * | em, | ||
bool | use_pseudo_op, | ||
bool | is_switch, | ||
int | num_nodes ) |
ctor
dist_rank | Rank of this gem5 process within the dist run |
sync_start | Start tick for dist synchronisation |
sync_repeat | Frequency for dist synchronisation |
em | The event manager associated with the simulated Ethernet link |
Definition at line 605 of file dist_iface.cc.
References distIfaceId, distIfaceNum, DPRINTF, isPrimary, isSwitch, primary, sync, and syncEvent.
|
virtual |
Definition at line 634 of file dist_iface.cc.
References distIfaceNum, primary, recvThread, sync, and syncEvent.
|
overridevirtual |
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight.
Draining is mostly used before forking and creating a check point.
This function notifies an object that it needs to drain its state.
If the object does not need further simulation to drain internal buffers, it returns DrainState::Drained and automatically switches to the Drained state. If the object needs more simulation, it returns DrainState::Draining and automatically enters the Draining state. Other return values are invalid.
Implements gem5::Drainable.
Definition at line 730 of file dist_iface.cc.
References DPRINTF, gem5::Drained, gem5::DistIface::SyncEvent::draining(), primary, and syncEvent.
|
overridevirtual |
Resume execution after a successful drain.
Reimplemented from gem5::Drainable.
Definition at line 740 of file dist_iface.cc.
References DPRINTF, gem5::DistIface::SyncEvent::draining(), primary, recvScheduler, gem5::DistIface::RecvScheduler::resumeRecvTicks(), and syncEvent.
Definition at line 786 of file dist_iface.cc.
References gem5::DistIface::Sync::init(), gem5::Random::init(), initTransport(), primary, gem5::random_mt, rank, spawnRecvThread(), sync, syncRepeat, and syncStart.
Referenced by gem5::DistEtherLink::init().
|
privatepure virtual |
|
inline |
Fetch the packet scheduled to be received next by the simulated network link.
Definition at line 600 of file dist_iface.hh.
References gem5::DistIface::RecvScheduler::popPacket(), and recvScheduler.
Referenced by gem5::DistEtherLink::RxLink::rxDone().
void gem5::DistIface::packetOut | ( | EthPacketPtr | pkt, |
Tick | send_delay ) |
Send out an Ethernet packet.
pkt | The Ethernet packet to send. |
send_delay | The delay in ticks for the send completion event. |
Definition at line 650 of file dist_iface.cc.
References gem5::curTick(), DPRINTF, header, gem5::DistHeaderPkt::Header::msgType, and sendPacket().
Referenced by gem5::DistEtherLink::TxLink::transmit().
|
static |
Getter for the dist rank param.
Definition at line 916 of file dist_iface.cc.
References primary, rank, gem5::X86ISA::val, and warn.
Referenced by gem5::pseudo_inst::initParam().
Initiate taking a checkpoint.
delay | Delay param from the m5 checkpoint command. If Delay is zero then a collaborative checkpoint is requested (i.e. all nodes have to call this method before the checkpoint can be taken). If Delay is not zero then a checkpoint is requested asap (and it will happen at the next sync tick). |
Definition at line 823 of file dist_iface.cc.
References DPRINTF, inform, primary, gem5::DistIface::Sync::requestCkpt(), and sync.
Referenced by gem5::pseudo_inst::m5checkpoint().
|
static |
Initiate the exit from the simulation.
delay | Delay param from the m5 exit command. If Delay is zero then a collaborative exit is requested (i.e. all nodes have to call this method before the distributed simulation can exit). If Delay is not zero then exit is requested asap (and it will happen at the next sync tick). |
Definition at line 891 of file dist_iface.cc.
References DPRINTF, inform, primary, gem5::DistIface::Sync::requestExit(), gem5::BaseGlobalEvent::scheduled(), gem5::DistIface::SyncEvent::start(), sync, and syncEvent.
Referenced by gem5::exitImpl(), and gem5::pseudo_inst::m5exit().
|
privatepure virtual |
Receive a header (i.e.
meta info describing a data packet or a control command) from the remote end.
header | The meta info structure to store the incoming header. |
Implemented in gem5::TCPIface.
Referenced by recvThreadFunc().
|
privatepure virtual |
Receive a packet from the remote end.
header | Meta info about the incoming packet (obtanied by a previous call to the recvHedaer() method). |
Pointer | to packet received. |
Implemented in gem5::TCPIface.
Referenced by recvThreadFunc().
The function executed by a receiver thread.
Definition at line 672 of file dist_iface.cc.
References gem5::DistIface::Sync::abort(), gem5::curEventQueue(), gem5::exitSimLoop(), header, gem5::DistIface::RecvScheduler::init(), gem5::EventQueue::lock(), gem5::DistIface::Sync::progress(), gem5::DistIface::RecvScheduler::pushPacket(), recvHeader(), recvPacket(), recvScheduler, sync, and gem5::EventQueue::unlock().
Referenced by spawnRecvThread().
|
privatepure virtual |
Send out a control command to the remote end.
header | Meta info describing the command (e.g. sync request) |
Implemented in gem5::TCPIface.
Referenced by gem5::DistIface::SyncNode::run(), and gem5::DistIface::SyncSwitch::run().
|
privatepure virtual |
Send out a data packet to the remote end.
header | Meta info about the packet (which needs to be transferred to the destination alongside the packet). |
packet | Pointer to the packet to send. |
Implemented in gem5::TCPIface.
Referenced by packetOut().
|
overridevirtual |
Serialize an object.
Output an object's state into the current checkpoint section.
cp | Checkpoint state |
Implements gem5::Serializable.
Definition at line 748 of file dist_iface.cc.
References distIfaceId, gem5::DistIface::Sync::drainComplete(), primary, rank, recvScheduler, SERIALIZE_SCALAR, gem5::Serializable::serializeSection(), and sync.
|
static |
Getter for the dist size param.
Definition at line 929 of file dist_iface.cc.
References primary, size, gem5::X86ISA::val, and warn.
Referenced by gem5::pseudo_inst::initParam().
spawn the receiver thread.
recv_done | The receive done event associated with the simulated Ethernet link. |
link_delay | The link delay for the simulated Ethernet link. |
Definition at line 718 of file dist_iface.cc.
References recvThread, recvThreadFunc(), and recvThreadsNum.
Referenced by init().
void gem5::DistIface::startup | ( | ) |
Definition at line 813 of file dist_iface.cc.
References DPRINTF, isSwitch, primary, gem5::DistIface::SyncEvent::start(), syncEvent, and syncStartOnPseudoOp.
Referenced by gem5::DistEtherLink::startup().
|
static |
Trigger the primary to start/stop synchronization.
Definition at line 854 of file dist_iface.cc.
References gem5::ThreadContext::Active, gem5::ThreadContext::getSystemPtr(), inform, primary, gem5::ThreadContext::quiesce(), gem5::ThreadContext::quiesceTick(), gem5::DistIface::Sync::requestStopSync(), gem5::BaseGlobalEvent::scheduled(), gem5::DistIface::SyncEvent::start(), gem5::ThreadContext::status(), sync, syncEvent, sys, gem5::System::threads, and gem5::BaseGlobalEvent::when().
Referenced by gem5::pseudo_inst::togglesync().
|
overridevirtual |
Unserialize an object.
Read an object's state from the current checkpoint section.
cp | Checkpoint state |
Implements gem5::Serializable.
Definition at line 767 of file dist_iface.cc.
References distIfaceId, panic_if, primary, rank, recvScheduler, sync, UNSERIALIZE_SCALAR, and gem5::Serializable::unserializeSection().
|
protected |
Unique id for the dist link.
Definition at line 494 of file dist_iface.hh.
Referenced by DistIface(), gem5::TCPIface::establishConnection(), serialize(), and unserialize().
|
staticprotected |
Number of DistIface objects (i.e.
dist links in this gem5 process)
Definition at line 490 of file dist_iface.hh.
Referenced by DistIface(), gem5::TCPIface::establishConnection(), and ~DistIface().
|
protected |
Definition at line 496 of file dist_iface.hh.
Referenced by DistIface(), and gem5::TCPIface::TCPIface().
|
staticprivate |
Is this node a switch?
Definition at line 523 of file dist_iface.hh.
Referenced by DistIface(), gem5::DistIface::SyncEvent::process(), and startup().
|
staticprivate |
The very first DistIface object created becomes the primary interface.
We need a primary interface to co-ordinate the global synchronisation.
Definition at line 515 of file dist_iface.hh.
Referenced by DistIface(), drain(), drainResume(), init(), gem5::DistIface::SyncEvent::process(), gem5::DistIface::RecvScheduler::pushPacket(), rankParam(), readyToCkpt(), readyToExit(), gem5::DistIface::SyncNode::run(), gem5::DistIface::SyncSwitch::run(), serialize(), sizeParam(), startup(), toggleSync(), unserialize(), and ~DistIface().
|
protected |
The rank of this process among the gem5 peers.
Definition at line 482 of file dist_iface.hh.
Referenced by gem5::TCPIface::establishConnection(), init(), rankParam(), serialize(), and unserialize().
|
private |
Meta information about data packets received.
Definition at line 472 of file dist_iface.hh.
Referenced by drainResume(), packetIn(), recvThreadFunc(), serialize(), and unserialize().
|
private |
Receiver thread pointer.
Each DistIface object must have exactly one receiver thread.
Definition at line 468 of file dist_iface.hh.
Referenced by spawnRecvThread(), and ~DistIface().
|
staticprivate |
Number of receiver threads (in this gem5 process)
Definition at line 502 of file dist_iface.hh.
Referenced by gem5::DistIface::SyncNode::run(), and spawnRecvThread().
|
protected |
The number of gem5 processes comprising this dist simulation.
Definition at line 486 of file dist_iface.hh.
Referenced by sizeParam(), and gem5::TCPIface::TCPIface().
|
staticprivate |
The singleton Sync object to perform dist synchronisation.
Definition at line 506 of file dist_iface.hh.
Referenced by DistIface(), init(), gem5::DistIface::SyncEvent::process(), readyToCkpt(), readyToExit(), recvThreadFunc(), serialize(), gem5::DistIface::SyncEvent::start(), toggleSync(), unserialize(), and ~DistIface().
|
staticprivate |
The singleton SyncEvent object to schedule periodic dist sync.
Definition at line 510 of file dist_iface.hh.
Referenced by DistIface(), drain(), drainResume(), gem5::DistIface::RecvScheduler::pushPacket(), readyToExit(), startup(), toggleSync(), and ~DistIface().
|
private |
Frequency of dist sync events in ticks.
Definition at line 463 of file dist_iface.hh.
Referenced by init().
|
private |
Tick to schedule the first dist sync event.
This is just as optimization : we do not need any dist sync event until the simulated NIC is brought up by the OS.
Definition at line 459 of file dist_iface.hh.
Referenced by init().
|
private |
Use pseudoOp to start synchronization.
Definition at line 476 of file dist_iface.hh.
Referenced by startup().
|
staticprivate |
System pointer used to wakeup sleeping threads when stopping sync.
Definition at line 519 of file dist_iface.hh.
Referenced by gem5::DistIface::SyncEvent::process(), and toggleSync().