|
MicroGPU 1.0
Simple functional model of a GPU for educational purposes
|
Represents a GPU warpThe Warp class encapsulates the state and behavior of a GPU warp, including its ID, program counter, threads, active mask, and current instruction. A warp is a group of threads that execute instructions in lockstep. Each warp has 32 threads in this project. To be added: reconvergence stack to handle divergent control flow. More...
#include <warp.hh>

Public Member Functions | |
| Warp () | |
| Warp (int warpId, const ThreadGroup &threadGroup, WarpState warpState=WarpState::READY, PipelineStage pipelineStage=PipelineStage::NOT_STARTED, bool isBranchDivergent=false) | |
| int | getId () const |
| int | getPc () const |
| void | setPc (int pc_) |
| void | setCurrentInstruction (const Instruction &instr) |
| Instruction | getCurrentInstruction () const |
| PipelineStage | getPipelineStage () const |
| void | setPipelineStage (PipelineStage stage) |
| void | setActiveMask (const ActiveMask &mask) |
| std::string | getPipelineStageString () const |
| const ActiveMask & | getActiveMask () const |
| WarpState | getState () const |
| bool | isDivergent () const |
| void | setDivergent () |
| void | execute () |
| std::string | getInstructionTypeString (Instruction inst) const |
| void | addReconvergencePoint (int pc, const ActiveMask &mask) |
| Add a reconvergence point to the stack. | |
| void | peekReconvergencePoint () const |
| Peek the top reconvergence point on the stack This method is used for debugging purposes to check the current reconvergence points for a warp. | |
| void | popReconvergencePoint () |
| Pop the top reconvergence point from the stack This method is called when a reconvergence point is reached during execution to restore the active mask and program counter for the warp. | |
| size_t | getReconvergenceStackSize () const |
| std::bitset< WARP_THREAD_COUNT > | getActiveMaskFromReconvergenceStack () const |
| Get the active mask from the top reconvergence point on the stack. | |
Private Attributes | |
| int | id |
| int | pc |
| ThreadGroup | threads |
| ActiveMask | activeMask |
| Instruction | currentInstruction |
| std::vector< reconvergencePoint > | reconvergenceStack |
| Reconvergence stack for handling divergent control flow. | |
| WarpState | state |
| PipelineStage | pipelineStage |
| bool | isBranchDivergent = false |
Represents a GPU warp
The Warp class encapsulates the state and behavior of a GPU warp, including its ID, program counter, threads, active mask, and current instruction. A warp is a group of threads that execute instructions in lockstep. Each warp has 32 threads in this project. To be added: reconvergence stack to handle divergent control flow.
| Warp::Warp | ( | ) |
| Warp::Warp | ( | int | warpId, |
| const ThreadGroup & | threadGroup, | ||
| WarpState | warpState = WarpState::READY, |
||
| PipelineStage | pipelineStage = PipelineStage::NOT_STARTED, |
||
| bool | isBranchDivergent = false |
||
| ) |
| void Warp::addReconvergencePoint | ( | int | pc, |
| const ActiveMask & | mask | ||
| ) |
Add a reconvergence point to the stack.
| pc | The program counter value at the reconvergence point |
| mask | The active mask at the reconvergence point This method is called when a divergent branch is encountered to save the reconvergence point information on the stack. |
| void Warp::execute | ( | ) |

| const ActiveMask & Warp::getActiveMask | ( | ) | const |
| std::bitset< WARP_THREAD_COUNT > Warp::getActiveMaskFromReconvergenceStack | ( | ) | const |
Get the active mask from the top reconvergence point on the stack.
| Instruction Warp::getCurrentInstruction | ( | ) | const |
| int Warp::getId | ( | ) | const |
| std::string Warp::getInstructionTypeString | ( | Instruction | inst | ) | const |
| int Warp::getPc | ( | ) | const |
|
inline |
| std::string Warp::getPipelineStageString | ( | ) | const |
| size_t Warp::getReconvergenceStackSize | ( | ) | const |
|
inline |
|
inline |
| void Warp::peekReconvergencePoint | ( | ) | const |
Peek the top reconvergence point on the stack This method is used for debugging purposes to check the current reconvergence points for a warp.
| void Warp::popReconvergencePoint | ( | ) |
Pop the top reconvergence point from the stack This method is called when a reconvergence point is reached during execution to restore the active mask and program counter for the warp.
|
inline |
| void Warp::setCurrentInstruction | ( | const Instruction & | instr | ) |
|
inline |
| void Warp::setPc | ( | int | pc_ | ) |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Reconvergence stack for handling divergent control flow.
|
private |
|
private |