From 2f190971f5f952f55197d385c688667439bc6649 Mon Sep 17 00:00:00 2001 From: Davit Grigoryan Date: Mon, 27 Apr 2026 02:10:06 +0000 Subject: add debug scoreboard stats counting --- src/gpgpu-sim/scoreboard.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/gpgpu-sim/scoreboard.h') 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 #include +#include #include +#include #include #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 > 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, unsigned long long> resv_map_t; + std::map, unsigned long long> + m_primary_resv_cycle; + std::map, unsigned long long> + m_sec_resv_cycle; }; #endif /* SCOREBOARD_H_ */ -- cgit v1.3