diff options
| author | Davit Grigoryan <[email protected]> | 2026-04-27 02:10:06 +0000 |
|---|---|---|
| committer | Davit Grigoryan <[email protected]> | 2026-04-27 02:10:06 +0000 |
| commit | 2f190971f5f952f55197d385c688667439bc6649 (patch) | |
| tree | 5f9945497f9ac36ee1cbb35d6aca1dea39e6a08b /src/gpgpu-sim/scoreboard.h | |
| parent | 13d5fae1ac28988d071b4459af169e53361921d8 (diff) | |
add debug scoreboard stats counting
Diffstat (limited to 'src/gpgpu-sim/scoreboard.h')
| -rw-r--r-- | src/gpgpu-sim/scoreboard.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gpgpu-sim/scoreboard.h b/src/gpgpu-sim/scoreboard.h index 9bf51e6..1de81dd 100644 --- a/src/gpgpu-sim/scoreboard.h +++ b/src/gpgpu-sim/scoreboard.h @@ -28,7 +28,9 @@ #include <stdio.h> #include <stdlib.h> +#include <map> #include <set> +#include <utility> #include <vector> #include "assert.h" @@ -56,6 +58,12 @@ class Scoreboard { bool checkCollisionSecondary(unsigned wid, const inst_t *inst) const; void clearSecondary(unsigned wid); + public: + // Accounting / leak-detection (called from gpu-sim end-of-run dump). + // Aggregates reserve/release counts, reservation-duration histogram, + // and any registers still reserved at the end of simulation. + void dumpAccounting(FILE *out) const; + private: void reserveRegister(unsigned wid, unsigned regnum); int get_sid() const { return m_sid; } @@ -72,6 +80,29 @@ class Scoreboard { std::vector<std::set<unsigned> > sec_reg_table; class gpgpu_t *m_gpu; + + // ---- Accounting (per-shader, scalar; cheap to update) ---- + // primary reg_table activity + unsigned long long m_primary_reserve_calls; // reserveRegister insertions + unsigned long long m_primary_release_calls; // releaseRegister erases + // secondary sec_reg_table activity + unsigned long long m_sec_reserve_calls; + unsigned long long m_sec_release_calls; + unsigned long long m_sec_clear_calls; // clearSecondary invocations + unsigned long long m_sec_clear_regs_dropped; // total regs cleared by clearSecondary + // duration tracking — sum of (release_cycle - reserve_cycle) over all completed reservations + unsigned long long m_primary_total_duration_cycles; + unsigned long long m_primary_completed_reservations; + unsigned long long m_primary_max_duration_cycles; + unsigned long long m_sec_total_duration_cycles; + unsigned long long m_sec_completed_reservations; + unsigned long long m_sec_max_duration_cycles; + // reservation timestamp lookup: (wid,reg) -> cycle_reserved + // typedef std::map<std::pair<unsigned,unsigned>, unsigned long long> resv_map_t; + std::map<std::pair<unsigned, unsigned>, unsigned long long> + m_primary_resv_cycle; + std::map<std::pair<unsigned, unsigned>, unsigned long long> + m_sec_resv_cycle; }; #endif /* SCOREBOARD_H_ */ |
