diff options
Diffstat (limited to 'src/gpgpu-sim/scoreboard.h')
| -rw-r--r-- | src/gpgpu-sim/scoreboard.h | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/src/gpgpu-sim/scoreboard.h b/src/gpgpu-sim/scoreboard.h index da34af5..8f736d7 100644 --- a/src/gpgpu-sim/scoreboard.h +++ b/src/gpgpu-sim/scoreboard.h @@ -136,8 +136,15 @@ class Scoreboard { std::vector<std::set<unsigned> > sec_reg_table; // Mode 2: per-warp, per-slot register sets. - // slot_reg_table[wid][slot] = set of reserved register numbers. - std::vector<std::array<std::set<unsigned>, NUM_SLOTS> > slot_reg_table; + // slot_reg_table[wid][slot][reg] = refcount of pending writes to reg + // from this slot. Idempotent insert (set semantics) is *wrong* — two + // consecutive issues from the same slot writing the same reg would + // collapse to a single entry, and the first retire would erase it + // before the second retires, losing the second's pending state. + // Ref-counted map fixes that: each reserve ++, each release --, entry + // erased when count hits 0. + std::vector<std::array<std::map<unsigned, unsigned>, NUM_SLOTS> > + slot_reg_table; // Mode 1: per-warp list of mask-aware reservations. struct mask_resv { @@ -180,6 +187,44 @@ class Scoreboard { m_primary_resv_cycle; std::map<std::pair<unsigned, unsigned>, unsigned long long> m_sec_resv_cycle; + + public: + // Mode 2 (slot-pinned) cross-slot hazard diagnostics. Increments when an + // issue from one slot would have collided with the *opposite* slot's + // pending writes — i.e. a hazard the slot-pinned design currently misses. + // Updated from shader.cc at issue-eligibility check sites. + // The unmasked variant counts any reg-name overlap (including + // lane-disjoint cases that aren't real RAWs). The "_real" variant uses + // a mask-aware shadow table to count only true RAWs. + unsigned long long m_xslot_primary_issue_would_stall = 0; + unsigned long long m_xslot_primary_issue_real_would_stall = 0; + unsigned long long m_xslot_primary_issue_checks = 0; + unsigned long long m_xslot_inter_coissue_would_stall = 0; + unsigned long long m_xslot_inter_coissue_real_would_stall = 0; + unsigned long long m_xslot_inter_coissue_checks = 0; + unsigned long long m_xslot_intra_coissue_would_stall = 0; + unsigned long long m_xslot_intra_coissue_checks = 0; + + // Mask-aware shadow table maintained alongside the slot tables (mode 2 + // only) for diagnostic comparison vs sb=1 ground truth. Each reservation + // pushes (reg, inst's active mask, refcount); each release pops the + // matching (reg, mask) entry. checkCollisionShadow performs the + // sb=1-style mask intersection across ALL entries for the warp. + void reserveShadowMask(unsigned wid, unsigned reg, + const active_mask_t &mask); + void releaseShadowMask(unsigned wid, unsigned reg, + const active_mask_t &mask); + bool checkCollisionShadow(unsigned wid, const class inst_t *inst, + const active_mask_t &mask) const; + // Dump shadow entries that intersect (mask) for any of inst's regs. + // Used by diag tracing to attribute real_would_stall events. + void dumpShadowOverlap(unsigned wid, const class inst_t *inst, + const active_mask_t &mask, FILE *out, + const char *site, unsigned long long cyc) const; + + private: + std::vector<std::vector<mask_resv> > m_xslot_shadow_mask_table; + public: }; #endif /* SCOREBOARD_H_ */ |
