MicroGPU 1.0
Simple functional model of a GPU for educational purposes
Loading...
Searching...
No Matches
ugpu.hh
Go to the documentation of this file.
1#ifndef MICROGPU_HH
2#define MICROGPU_HH
3#include<iostream>
4#include<string>
5#include<vector>
6#include<array>
7#include<bitset>
8
9#include "../warp/warp.hh"
10#include "../computeUnit/computeUnit.hh"
11
13#define CU_COUNT 16
26class MicroGPU {
27 std::vector <Warp> globalWarpCollection;
28
29 // Collection of Streaming Multiprocessors
30 std::array<ComputeUnit, CU_COUNT> computeUnit;
33
34 public:
35 MicroGPU();
36 void init();
37 void assignWarpToSM(int smId, const Warp &warp);
38 void addWarpToGlobalCollection(const Warp &warp);
40 int getCurrentCycle() const { return currentCycle; }
44 void setMaxCycles(int cycles) { maxCycles = cycles; }
45
46 // test method
48 void printComputeUnitStatus() const;
49 bool allComputeUnitsDone() const;
50 bool allWarpsCompleted() const;
51
56 void executeComputeUnits(); // Method to execute warps in compute units for one cycle
57
62 void executeGPU(); // Method to execute the entire GPU until all warps are completed
63
64
65};
66#endif // MICROGPU_HH
Represents a microGPUThe MicroGPU class encapsulates the state and behavior of a microGPU,...
Definition ugpu.hh:26
int currentCycle
Definition ugpu.hh:31
void init()
Definition ugpu.cc:8
void setMaxCycles(int cycles)
Definition ugpu.hh:44
std::array< ComputeUnit, CU_COUNT > computeUnit
Definition ugpu.hh:30
void executeGPU()
Execute the entire GPU until all warps are completed.
Definition ugpu.cc:113
void performWarpSchedulingSimple()
Definition ugpu.cc:95
void createGlobalWarpCollectionTest()
Definition ugpu.cc:28
int getCurrentCycle() const
Definition ugpu.hh:40
std::vector< Warp > globalWarpCollection
Definition ugpu.hh:27
void performWarpScheduling()
Definition ugpu.cc:51
void assignWarpToSM(int smId, const Warp &warp)
Definition ugpu.cc:64
void addWarpToGlobalCollection(const Warp &warp)
Definition ugpu.cc:19
bool allWarpsCompleted() const
Definition ugpu.cc:87
int maxCycles
Definition ugpu.hh:32
void printComputeUnitStatus() const
Definition ugpu.cc:69
void executeComputeUnits()
Execute all compute units for one cycle.
Definition ugpu.cc:107
int getGlobalWarpCollectionSize() const
Definition ugpu.cc:24
bool allComputeUnitsDone() const
Definition ugpu.cc:78
void incrementCycle()
Definition ugpu.hh:41
MicroGPU()
Definition ugpu.cc:3
Represents a GPU warpThe Warp class encapsulates the state and behavior of a GPU warp,...
Definition warp.hh:77