MicroGPU 1.0
Simple functional model of a GPU for educational purposes
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ComputeUnit Class Reference

Represents a GPU compute unitThe ComputeUnit class encapsulates the state and behavior of a GPU compute unit. It executes Warp objects, which are groups of threads that execute instructions in lockstep. The ComputeUnit manages the scheduling of warps and executes them in simple round-robin fashion. More...

#include <computeUnit.hh>

Collaboration diagram for ComputeUnit:
Collaboration graph

Public Member Functions

 ComputeUnit ()
 
void setState (SMState newState)
 
void setCurrentWarpId (int warpId)
 
void setWarp (const Warp &warp)
 
void setSmId (int id)
 
void incrementCycle ()
 
void execute ()
 Execute the current warp and advance its pipeline stage. Called once per cycle.
 
int getCurrentWarpId ()
 
SMState getState () const
 
int getWarpCollectionSize () const
 
int getCurrentCycle () const
 
int getSmId () const
 
void printId () const
 
void calculateNextWarpId ()
 Method to calculate the next warp ID to execute based on round-robin scheduling.
 

Private Attributes

std::vector< Warpwarps
 
int smId
 
size_t currentWarpId
 
int currentCycle
 
SMState state
 

Detailed Description

Represents a GPU compute unit

The ComputeUnit class encapsulates the state and behavior of a GPU compute unit. It executes Warp objects, which are groups of threads that execute instructions in lockstep. The ComputeUnit manages the scheduling of warps and executes them in simple round-robin fashion.

Each warp can be in one of following pipeline stages:

-> NOT_STARTED, -> STAGE_0, -> STAGE_1, -> STAGE_2, -> STAGE_3, -> DONE.

Constructor & Destructor Documentation

◆ ComputeUnit()

ComputeUnit::ComputeUnit ( )
inline

Member Function Documentation

◆ calculateNextWarpId()

void ComputeUnit::calculateNextWarpId ( )

Method to calculate the next warp ID to execute based on round-robin scheduling.

◆ execute()

void ComputeUnit::execute ( )

Execute the current warp and advance its pipeline stage. Called once per cycle.

Here is the call graph for this function:

◆ getCurrentCycle()

int ComputeUnit::getCurrentCycle ( ) const
inline

◆ getCurrentWarpId()

int ComputeUnit::getCurrentWarpId ( )

◆ getSmId()

int ComputeUnit::getSmId ( ) const
inline

◆ getState()

SMState ComputeUnit::getState ( ) const

◆ getWarpCollectionSize()

int ComputeUnit::getWarpCollectionSize ( ) const

◆ incrementCycle()

void ComputeUnit::incrementCycle ( )
inline

◆ printId()

void ComputeUnit::printId ( ) const
inline

◆ setCurrentWarpId()

void ComputeUnit::setCurrentWarpId ( int  warpId)

◆ setSmId()

void ComputeUnit::setSmId ( int  id)
inline

◆ setState()

void ComputeUnit::setState ( SMState  newState)

◆ setWarp()

void ComputeUnit::setWarp ( const Warp warp)

Member Data Documentation

◆ currentCycle

int ComputeUnit::currentCycle
private

◆ currentWarpId

size_t ComputeUnit::currentWarpId
private

◆ smId

int ComputeUnit::smId
private

◆ state

SMState ComputeUnit::state
private

◆ warps

std::vector<Warp> ComputeUnit::warps
private

The documentation for this class was generated from the following files: