summaryrefslogtreecommitdiff
path: root/src/gpgpu-sim/gpu-cache.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpgpu-sim/gpu-cache.h')
-rw-r--r--src/gpgpu-sim/gpu-cache.h77
1 files changed, 57 insertions, 20 deletions
diff --git a/src/gpgpu-sim/gpu-cache.h b/src/gpgpu-sim/gpu-cache.h
index 5fd40a9..c07695f 100644
--- a/src/gpgpu-sim/gpu-cache.h
+++ b/src/gpgpu-sim/gpu-cache.h
@@ -72,6 +72,13 @@ enum cache_event_type {
WRITE_ALLOCATE_SENT
};
+enum cache_gpu_level {
+ L1_GPU_CACHE = 0,
+ L2_GPU_CACHE,
+ OTHER_GPU_CACHE,
+ NUM_CACHE_GPU_LEVELS
+};
+
struct evicted_block_info {
new_addr_type m_block_addr;
unsigned m_modified_size;
@@ -1200,20 +1207,26 @@ class cache_stats {
void clear();
// Clear AerialVision cache stats after each window
void clear_pw();
- void inc_stats(int access_type, int access_outcome);
+ void inc_stats(int access_type, int access_outcome,
+ unsigned long long streamID);
// Increment AerialVision cache stats
- void inc_stats_pw(int access_type, int access_outcome);
- void inc_fail_stats(int access_type, int fail_outcome);
+ void inc_stats_pw(int access_type, int access_outcome,
+ unsigned long long streamID);
+ void inc_fail_stats(int access_type, int fail_outcome,
+ unsigned long long streamID);
enum cache_request_status select_stats_status(
enum cache_request_status probe, enum cache_request_status access) const;
unsigned long long &operator()(int access_type, int access_outcome,
- bool fail_outcome);
+ bool fail_outcome,
+ unsigned long long streamID);
unsigned long long operator()(int access_type, int access_outcome,
- bool fail_outcome) const;
+ bool fail_outcome,
+ unsigned long long streamID) const;
cache_stats operator+(const cache_stats &cs);
cache_stats &operator+=(const cache_stats &cs);
- void print_stats(FILE *fout, const char *cache_name = "Cache_stats") const;
- void print_fail_stats(FILE *fout,
+ void print_stats(FILE *fout, unsigned long long streamID,
+ const char *cache_name = "Cache_stats") const;
+ void print_fail_stats(FILE *fout, unsigned long long streamID,
const char *cache_name = "Cache_fail_stats") const;
unsigned long long get_stats(enum mem_access_type *access_type,
@@ -1231,10 +1244,14 @@ class cache_stats {
bool check_valid(int type, int status) const;
bool check_fail_valid(int type, int fail) const;
- std::vector<std::vector<unsigned long long> > m_stats;
+ // CUDA streamID -> cache stats[NUM_MEM_ACCESS_TYPE]
+ std::map<unsigned long long, std::vector<std::vector<unsigned long long>>>
+ m_stats;
// AerialVision cache stats (per-window)
- std::vector<std::vector<unsigned long long> > m_stats_pw;
- std::vector<std::vector<unsigned long long> > m_fail_stats;
+ std::map<unsigned long long, std::vector<std::vector<unsigned long long>>>
+ m_stats_pw;
+ std::map<unsigned long long, std::vector<std::vector<unsigned long long>>>
+ m_fail_stats;
unsigned long long m_cache_port_available_cycles;
unsigned long long m_cache_data_port_busy_cycles;
@@ -1264,11 +1281,14 @@ class baseline_cache : public cache_t {
public:
baseline_cache(const char *name, cache_config &config, int core_id,
int type_id, mem_fetch_interface *memport,
- enum mem_fetch_status status)
+ enum mem_fetch_status status, enum cache_gpu_level level,
+ gpgpu_sim *gpu)
: m_config(config),
m_tag_array(new tag_array(config, core_id, type_id)),
m_mshrs(config.m_mshr_entries, config.m_mshr_max_merge),
- m_bandwidth_management(config) {
+ m_bandwidth_management(config),
+ m_level(level),
+ m_gpu(gpu) {
init(name, config, memport, status);
}
@@ -1336,6 +1356,15 @@ class baseline_cache : public cache_t {
bool fill_port_free() const {
return m_bandwidth_management.fill_port_free();
}
+ void inc_aggregated_stats(cache_request_status status,
+ cache_request_status cache_status, mem_fetch *mf,
+ enum cache_gpu_level level);
+ void inc_aggregated_fail_stats(cache_request_status status,
+ cache_request_status cache_status,
+ mem_fetch *mf, enum cache_gpu_level level);
+ void inc_aggregated_stats_pw(cache_request_status status,
+ cache_request_status cache_status, mem_fetch *mf,
+ enum cache_gpu_level level);
// This is a gapping hole we are poking in the system to quickly handle
// filling the cache on cudamemcopies. We don't care about anything other than
@@ -1367,6 +1396,8 @@ class baseline_cache : public cache_t {
std::list<mem_fetch *> m_miss_queue;
enum mem_fetch_status m_miss_queue_status;
mem_fetch_interface *m_memport;
+ cache_gpu_level m_level;
+ gpgpu_sim *m_gpu;
struct extra_mf_fields {
extra_mf_fields() { m_valid = false; }
@@ -1453,8 +1484,10 @@ class read_only_cache : public baseline_cache {
public:
read_only_cache(const char *name, cache_config &config, int core_id,
int type_id, mem_fetch_interface *memport,
- enum mem_fetch_status status)
- : baseline_cache(name, config, core_id, type_id, memport, status) {}
+ enum mem_fetch_status status, enum cache_gpu_level level,
+ gpgpu_sim *gpu)
+ : baseline_cache(name, config, core_id, type_id, memport, status, level,
+ gpu) {}
/// Access cache for read_only_cache: returns RESERVATION_FAIL if request
/// could not be accepted (for any reason)
@@ -1478,8 +1511,10 @@ class data_cache : public baseline_cache {
data_cache(const char *name, cache_config &config, int core_id, int type_id,
mem_fetch_interface *memport, mem_fetch_allocator *mfcreator,
enum mem_fetch_status status, mem_access_type wr_alloc_type,
- mem_access_type wrbk_type, class gpgpu_sim *gpu)
- : baseline_cache(name, config, core_id, type_id, memport, status) {
+ mem_access_type wrbk_type, class gpgpu_sim *gpu,
+ enum cache_gpu_level level)
+ : baseline_cache(name, config, core_id, type_id, memport, status, level,
+ gpu) {
init(mfcreator);
m_wr_alloc_type = wr_alloc_type;
m_wrbk_type = wrbk_type;
@@ -1668,9 +1703,10 @@ class l1_cache : public data_cache {
public:
l1_cache(const char *name, cache_config &config, int core_id, int type_id,
mem_fetch_interface *memport, mem_fetch_allocator *mfcreator,
- enum mem_fetch_status status, class gpgpu_sim *gpu)
+ enum mem_fetch_status status, class gpgpu_sim *gpu,
+ enum cache_gpu_level level)
: data_cache(name, config, core_id, type_id, memport, mfcreator, status,
- L1_WR_ALLOC_R, L1_WRBK_ACC, gpu) {}
+ L1_WR_ALLOC_R, L1_WRBK_ACC, gpu, level) {}
virtual ~l1_cache() {}
@@ -1693,9 +1729,10 @@ class l2_cache : public data_cache {
public:
l2_cache(const char *name, cache_config &config, int core_id, int type_id,
mem_fetch_interface *memport, mem_fetch_allocator *mfcreator,
- enum mem_fetch_status status, class gpgpu_sim *gpu)
+ enum mem_fetch_status status, class gpgpu_sim *gpu,
+ enum cache_gpu_level level)
: data_cache(name, config, core_id, type_id, memport, mfcreator, status,
- L2_WR_ALLOC_R, L2_WRBK_ACC, gpu) {}
+ L2_WR_ALLOC_R, L2_WRBK_ACC, gpu, level) {}
virtual ~l2_cache() {}