From b6203360ef684a8dc32981221336f5d216ce2668 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Fri, 19 Aug 2011 15:08:07 -0500 Subject: LSQ: Set store predictor to periodically clear itself as recommended in the storesets paper. This patch improves performance by as much as 10% on some spec benchmarks. --- src/cpu/o3/store_set.cc | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src/cpu/o3/store_set.cc') diff --git a/src/cpu/o3/store_set.cc b/src/cpu/o3/store_set.cc index fc87c417e..acd4a8d0a 100644 --- a/src/cpu/o3/store_set.cc +++ b/src/cpu/o3/store_set.cc @@ -34,8 +34,8 @@ #include "cpu/o3/store_set.hh" #include "debug/StoreSet.hh" -StoreSet::StoreSet(int _SSIT_size, int _LFST_size) - : SSITSize(_SSIT_size), LFSTSize(_LFST_size) +StoreSet::StoreSet(uint64_t clear_period, int _SSIT_size, int _LFST_size) + : clearPeriod(clear_period), SSITSize(_SSIT_size), LFSTSize(_LFST_size) { DPRINTF(StoreSet, "StoreSet: Creating store set object.\n"); DPRINTF(StoreSet, "StoreSet: SSIT size: %i, LFST size: %i.\n", @@ -68,6 +68,8 @@ StoreSet::StoreSet(int _SSIT_size, int _LFST_size) indexMask = SSITSize - 1; offsetBits = 2; + + memOpsPred = 0; } StoreSet::~StoreSet() @@ -75,10 +77,11 @@ StoreSet::~StoreSet() } void -StoreSet::init(int _SSIT_size, int _LFST_size) +StoreSet::init(uint64_t clear_period, int _SSIT_size, int _LFST_size) { SSITSize = _SSIT_size; LFSTSize = _LFST_size; + clearPeriod = clear_period; DPRINTF(StoreSet, "StoreSet: Creating store set object.\n"); DPRINTF(StoreSet, "StoreSet: SSIT size: %i, LFST size: %i.\n", @@ -103,6 +106,8 @@ StoreSet::init(int _SSIT_size, int _LFST_size) indexMask = SSITSize - 1; offsetBits = 2; + + memOpsPred = 0; } @@ -179,9 +184,22 @@ StoreSet::violation(Addr store_PC, Addr load_PC) } } +void +StoreSet::checkClear() +{ + memOpsPred++; + if (memOpsPred > clearPeriod) { + DPRINTF(StoreSet, "Wiping predictor state beacuse %d ld/st executed\n", + clearPeriod); + memOpsPred = 0; + clear(); + } +} + void StoreSet::insertLoad(Addr load_PC, InstSeqNum load_seq_num) { + checkClear(); // Does nothing. return; } @@ -193,6 +211,7 @@ StoreSet::insertStore(Addr store_PC, InstSeqNum store_seq_num, ThreadID tid) int store_SSID; + checkClear(); assert(index < SSITSize); if (!validSSIT[index]) { -- cgit v1.2.3