Skip to content

Commit

Permalink
Upgraded TTP implementation. All experiment files and rollup scripts …
Browse files Browse the repository at this point in the history
…are also updated accordingly
  • Loading branch information
Rahul Bera committed Sep 12, 2022
1 parent 0bf777f commit aadb49f
Show file tree
Hide file tree
Showing 19 changed files with 402 additions and 244 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Our experimental workflow consists of two stages: (1) launching experiments, and
| HMP-GShare | Hit-miss predictor with GShare prediction |
| HMP-GSkew | Hit-miss predictor with GSkew prediction |
| HMP-Ensemble | Hit-miss predictor with all three types combined |
| LP | [Level predictor](https://arxiv.org/pdf/2103.14808.pdf) [Jalili+, HPCA'22] with only on-chip metadata storage |
| TTP | Tag-tracking based predictor |
| Perc | Perceptron-based OCP used in this paper |
- You can also quickly implement your own off-chip predictor just by extending `OffchipPredBase` class and implement your own `predict()` and `train()` functions. For a new type of off-chip predictor, please call the initialization function in `src/offchip_pred.cc`.
Expand Down
9 changes: 0 additions & 9 deletions config/ocp_lp.ini

This file was deleted.

10 changes: 10 additions & 0 deletions config/ocp_ttp.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# generic knobs
offchip_pred_type = lp
offchip_pred_mark_merged_load = false

# specific knobs
ocp_ttp_partial_tag_size = 30
ocp_ttp_catalog_cache_sets = 16384
ocp_ttp_catalog_cache_assoc = 24
ocp_ttp_hash_type = 5
ocp_ttp_enable_track_llc_eviction = true
38 changes: 19 additions & 19 deletions experiments/MICRO22_AE.exp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PYTHIA = --l2c_prefetcher_types=scooby --config=$(HERMES_HOME)/config/pythia.ini

OCP_PERC = --config=$(HERMES_HOME)/config/ocp_hermes.ini
OCP_HMP_ENSEMBLE = --config=$(HERMES_HOME)/config/ocp_hmp_ensemble.ini
OCP_LP = --config=$(HERMES_HOME)/config/ocp_lp.ini
OCP_TTP = --config=$(HERMES_HOME)/config/ocp_ttp.ini
OCP_RANDOM = --config=$(HERMES_HOME)/config/ocp_random.ini

HERMES_O = --config=$(HERMES_HOME)/config/hermes_base.ini --ddrp_req_latency=6
Expand All @@ -30,29 +30,29 @@ nopref $(BASE)

# system with prior prefetchers
pythia $(BASE) $(PYTHIA)
sms $(BASE) $(SMS)
spp $(BASE) $(SPP)
bingo $(BASE) $(BINGO)
mlop $(BASE) $(MLOP)
# sms $(BASE) $(SMS)
# spp $(BASE) $(SPP)
# bingo $(BASE) $(BINGO)
# mlop $(BASE) $(MLOP)

# Hermes standalone
hermes_o $(BASE) $(OCP_PERC) $(HERMES_O)
hermes_p $(BASE) $(OCP_PERC) $(HERMES_P)
# # Hermes standalone
# hermes_o $(BASE) $(OCP_PERC) $(HERMES_O)
# hermes_p $(BASE) $(OCP_PERC) $(HERMES_P)

# Hermes along with Pythia
pythia_with_hermes_o $(BASE) $(PYTHIA) $(OCP_PERC) $(HERMES_O)
pythia_with_hermes_p $(BASE) $(PYTHIA) $(OCP_PERC) $(HERMES_P)
# pythia_with_hermes_p $(BASE) $(PYTHIA) $(OCP_PERC) $(HERMES_P)

# LP and HMP with Pythia
# HMP and TTP with Pythia
pythia_with_hmp $(BASE) $(PYTHIA) $(OCP_HMP_ENSEMBLE) $(HERMES_O)
pythia_with_lp $(BASE) $(PYTHIA) $(OCP_LP) $(HERMES_O)
pythia_with_ttp $(BASE) $(PYTHIA) $(OCP_TTP) $(HERMES_O)

# Hermes in presence of various prior prefetchers
sms_with_hermes_o $(BASE) $(SMS) $(OCP_PERC) $(HERMES_O)
sms_with_hermes_p $(BASE) $(SMS) $(OCP_PERC) $(HERMES_P)
spp_with_hermes_o $(BASE) $(SPP) $(OCP_PERC) $(HERMES_O)
spp_with_hermes_p $(BASE) $(SPP) $(OCP_PERC) $(HERMES_P)
bingo_with_hermes_o $(BASE) $(BINGO) $(OCP_PERC) $(HERMES_O)
bingo_with_hermes_p $(BASE) $(BINGO) $(OCP_PERC) $(HERMES_P)
mlop_with_hermes_o $(BASE) $(MLOP) $(OCP_PERC) $(HERMES_O)
mlop_with_hermes_p $(BASE) $(MLOP) $(OCP_PERC) $(HERMES_P)
# sms_with_hermes_o $(BASE) $(SMS) $(OCP_PERC) $(HERMES_O)
# sms_with_hermes_p $(BASE) $(SMS) $(OCP_PERC) $(HERMES_P)
# spp_with_hermes_o $(BASE) $(SPP) $(OCP_PERC) $(HERMES_O)
# spp_with_hermes_p $(BASE) $(SPP) $(OCP_PERC) $(HERMES_P)
# bingo_with_hermes_o $(BASE) $(BINGO) $(OCP_PERC) $(HERMES_O)
# bingo_with_hermes_p $(BASE) $(BINGO) $(OCP_PERC) $(HERMES_P)
# mlop_with_hermes_o $(BASE) $(MLOP) $(OCP_PERC) $(HERMES_O)
# mlop_with_hermes_p $(BASE) $(MLOP) $(OCP_PERC) $(HERMES_P)
Binary file modified experiments/MICRO22_AE.xlsx
Binary file not shown.
4 changes: 2 additions & 2 deletions experiments/automate_rollup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ cd outputs/
$ROLLUP_SCRIPT --tlist ../MICRO22_AE.tlist --exp ../rollup_perf_hermes.exp --mfile ../rollup_perf.mfile > ../rollup_perf_hermes.csv
cd -

echo "Rolling up statistics for perf. comparison of Pythia, Pythia+LP, Pythia+HMP, and Pythia+Hermes (Fig. 13)..."
echo "Rolling up statistics for perf. comparison of Pythia, Pythia+HMP, Pythia+TTP, and Pythia+Hermes (Fig. 13)..."
cd outputs/
$ROLLUP_SCRIPT --tlist ../MICRO22_AE.tlist --exp ../rollup_perf_hermes_hmp_lp.exp --mfile ../rollup_perf.mfile > ../rollup_perf_hermes_hmp_lp.csv
$ROLLUP_SCRIPT --tlist ../MICRO22_AE.tlist --exp ../rollup_perf_hermes_hmp_ttp.exp --mfile ../rollup_perf.mfile > ../rollup_perf_hermes_hmp_ttp.csv
cd -

echo "Rolling up statistics for perf. comparison of Hermes with varying underlying prefetchers (Fig. 16b)..."
Expand Down
2 changes: 1 addition & 1 deletion experiments/extras/extras.exp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PYTHIA = --l2c_prefetcher_types=scooby --config=$(HERMES_HOME)/config/pythia.ini

OCP_PERC = --config=$(HERMES_HOME)/config/ocp_hermes.ini
OCP_HMP_ENSEMBLE = --config=$(HERMES_HOME)/config/ocp_hmp_ensemble.ini
OCP_LP = --config=$(HERMES_HOME)/config/ocp_lp.ini
OCP_TTP = --config=$(HERMES_HOME)/config/ocp_ttp.ini
OCP_RANDOM = --config=$(HERMES_HOME)/config/ocp_random.ini

HERMES_O = --config=$(HERMES_HOME)/config/hermes_base.ini --ddrp_req_latency=6
Expand Down
6 changes: 3 additions & 3 deletions experiments/rollup_cov_acc.exp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PYTHIA = --l2c_prefetcher_types=scooby --config=$(HERMES_HOME)/config/pythia.ini

OCP_PERC = --config=$(HERMES_HOME)/config/ocp_hermes.ini
OCP_HMP_ENSEMBLE = --config=$(HERMES_HOME)/config/ocp_hmp_ensemble.ini
OCP_LP = --config=$(HERMES_HOME)/config/ocp_lp.ini
OCP_TTP = --config=$(HERMES_HOME)/config/ocp_ttp.ini
OCP_RANDOM = --config=$(HERMES_HOME)/config/ocp_random.ini

HERMES_O = --config=$(HERMES_HOME)/config/hermes_base.ini --ddrp_req_latency=6
Expand All @@ -28,6 +28,6 @@ HERMES_P = --config=$(HERMES_HOME)/config/hermes_base.ini --ddrp_req_latency=18
# Hermes along with Pythia
pythia_with_hermes_o $(BASE) $(PYTHIA) $(OCP_PERC) $(HERMES_O)

# LP and HMP with Pythia
# HMP and TTP with Pythia
pythia_with_hmp $(BASE) $(PYTHIA) $(OCP_HMP_ENSEMBLE) $(HERMES_O)
pythia_with_lp $(BASE) $(PYTHIA) $(OCP_LP) $(HERMES_O)
pythia_with_ttp $(BASE) $(PYTHIA) $(OCP_TTP) $(HERMES_O)
2 changes: 1 addition & 1 deletion experiments/rollup_perf_hermes.exp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PYTHIA = --l2c_prefetcher_types=scooby --config=$(HERMES_HOME)/config/pythia.ini

OCP_PERC = --config=$(HERMES_HOME)/config/ocp_hermes.ini
OCP_HMP_ENSEMBLE = --config=$(HERMES_HOME)/config/ocp_hmp_ensemble.ini
OCP_LP = --config=$(HERMES_HOME)/config/ocp_lp.ini
OCP_TTP = --config=$(HERMES_HOME)/config/ocp_ttp.ini
OCP_RANDOM = --config=$(HERMES_HOME)/config/ocp_random.ini

HERMES_O = --config=$(HERMES_HOME)/config/hermes_base.ini --ddrp_req_latency=6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PYTHIA = --l2c_prefetcher_types=scooby --config=$(HERMES_HOME)/config/pythia.ini

OCP_PERC = --config=$(HERMES_HOME)/config/ocp_hermes.ini
OCP_HMP_ENSEMBLE = --config=$(HERMES_HOME)/config/ocp_hmp_ensemble.ini
OCP_LP = --config=$(HERMES_HOME)/config/ocp_lp.ini
OCP_TTP = --config=$(HERMES_HOME)/config/ocp_ttp.ini
OCP_RANDOM = --config=$(HERMES_HOME)/config/ocp_random.ini

HERMES_O = --config=$(HERMES_HOME)/config/hermes_base.ini --ddrp_req_latency=6
Expand All @@ -34,6 +34,6 @@ pythia $(BASE) $(PYTHIA)
# Hermes along with Pythia
pythia_with_hermes_o $(BASE) $(PYTHIA) $(OCP_PERC) $(HERMES_O)

# LP and HMP with Pythia
# HMP and TTP with Pythia
pythia_with_hmp $(BASE) $(PYTHIA) $(OCP_HMP_ENSEMBLE) $(HERMES_O)
pythia_with_lp $(BASE) $(PYTHIA) $(OCP_LP) $(HERMES_O)
pythia_with_ttp $(BASE) $(PYTHIA) $(OCP_TTP) $(HERMES_O)
2 changes: 1 addition & 1 deletion experiments/rollup_perf_varying_prefetcher.exp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PYTHIA = --l2c_prefetcher_types=scooby --config=$(HERMES_HOME)/config/pythia.ini

OCP_PERC = --config=$(HERMES_HOME)/config/ocp_hermes.ini
OCP_HMP_ENSEMBLE = --config=$(HERMES_HOME)/config/ocp_hmp_ensemble.ini
OCP_LP = --config=$(HERMES_HOME)/config/ocp_lp.ini
OCP_TTP = --config=$(HERMES_HOME)/config/ocp_ttp.ini
OCP_RANDOM = --config=$(HERMES_HOME)/config/ocp_random.ini

HERMES_O = --config=$(HERMES_HOME)/config/hermes_base.ini --ddrp_req_latency=6
Expand Down
53 changes: 0 additions & 53 deletions inc/offchip_pred_lp.h

This file was deleted.

82 changes: 82 additions & 0 deletions inc/offchip_pred_ttp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*********************************************************************
* This file implements Tag-Tracking based Off-chip Predictor (TTP).
* The core idea behind TTP is similar to MissMap [Loh+, MICRO'11]
* and Location Map [Jalili+, HPCA'22].
*
* TTP implements a catalog, which tries to track address tags of
* all cachelines present the cache hierarchy. For every LLC eviction
* we evict the tag from the catalog.
*
* During prediction, TTP looks up the catalog with the load address.
* If the tag is present in the catalog -> load will NOT go off-chip
* Otherwise, the load will go off-chip.
*
*
* Author: Rahul Bera ([email protected])
*********************************************************************/

#ifndef OFFCHIP_PRED_TTP_H
#define OFFCHIP_PRED_TTP_H

#include <unordered_map>
#include "offchip_pred_base.h"

class OffchipPredTTP : public OffchipPredBase
{
private:
/* Ideally, catalog_cache should only track partial tags of all cachelines.
* Since LP also needs to track LLC evictions, we have added means to
* track both virtual address tag and physical address tag of a cacheline.
*/
vector<deque<pair<uint32_t, uint32_t>>> catalog_cache;

/* This is a reverse index of catalog cache.
* For a given physical address, it provides the set index
* of the corresponding virtual address in the catalog cache
*/
unordered_map<uint32_t, uint32_t> catalog_cache_rev_index;

struct
{
struct
{
uint64_t called;
uint64_t not_offchip;
uint64_t not_offchip_and_in_catalog;
uint64_t not_offchip_and_added_in_catalog;
uint64_t went_offchip;
uint64_t went_offchip_and_not_in_catalog;
uint64_t went_offchip_and_deleted_from_catalog;
} train;

struct
{
uint64_t called;
uint64_t physical_tag_not_found;
uint64_t deleted_from_catalog_cache;
uint64_t found_in_rev_index_not_found_in_catalog;
} llc_eviction;
} stats;

private:
void update_catalog_cache(uint64_t vaddr, uint64_t paddr, bool went_offchip);
uint32_t get_partial_tag(uint64_t addr);
bool lookup_catalog_cache(uint64_t addr);
void add_to_catalog_cache_rev_index(uint32_t p_partial_tag, uint32_t set);
void delete_from_catalog_cache_rev_index(uint32_t p_partial_tag);

public:
OffchipPredTTP(uint32_t _cpu, string _type, uint64_t _seed);
~OffchipPredTTP();

void print_config();
void dump_stats();
void reset_stats();
void train(ooo_model_instr *arch_instr, uint32_t data_index, LSQ_ENTRY *lq_entry);
bool predict(ooo_model_instr *arch_instr, uint32_t data_index, LSQ_ENTRY *lq_entry);
void track_llc_eviction(uint64_t paddr);
};

#endif /* OFFCHIP_PRED_TTP_H */


3 changes: 2 additions & 1 deletion inc/ooo_cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ class O3_CPU
void initialize_offchip_predictor(uint64_t seed),
dump_stats_offchip_predictor(),
print_config_offchip_predictor(),
offchip_predictor_update_dram_bw(uint8_t dram_bw);
offchip_predictor_update_dram_bw(uint8_t dram_bw),
offchip_predictor_track_llc_eviction(uint32_t set, uint32_t way, uint64_t address);

// DDRP
void issue_ddrp_request(uint32_t lq_index, uint32_t call_type);
Expand Down
6 changes: 6 additions & 0 deletions src/cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,12 @@ void CACHE::handle_fill()
update_replacement_state(fill_cpu, set, way, MSHR.entry[mshr_index].full_addr, MSHR.entry[mshr_index].ip, block[set][way].full_addr, MSHR.entry[mshr_index].type, 0);
}

// update off-chip predictor for LLC evictions
if (cache_type == IS_LLC)
{
ooo_cpu[fill_cpu].offchip_predictor_track_llc_eviction(set, way, block[set][way].full_addr);
}

// // @RBERA: moved this code to handle_read
// // @RBERA: if this is a load fill in LLC, then monitor the position of the load in ROB
// if(cache_type == IS_LLC && MSHR.entry[mshr_index].type == LOAD)
Expand Down
33 changes: 19 additions & 14 deletions src/knobs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,12 @@ namespace knob
vector<int32_t> ocp_hmp_gskew_hash_types;
uint32_t ocp_hmp_gskew_pht_size = 1024;

/* Offchip Predictor LP */
uint32_t ocp_lp_partial_tag_size = 16;
uint32_t ocp_lp_catalog_cache_sets = 1024;
uint32_t ocp_lp_catalog_cache_assoc = 24;
uint32_t ocp_lp_hash_type = 5;
/* Offchip Predictor TTP */
uint32_t ocp_ttp_partial_tag_size = 16;
uint32_t ocp_ttp_catalog_cache_sets = 1024;
uint32_t ocp_ttp_catalog_cache_assoc = 24;
uint32_t ocp_ttp_hash_type = 5;
bool ocp_ttp_enable_track_llc_eviction = true;

// DDRP
bool enable_ddrp = false;
Expand Down Expand Up @@ -1832,22 +1833,26 @@ int parse_knobs(void* user, const char* section, const char* name, const char* v
knob::ocp_hmp_gskew_pht_size = atoi(value);
}

/* Offchip Predictor LP */
else if (MATCH("", "ocp_lp_partial_tag_size"))
/* Offchip Predictor TTP */
else if (MATCH("", "ocp_ttp_partial_tag_size"))
{
knob::ocp_lp_partial_tag_size = atoi(value);
knob::ocp_ttp_partial_tag_size = atoi(value);
}
else if (MATCH("", "ocp_lp_catalog_cache_sets"))
else if (MATCH("", "ocp_ttp_catalog_cache_sets"))
{
knob::ocp_lp_catalog_cache_sets = atoi(value);
knob::ocp_ttp_catalog_cache_sets = atoi(value);
}
else if (MATCH("", "ocp_lp_catalog_cache_assoc"))
else if (MATCH("", "ocp_ttp_catalog_cache_assoc"))
{
knob::ocp_lp_catalog_cache_assoc = atoi(value);
knob::ocp_ttp_catalog_cache_assoc = atoi(value);
}
else if (MATCH("", "ocp_lp_hash_type"))
else if (MATCH("", "ocp_ttp_hash_type"))
{
knob::ocp_lp_hash_type = atoi(value);
knob::ocp_ttp_hash_type = atoi(value);
}
else if (MATCH("", "ocp_ttp_enable_track_llc_eviction"))
{
knob::ocp_ttp_enable_track_llc_eviction = !strcmp(value, "true") ? true : false;
}

// Direcr DRAM Prefetch (DDRP)
Expand Down
Loading

0 comments on commit aadb49f

Please sign in to comment.