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
MicroGPU Class Reference

Represents a microGPUThe MicroGPU class encapsulates the state and behavior of a microGPU, which consists of multiple compute units (CUs) that execute warps of threads. In this project miroGPU has 16 compute units, each capable of executing one warp at a time. MicroGPU schedules warps from its global warp collection to the compute units and then Compute Units execute the warps in a simple round-robin fashion. More...

#include <ugpu.hh>

Collaboration diagram for MicroGPU:
Collaboration graph

Public Member Functions

 MicroGPU ()
 
void init ()
 
void assignWarpToSM (int smId, const Warp &warp)
 
void addWarpToGlobalCollection (const Warp &warp)
 Add a warp to the global warp collection.
 
int getGlobalWarpCollectionSize () const
 
int getCurrentCycle () const
 
void incrementCycle ()
 
void performWarpScheduling ()
 
void performWarpSchedulingSimple ()
 Perform simple warp scheduling This function assigns alternating warps from the global collection to the first two compute units in a round-robin fashion. Just for testing purposes to verify that warps are being scheduled and executed correctly. In real life, all Compute Units would be utilized.
 
void setMaxCycles (int cycles)
 
void createGlobalWarpCollectionTest ()
 Create a Global Warp Collection Test object This method creates a set of test warps with simple instructions and adds them to the global warp collection for testing purposes. Each warp is initialized with a simple ADD instruction and all threads in the warp are set to active. Additionally, one warp with a branch instruction is added to test divergence handling in the compute units.
 
void printComputeUnitStatus () const
 
bool allComputeUnitsDone () const
 
bool allWarpsCompleted () const
 
void executeComputeUnits ()
 Execute all compute units for one cycle.
 
void executeGPU ()
 Execute the entire GPU until all warps are completed.
 

Private Attributes

std::vector< WarpglobalWarpCollection
 
std::array< ComputeUnit, CU_COUNTcomputeUnit
 
int currentCycle
 
int maxCycles
 

Detailed Description

Represents a microGPU

The MicroGPU class encapsulates the state and behavior of a microGPU, which consists of multiple compute units (CUs) that execute warps of threads. In this project miroGPU has 16 compute units, each capable of executing one warp at a time. MicroGPU schedules warps from its global warp collection to the compute units and then Compute Units execute the warps in a simple round-robin fashion.

Constructor & Destructor Documentation

◆ MicroGPU()

MicroGPU::MicroGPU ( )

Member Function Documentation

◆ addWarpToGlobalCollection()

void MicroGPU::addWarpToGlobalCollection ( const Warp warp)

Add a warp to the global warp collection.

Parameters
warpThe warp to be added to the global collection
Here is the call graph for this function:

◆ allComputeUnitsDone()

bool MicroGPU::allComputeUnitsDone ( ) const

◆ allWarpsCompleted()

bool MicroGPU::allWarpsCompleted ( ) const
Here is the call graph for this function:

◆ assignWarpToSM()

void MicroGPU::assignWarpToSM ( int  smId,
const Warp warp 
)
Here is the call graph for this function:

◆ createGlobalWarpCollectionTest()

void MicroGPU::createGlobalWarpCollectionTest ( )

Create a Global Warp Collection Test object This method creates a set of test warps with simple instructions and adds them to the global warp collection for testing purposes. Each warp is initialized with a simple ADD instruction and all threads in the warp are set to active. Additionally, one warp with a branch instruction is added to test divergence handling in the compute units.

Here is the call graph for this function:

◆ executeComputeUnits()

void MicroGPU::executeComputeUnits ( )

Execute all compute units for one cycle.

◆ executeGPU()

void MicroGPU::executeGPU ( )

Execute the entire GPU until all warps are completed.

Here is the call graph for this function:

◆ getCurrentCycle()

int MicroGPU::getCurrentCycle ( ) const
inline

◆ getGlobalWarpCollectionSize()

int MicroGPU::getGlobalWarpCollectionSize ( ) const

◆ incrementCycle()

void MicroGPU::incrementCycle ( )
inline

◆ init()

void MicroGPU::init ( )

◆ performWarpScheduling()

void MicroGPU::performWarpScheduling ( )
Here is the call graph for this function:

◆ performWarpSchedulingSimple()

void MicroGPU::performWarpSchedulingSimple ( )

Perform simple warp scheduling This function assigns alternating warps from the global collection to the first two compute units in a round-robin fashion. Just for testing purposes to verify that warps are being scheduled and executed correctly. In real life, all Compute Units would be utilized.

Here is the call graph for this function:

◆ printComputeUnitStatus()

void MicroGPU::printComputeUnitStatus ( ) const

◆ setMaxCycles()

void MicroGPU::setMaxCycles ( int  cycles)
inline

Member Data Documentation

◆ computeUnit

std::array<ComputeUnit, CU_COUNT> MicroGPU::computeUnit
private

◆ currentCycle

int MicroGPU::currentCycle
private

◆ globalWarpCollection

std::vector<Warp> MicroGPU::globalWarpCollection
private

◆ maxCycles

int MicroGPU::maxCycles
private

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