summaryrefslogtreecommitdiff
path: root/src/gpgpu-sim/gpu-sim.h
diff options
context:
space:
mode:
authortgrogers <[email protected]>2018-10-09 09:55:54 -0400
committertgrogers <[email protected]>2018-10-09 09:55:54 -0400
commita43799f779a2cf23728659733649506a2d5420df (patch)
tree7d0b410fbf30ee0fad38a9be824f9f9d5e8bb5eb /src/gpgpu-sim/gpu-sim.h
parent2522f06a47ab854ade2bdada3eaff63c0df36bf4 (diff)
Adding in an occupancy metric to match the nvprof metric
Diffstat (limited to 'src/gpgpu-sim/gpu-sim.h')
-rw-r--r--src/gpgpu-sim/gpu-sim.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gpgpu-sim/gpu-sim.h b/src/gpgpu-sim/gpu-sim.h
index 1778008..1bae1fa 100644
--- a/src/gpgpu-sim/gpu-sim.h
+++ b/src/gpgpu-sim/gpu-sim.h
@@ -383,6 +383,32 @@ private:
friend class gpgpu_sim;
};
+struct occupancy_stats {
+ occupancy_stats() : aggregate_warp_slot_filled(0), aggregate_theoretical_warp_slots(0){}
+ occupancy_stats( unsigned long long wsf, unsigned long long tws )
+ : aggregate_warp_slot_filled(wsf), aggregate_theoretical_warp_slots(tws){}
+
+ unsigned long long aggregate_warp_slot_filled;
+ unsigned long long aggregate_theoretical_warp_slots;
+
+ float get_occ_fraction() const {
+ return float(aggregate_warp_slot_filled) / float(aggregate_theoretical_warp_slots);
+ }
+
+ occupancy_stats& operator+=(const occupancy_stats& rhs) {
+ aggregate_warp_slot_filled += rhs.aggregate_warp_slot_filled;
+ aggregate_theoretical_warp_slots += rhs.aggregate_theoretical_warp_slots;
+ return *this;
+ }
+
+ occupancy_stats operator+(const occupancy_stats& rhs) const{
+ return occupancy_stats( aggregate_warp_slot_filled + rhs.aggregate_warp_slot_filled,
+ aggregate_theoretical_warp_slots + rhs.aggregate_theoretical_warp_slots
+ );
+ }
+};
+
+
class gpgpu_sim : public gpgpu_t {
public:
gpgpu_sim( const gpgpu_sim_config &config );
@@ -521,6 +547,9 @@ public:
unsigned long long gpu_tot_sim_insn;
unsigned long long gpu_sim_insn_last_update;
unsigned gpu_sim_insn_last_update_sid;
+ occupancy_stats gpu_occupancy;
+ occupancy_stats gpu_tot_occupancy;
+
FuncCache get_cache_config(std::string kernel_name);
void set_cache_config(std::string kernel_name, FuncCache cacheConfig );
@@ -549,4 +578,5 @@ public:
}
};
+
#endif