summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gpgpu-sim/gpu-cache.cc67
-rw-r--r--src/gpgpu-sim/gpu-cache.h69
-rw-r--r--src/gpgpu-sim/gpu-sim.cc8
-rw-r--r--src/gpgpu-sim/l2cache.cc38
-rw-r--r--src/gpgpu-sim/l2cache.h3
-rw-r--r--src/gpgpu-sim/mem_latency_stat.cc6
-rw-r--r--src/gpgpu-sim/mem_latency_stat.h8
7 files changed, 147 insertions, 52 deletions
diff --git a/src/gpgpu-sim/gpu-cache.cc b/src/gpgpu-sim/gpu-cache.cc
index d050946..0ef6452 100644
--- a/src/gpgpu-sim/gpu-cache.cc
+++ b/src/gpgpu-sim/gpu-cache.cc
@@ -769,11 +769,7 @@ void cache_stats::print_stats(FILE *fout, const char *cache_name) const{
mem_access_type_str((enum mem_access_type)type),
cache_request_status_str((enum cache_request_status)status),
m_stats[type][status]);
- fprintf(fout, "\t%s[%s][%s] = %u\n",
- m_cache_name.c_str(),
- mem_access_type_str((enum mem_access_type)type),
- cache_request_status_str((enum cache_request_status)status),
- m_stats_pw[type][status]);
+
if(status != RESERVATION_FAIL)
total_access[type]+= m_stats[type][status];
}
@@ -834,23 +830,6 @@ unsigned cache_stats::get_stats(enum mem_access_type *access_type, unsigned num_
return total;
}
-unsigned cache_stats::get_stats_pw(enum mem_access_type *access_type, unsigned num_access_type, enum cache_request_status *access_status, unsigned num_access_status) const{
- ///
- /// Returns a sum of the stats corresponding to each "access_type" and "access_status" pair.
- /// "access_type" is an array of "num_access_type" mem_access_types.
- /// "access_status" is an array of "num_access_status" cache_request_statuses.
- ///
- unsigned total=0;
- for(unsigned type =0; type < num_access_type; ++type){
- for(unsigned status=0; status < num_access_status; ++status){
- if(!check_valid((int)access_type[type], (int)access_status[status]))
- assert(0 && "Unknown cache access type or access outcome");
- total += m_stats_pw[access_type[type]][access_status[status]];
- }
- }
- return total;
-}
-
void cache_stats::get_sub_stats(struct cache_sub_stats &css) const{
///
/// Overwrites "css" with the appropriate statistics from this cache.
@@ -881,11 +860,11 @@ void cache_stats::get_sub_stats(struct cache_sub_stats &css) const{
css = t_css;
}
-void cache_stats::get_sub_stats_pw(struct cache_sub_stats &css) const{
+void cache_stats::get_sub_stats_pw(struct cache_sub_stats_pw &css) const{
///
/// Overwrites "css" with the appropriate statistics from this cache.
///
- struct cache_sub_stats t_css;
+ struct cache_sub_stats_pw t_css;
t_css.clear();
for (unsigned type = 0; type < NUM_MEM_ACCESS_TYPE; ++type) {
@@ -893,23 +872,43 @@ void cache_stats::get_sub_stats_pw(struct cache_sub_stats &css) const{
if(status == HIT || status == MISS || status == SECTOR_MISS || status == HIT_RESERVED)
t_css.accesses += m_stats_pw[type][status];
- if(status == MISS || status == SECTOR_MISS)
- t_css.misses += m_stats_pw[type][status];
+ if(status == HIT){
+ if(type == GLOBAL_ACC_R || type == CONST_ACC_R || type == INST_ACC_R){
+ t_css.read_hits += m_stats_pw[type][status];
+ } else if(type == GLOBAL_ACC_W){
+ t_css.write_hits += m_stats_pw[type][status];
+ }
+ }
- if(status == HIT_RESERVED)
- t_css.pending_hits += m_stats_pw[type][status];
+ if(status == MISS || status == SECTOR_MISS){
+ if(type == GLOBAL_ACC_R || type == CONST_ACC_R || type == INST_ACC_R){
+ t_css.read_misses += m_stats_pw[type][status];
+ } else if(type == GLOBAL_ACC_W){
+ t_css.write_misses += m_stats_pw[type][status];
+ }
+ }
- if(status == RESERVATION_FAIL)
- t_css.res_fails += m_stats_pw[type][status];
+ if(status == HIT_RESERVED){
+ if(type == GLOBAL_ACC_R || type == CONST_ACC_R || type == INST_ACC_R){
+ t_css.read_pending_hits += m_stats_pw[type][status];
+ } else if(type == GLOBAL_ACC_W){
+ t_css.write_pending_hits += m_stats_pw[type][status];
+ }
+ }
+
+ if(status == RESERVATION_FAIL){
+ if(type == GLOBAL_ACC_R || type == CONST_ACC_R || type == INST_ACC_R){
+ t_css.read_res_fails += m_stats_pw[type][status];
+ } else if(type == GLOBAL_ACC_W){
+ t_css.write_res_fails += m_stats_pw[type][status];
+ }
+ }
}
}
- t_css.port_available_cycles = m_cache_port_available_cycles;
- t_css.data_port_busy_cycles = m_cache_data_port_busy_cycles;
- t_css.fill_port_busy_cycles = m_cache_fill_port_busy_cycles;
-
css = t_css;
}
+
bool cache_stats::check_valid(int type, int status) const{
///
/// Verify a valid access_type/access_status
diff --git a/src/gpgpu-sim/gpu-cache.h b/src/gpgpu-sim/gpu-cache.h
index c1061ef..5449db7 100644
--- a/src/gpgpu-sim/gpu-cache.h
+++ b/src/gpgpu-sim/gpu-cache.h
@@ -968,6 +968,66 @@ struct cache_sub_stats{
void print_port_stats(FILE *fout, const char *cache_name) const;
};
+
+// Used for collecting AerialVision per-window statistics
+struct cache_sub_stats_pw{
+ unsigned accesses;
+ unsigned write_misses;
+ unsigned write_hits;
+ unsigned write_pending_hits;
+ unsigned write_res_fails;
+
+ unsigned read_misses;
+ unsigned read_hits;
+ unsigned read_pending_hits;
+ unsigned read_res_fails;
+
+ cache_sub_stats_pw(){
+ clear();
+ }
+ void clear(){
+ accesses = 0;
+ write_misses = 0;
+ write_hits = 0;
+ write_pending_hits = 0;
+ write_res_fails = 0;
+ read_misses = 0;
+ read_hits = 0;
+ read_pending_hits = 0;
+ read_res_fails = 0;
+ }
+ cache_sub_stats_pw &operator+=(const cache_sub_stats_pw &css){
+ ///
+ /// Overloading += operator to easily accumulate stats
+ ///
+ accesses += css.accesses;
+ write_misses += css.write_misses;
+ read_misses += css.read_misses;
+ write_pending_hits += css.write_pending_hits;
+ read_pending_hits += css.read_pending_hits;
+ write_res_fails += css.write_res_fails;
+ read_res_fails += css.read_res_fails;
+ return *this;
+ }
+
+ cache_sub_stats_pw operator+(const cache_sub_stats_pw &cs){
+ ///
+ /// Overloading + operator to easily accumulate stats
+ ///
+ cache_sub_stats_pw ret;
+ ret.accesses = accesses + cs.accesses;
+ ret.write_misses = write_misses + cs.write_misses;
+ ret.read_misses = read_misses + cs.read_misses;
+ ret.write_pending_hits = write_pending_hits + cs.write_pending_hits;
+ ret.read_pending_hits = read_pending_hits + cs.read_pending_hits;
+ ret.write_res_fails = write_res_fails + cs.write_res_fails;
+ ret.read_res_fails = read_res_fails + cs.read_res_fails;
+ return ret;
+ }
+
+};
+
+
///
/// Cache_stats
/// Used to record statistics for each cache.
@@ -996,8 +1056,7 @@ public:
void get_sub_stats(struct cache_sub_stats &css) const;
// Get per-window cache stats for AerialVision
- unsigned get_stats_pw(enum mem_access_type *access_type, unsigned num_access_type, enum cache_request_status *access_status, unsigned num_access_status) const;
- void get_sub_stats_pw(struct cache_sub_stats &css) const;
+ void get_sub_stats_pw(struct cache_sub_stats_pw &css) const;
void sample_cache_port_utility(bool data_port_busy, bool fill_port_busy);
private:
@@ -1092,8 +1151,12 @@ public:
void get_sub_stats(struct cache_sub_stats &css) const {
m_stats.get_sub_stats(css);
}
+ // Clear per-window stats for AerialVision support
+ void clear_pw(){
+ m_stats.clear_pw();
+ }
// Per-window sub stats for AerialVision support
- void get_sub_stats_pw(struct cache_sub_stats &css) const {
+ void get_sub_stats_pw(struct cache_sub_stats_pw &css) const {
m_stats.get_sub_stats_pw(css);
}
diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc
index c253367..56b9681 100644
--- a/src/gpgpu-sim/gpu-sim.cc
+++ b/src/gpgpu-sim/gpu-sim.cc
@@ -917,6 +917,7 @@ void gpgpu_sim::update_stats() {
void gpgpu_sim::print_stats()
{
ptx_file_line_stats_write_file();
+ visualizer_printstat();
gpu_print_stat();
if (g_network_mode) {
@@ -1148,9 +1149,6 @@ void gpgpu_sim::gpu_print_stat()
cache_stats l2_stats;
struct cache_sub_stats l2_css;
struct cache_sub_stats total_l2_css;
- cache_stats l2_stats_pw;
- struct cache_sub_stats l2_css_pw;
- struct cache_sub_stats total_l2_css_pw;
l2_stats.clear();
l2_css.clear();
total_l2_css.clear();
@@ -1159,15 +1157,11 @@ void gpgpu_sim::gpu_print_stat()
for (unsigned i=0;i<m_memory_config->m_n_mem_sub_partition;i++){
m_memory_sub_partition[i]->accumulate_L2cache_stats(l2_stats);
m_memory_sub_partition[i]->get_L2cache_sub_stats(l2_css);
- m_memory_sub_partition[i]->get_L2cache_sub_stats_pw(l2_css_pw);
fprintf( stdout, "L2_cache_bank[%d]: Access = %u, Miss = %u, Miss_rate = %.3lf, Pending_hits = %u, Reservation_fails = %u\n",
i, l2_css.accesses, l2_css.misses, (double)l2_css.misses / (double)l2_css.accesses, l2_css.pending_hits, l2_css.res_fails);
- fprintf( stdout, "L2_cache_bank[%d]: Access = %u, Miss = %u, Miss_rate = %.3lf, Pending_hits = %u, Reservation_fails = %u\n",
- i, l2_css_pw.accesses, l2_css_pw.misses, (double)l2_css_pw.misses / (double)l2_css_pw.accesses, l2_css_pw.pending_hits, l2_css_pw.res_fails);
total_l2_css += l2_css;
- total_l2_css_pw += l2_css_pw;
}
if (!m_memory_config->m_L2_config.disabled() && m_memory_config->m_L2_config.get_num_lines()) {
//L2c_print_cache_stat();
diff --git a/src/gpgpu-sim/l2cache.cc b/src/gpgpu-sim/l2cache.cc
index a662446..0237525 100644
--- a/src/gpgpu-sim/l2cache.cc
+++ b/src/gpgpu-sim/l2cache.cc
@@ -519,14 +519,23 @@ void memory_sub_partition::print( FILE *fp ) const
void memory_stats_t::visualizer_print( gzFile visualizer_file )
{
- // gzprintf(visualizer_file, "Ltwowritemiss: %d\n", L2_write_miss);
- // gzprintf(visualizer_file, "Ltwowritehit: %d\n", L2_write_access-L2_write_miss);
- // gzprintf(visualizer_file, "Ltworeadmiss: %d\n", L2_read_miss);
- // gzprintf(visualizer_file, "Ltworeadhit: %d\n", L2_read_access-L2_read_miss);
+ gzprintf(visualizer_file, "Ltwowritemiss: %d\n", L2_write_miss);
+ gzprintf(visualizer_file, "Ltwowritehit: %d\n", L2_write_hit);
+ gzprintf(visualizer_file, "Ltworeadmiss: %d\n", L2_read_miss);
+ gzprintf(visualizer_file, "Ltworeadhit: %d\n", L2_read_hit);
+ clear_L2_stats_pw();
+
if (num_mfs)
gzprintf(visualizer_file, "averagemflatency: %lld\n", mf_total_lat/num_mfs);
}
+void memory_stats_t::clear_L2_stats_pw(){
+ L2_write_miss = 0;
+ L2_write_hit = 0;
+ L2_read_miss = 0;
+ L2_read_hit = 0;
+}
+
void gpgpu_sim::print_dram_stats(FILE *fout) const
{
unsigned cmd=0;
@@ -718,13 +727,28 @@ void memory_sub_partition::get_L2cache_sub_stats(struct cache_sub_stats &css) co
}
}
-void memory_sub_partition::get_L2cache_sub_stats_pw(struct cache_sub_stats &css) const{
+void memory_sub_partition::get_L2cache_sub_stats_pw(struct cache_sub_stats_pw &css) const{
if (!m_config->m_L2_config.disabled()) {
m_L2cache->get_sub_stats_pw(css);
}
}
+
+void memory_sub_partition::clear_L2cache_stats_pw() {
+ if (!m_config->m_L2_config.disabled()) {
+ m_L2cache->clear_pw();
+ }
+}
+
void memory_sub_partition::visualizer_print( gzFile visualizer_file )
{
- // TODO: Add visualizer stats for L2 cache
-}
+ // TODO: Add visualizer stats for L2 cache
+ cache_sub_stats_pw temp_sub_stats;
+ get_L2cache_sub_stats_pw(temp_sub_stats);
+ m_stats->L2_read_miss += temp_sub_stats.read_misses;
+ m_stats->L2_write_miss += temp_sub_stats.write_misses;
+ m_stats->L2_read_hit += temp_sub_stats.read_hits;
+ m_stats->L2_write_hit += temp_sub_stats.write_hits;
+
+ clear_L2cache_stats_pw();
+}
diff --git a/src/gpgpu-sim/l2cache.h b/src/gpgpu-sim/l2cache.h
index 57f3e94..beafdd3 100644
--- a/src/gpgpu-sim/l2cache.h
+++ b/src/gpgpu-sim/l2cache.h
@@ -181,7 +181,8 @@ public:
void get_L2cache_sub_stats(struct cache_sub_stats &css) const;
// Support for getting per-window L2 stats for AerialVision
- void get_L2cache_sub_stats_pw(struct cache_sub_stats &css) const;
+ void get_L2cache_sub_stats_pw(struct cache_sub_stats_pw &css) const;
+ void clear_L2cache_stats_pw();
void force_l2_tag_update(new_addr_type addr, unsigned time, mem_access_sector_mask_t mask)
{
diff --git a/src/gpgpu-sim/mem_latency_stat.cc b/src/gpgpu-sim/mem_latency_stat.cc
index c5452b9..49abae4 100644
--- a/src/gpgpu-sim/mem_latency_stat.cc
+++ b/src/gpgpu-sim/mem_latency_stat.cc
@@ -129,6 +129,12 @@ memory_stats_t::memory_stats_t( unsigned n_shader, const struct shader_core_conf
}
}
+ // AerialVision L2 stats
+ L2_read_miss = 0;
+ L2_write_miss = 0;
+ L2_read_hit = 0;
+ L2_write_hit = 0;
+
L2_cbtoL2length = (unsigned int*) calloc(mem_config->m_n_mem, sizeof(unsigned int));
L2_cbtoL2writelength = (unsigned int*) calloc(mem_config->m_n_mem, sizeof(unsigned int));
L2_L2tocblength = (unsigned int*) calloc(mem_config->m_n_mem, sizeof(unsigned int));
diff --git a/src/gpgpu-sim/mem_latency_stat.h b/src/gpgpu-sim/mem_latency_stat.h
index 5b89202..982b9ae 100644
--- a/src/gpgpu-sim/mem_latency_stat.h
+++ b/src/gpgpu-sim/mem_latency_stat.h
@@ -47,6 +47,9 @@ public:
void visualizer_print( gzFile visualizer_file );
+ // Reset local L2 stats that are aggregated each sampling window
+ void clear_L2_stats_pw();
+
unsigned m_n_shader;
const struct shader_core_config *m_shader_config;
@@ -84,6 +87,11 @@ public:
unsigned ***mem_access_type_stats; // dram access type classification
+ // AerialVision L2 stats
+ unsigned L2_read_miss;
+ unsigned L2_write_miss;
+ unsigned L2_read_hit;
+ unsigned L2_write_hit;
// L2 cache stats
unsigned int *L2_cbtoL2length;