Class simtix::pipelined::InstrBuffer
ClassList > simtix > pipelined > InstrBuffer
A instruction buffer.
#include <instr_buffer.h>
Inherited by the following classes: simtix::uvm::MockInstrBuffer
Classes
Type | Name |
---|---|
struct | InstrStream Represent the instruction stream for a single warp. |
Public Functions
Type | Name |
---|---|
bool | CanEnq (const InstrPtr & instr) const Check if an instruction can be enqueued. |
InstrPtr | Deq (uint32_t wid, std::optional< uint32_t > ssw) Dequeue an instruction from a warp's instruction stream. |
void | Disable (uint32_t wid) Disable a warp’s instruction buffer when encountering exceptions. |
void | Enable (uint32_t wid, uint64_t next_pc) Initialize each warp’s instruction buffer when doing PipelinedSM::Process . |
void | Enq (InstrPtr instr) Enqueue an instruction into the buffer. |
void | ForEachValidInstrStream (TFunc cb) Iterate over each valid instruction stream. |
InstrBuffer (PipelinedSMImpl * sm, const ArchParam & p=kDefaultArchParam, const PipelinedSM::Param & pp=PipelinedSM::kDefaultParam) Construct the instruction buffer. |
|
void | NotifyCtrlFlowChange (uint32_t wid, uint64_t wpc, std::optional< uint64_t > sswpc) Notify the buffer of a control flow change (divergence or convergence). |
void | Reset () Reset the entire instruction buffer (all warps). |
virtual bool | capacious (uint32_t wid, std::optional< uint32_t > ssw) const Check if the instruction stream can accommodate more instructions. |
std::size_t | capacity (uint32_t wid) const Get the instruction buffer capacity for a warp. |
bool | empty (uint32_t wid, std::optional< uint32_t > ssw) const Check if the instruction stream is empty. |
virtual uint64_t | fetch_pc (uint32_t wid, std::optional< uint32_t > ssw) const Get the current fetch PC. |
const InstrPtr & | front (uint32_t wid, std::optional< uint32_t > ssw) const Get the instruction at the front of a warp’s instruction stream. |
bool | full (uint32_t wid, std::optional< uint32_t > ssw) const Check if the instruction stream is full. |
bool | is_diverged (uint32_t wid) const Check whether the warp has diverged. |
uint64_t | next_pc (uint32_t wid, std::optional< uint32_t > ssw) const Get the next PC for the warp’s instruction stream. |
void | set_fetch_pc (uint32_t wid, std::optional< uint32_t > ssw, uint64_t fetch_pc) const Set the fetch PC for a given warp. |
std::size_t | size (uint32_t wid, std::optional< uint32_t > ssw) const Get the number of instructions currently buffered. |
bool | valid (uint32_t wid, std::optional< uint32_t > ssw) const Check whether the instruction stream is valid. |
virtual | ~InstrBuffer () = default |
Protected Attributes
Type | Name |
---|---|
std::vector< std::unique_ptr< InstrStream > > | buf_ |
std::size_t | capacity_ |
const uint32_t | kFetchWidth |
PipelinedSMImpl * | sm_ |
Protected Static Attributes
Type | Name |
---|---|
constexpr std::array< std::optional< uint32_t >, 3 > | kInstrStreamVariants = {std::nullopt, 0, 1} |
Protected Functions
Type | Name |
---|---|
bool | CanEnqInstrToStream (uint32_t wid, std::optional< uint32_t > ssw, uint64_t wpc) const Check if an instruction can be enqueued to the stream. |
void | EnqInstrToStream (uint32_t wid, std::optional< uint32_t > ssw, InstrPtr instr) Enqueue an instruction into the instruction stream. |
void | FlushFIFO (sim::SizedQueue< InstrPtr > * fifo) Flush all instructions in FIFO. |
void | RedirectInstrStream (uint32_t wid, uint64_t fetch_pc, std::optional< uint32_t > ssw) Reset next_pc and fetch_pc. |
void | UpdateFetchPC (InstrStream * is, std::optional< uint32_t > ssw) Update the fetch PC of a given instruction stream. |
Public Functions Documentation
function CanEnq
Check if an instruction can be enqueued.
Parameters:
instr
The instruction to check.
Returns:
True if the instruction can be enqueued.
function Deq
Dequeue an instruction from a warp's instruction stream.
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.
Returns:
The instruction at the front of the stream.
function Disable
Disable a warp’s instruction buffer when encountering exceptions.
Parameters:
wid
Warp ID.
function Enable
Initialize each warp’s instruction buffer when doing PipelinedSM::Process .
Parameters:
function Enq
Enqueue an instruction into the buffer.
Parameters:
instr
The instruction to enqueue.
function ForEachValidInstrStream
Iterate over each valid instruction stream.
template<class TFunc>
inline void simtix::pipelined::InstrBuffer::ForEachValidInstrStream (
TFunc cb
)
Parameters:
cb
Callback function that takes (wid, ssw).
function InstrBuffer
Construct the instruction buffer.
explicit simtix::pipelined::InstrBuffer::InstrBuffer (
PipelinedSMImpl * sm,
const ArchParam & p=kDefaultArchParam,
const PipelinedSM::Param & pp=PipelinedSM::kDefaultParam
)
Parameters:
sm
Pointer to the owning SM implementation.p
Architecture parameters from param.h.pp
Pipeline configuration parameters from pipeline.h.
function NotifyCtrlFlowChange
Notify the buffer of a control flow change (divergence or convergence).
void simtix::pipelined::InstrBuffer::NotifyCtrlFlowChange (
uint32_t wid,
uint64_t wpc,
std::optional< uint64_t > sswpc
)
Parameters:
wid
Warp ID.wpc
Redirected PC for the warp.sswpc
Redirected spatial sub-warp PC from the warp.
function Reset
Reset the entire instruction buffer (all warps).
function capacious
Check if the instruction stream can accommodate more instructions.
inline virtual bool simtix::pipelined::InstrBuffer::capacious (
uint32_t wid,
std::optional< uint32_t > ssw
) const
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.
Returns:
True if enough space is available.
function capacity
Get the instruction buffer capacity for a warp.
Parameters:
wid
Warp ID.
Returns:
Capacity value.
function empty
Check if the instruction stream is empty.
inline bool simtix::pipelined::InstrBuffer::empty (
uint32_t wid,
std::optional< uint32_t > ssw
) const
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.
Returns:
True if empty.
function fetch_pc
Get the current fetch PC.
inline virtual uint64_t simtix::pipelined::InstrBuffer::fetch_pc (
uint32_t wid,
std::optional< uint32_t > ssw
) const
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.
Returns:
Fetch PC value.
function front
Get the instruction at the front of a warp’s instruction stream.
inline const InstrPtr & simtix::pipelined::InstrBuffer::front (
uint32_t wid,
std::optional< uint32_t > ssw
) const
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.
Returns:
A const reference to the front instruction.
function full
Check if the instruction stream is full.
inline bool simtix::pipelined::InstrBuffer::full (
uint32_t wid,
std::optional< uint32_t > ssw
) const
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.
Returns:
True if full.
function is_diverged
Check whether the warp has diverged.
Parameters:
wid
Warp ID.
Returns:
True if diverged.
function next_pc
Get the next PC for the warp’s instruction stream.
inline uint64_t simtix::pipelined::InstrBuffer::next_pc (
uint32_t wid,
std::optional< uint32_t > ssw
) const
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.
Returns:
Next PC value.
function set_fetch_pc
Set the fetch PC for a given warp.
inline void simtix::pipelined::InstrBuffer::set_fetch_pc (
uint32_t wid,
std::optional< uint32_t > ssw,
uint64_t fetch_pc
) const
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.fetch_pc
New fetch PC to set.
function size
Get the number of instructions currently buffered.
inline std::size_t simtix::pipelined::InstrBuffer::size (
uint32_t wid,
std::optional< uint32_t > ssw
) const
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.
Returns:
Number of instructions.
function valid
Check whether the instruction stream is valid.
inline bool simtix::pipelined::InstrBuffer::valid (
uint32_t wid,
std::optional< uint32_t > ssw
) const
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.
Returns:
True if valid.
function ~InstrBuffer
Protected Attributes Documentation
variable buf_
variable capacity_
variable kFetchWidth
variable sm_
Protected Static Attributes Documentation
variable kInstrStreamVariants
constexpr std::array<std::optional<uint32_t>, 3> simtix::pipelined::InstrBuffer::kInstrStreamVariants;
Protected Functions Documentation
function CanEnqInstrToStream
Check if an instruction can be enqueued to the stream.
inline bool simtix::pipelined::InstrBuffer::CanEnqInstrToStream (
uint32_t wid,
std::optional< uint32_t > ssw,
uint64_t wpc
) const
Parameters:
Returns:
True if the instruction can be enqueued.
function EnqInstrToStream
Enqueue an instruction into the instruction stream.
void simtix::pipelined::InstrBuffer::EnqInstrToStream (
uint32_t wid,
std::optional< uint32_t > ssw,
InstrPtr instr
)
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.instr
The instruction to enqueue.
function FlushFIFO
Flush all instructions in FIFO.
Parameters:
fifo
Pointer to a InstrPtr FIFO queue.
function RedirectInstrStream
Reset next_pc and fetch_pc.
void simtix::pipelined::InstrBuffer::RedirectInstrStream (
uint32_t wid,
uint64_t fetch_pc,
std::optional< uint32_t > ssw
)
Parameters:
wid
Warp ID.ssw
Spatial sub-warp ID.next_pc
Next PC.
When the execution path of a warp changed, use this method to redirect the corresponding warp's instruction buffer.
function UpdateFetchPC
Update the fetch PC of a given instruction stream.
inline void simtix::pipelined::InstrBuffer::UpdateFetchPC (
InstrStream * is,
std::optional< uint32_t > ssw
)
Parameters:
is
Pointer to the instruction stream to update.ssw
Spatial sub-warp ID.
Sets fetch_pc to the maximum of the current fetch_pc and next_pc.
The documentation for this class was generated from the following file projects/simtix/src/simtix/sm/pipelined/instr_buffer.h