From 5eebb5d3938302ffff1ab80e09bf6065e2fa1c92 Mon Sep 17 00:00:00 2001 From: Tayler Hetherington Date: Sun, 9 Jun 2013 21:56:23 -0800 Subject: Fixing interconnect stats bug [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 16428] --- src/gpgpu-sim/gpu-sim.cc | 14 +++++++------- src/gpgpu-sim/power_interface.cc | 7 ++----- src/gpgpu-sim/power_stat.cc | 4 ++-- src/gpgpu-sim/power_stat.h | 12 ++++++------ src/gpgpu-sim/shader.cc | 10 +++++----- src/gpgpu-sim/shader.h | 18 +++++++++--------- src/gpuwattch/gpgpu_sim_wrapper.cc | 2 +- src/gpuwattch/gpgpu_sim_wrapper.h | 2 +- 8 files changed, 33 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index 39216f9..a8ebe5d 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -919,17 +919,17 @@ void gpgpu_sim::gpu_print_stat() // Interconnect power stat print - unsigned total_simt_to_mem=0; - unsigned total_mem_to_simt=0; - unsigned temp_stm=0; - unsigned temp_mts = 0; + long total_simt_to_mem=0; + long total_mem_to_simt=0; + long temp_stm=0; + long temp_mts = 0; for(unsigned i=0; iset_icnt_stats(temp_stm, temp_mts); total_simt_to_mem += temp_stm; total_mem_to_simt += temp_mts; } - printf("\nicnt_total_pkts_mem_to_simt=%u\n", total_mem_to_simt); - printf("icnt_total_pkts_simt_to_mem=%u\n\n", total_simt_to_mem); + printf("\nicnt_total_pkts_mem_to_simt=%ld\n", total_mem_to_simt); + printf("icnt_total_pkts_simt_to_mem=%ld\n", total_simt_to_mem); time_vector_print(); @@ -1161,7 +1161,7 @@ void gpgpu_sim::cycle() if (m_cluster[i]->get_not_completed() || get_more_cta_left() ) { m_cluster[i]->core_cycle(); *active_sms+=m_cluster[i]->get_n_active_sms(); - // Interconnect power stats: SIMT->MEM + m_cluster[i]->set_icnt_stats(m_power_stats->pwr_mem_stat->n_simt_to_mem[0][i], m_power_stats->pwr_mem_stat->n_mem_to_simt[0][i]); } } diff --git a/src/gpgpu-sim/power_interface.cc b/src/gpgpu-sim/power_interface.cc index 0c67039..7d87222 100644 --- a/src/gpgpu-sim/power_interface.cc +++ b/src/gpgpu-sim/power_interface.cc @@ -99,11 +99,8 @@ void mcpat_cycle(const gpgpu_sim_config &config, const struct shader_core_config (power_stats->get_sfu_active_lanes())/stat_sample_freq); - //NoC stats (32/4)--> Number of 32 bit words in 32B block - //unsigned l2cache_tot_access = power_stats->get_l2_read_accesses() + power_stats->get_l2_write_accesses(); - unsigned n_icnt_simt_to_mem = power_stats->get_icnt_simt_to_mem(); // # flits from SIMT clusters to memory partitions - unsigned n_icnt_mem_to_simt = power_stats->get_icnt_mem_to_simt(); // # flits from memory partitions to SIMT clusters - //wrapper->set_NoC_power((double)(n_icnt_mem_to_simt + n_icnt_simt_to_mem)); // Number of flits traversing the interconnect + double n_icnt_simt_to_mem = (double)power_stats->get_icnt_simt_to_mem(); // # flits from SIMT clusters to memory partitions + double n_icnt_mem_to_simt = (double)power_stats->get_icnt_mem_to_simt(); // # flits from memory partitions to SIMT clusters wrapper->set_NoC_power(n_icnt_mem_to_simt, n_icnt_simt_to_mem); // Number of flits traversing the interconnect wrapper->compute(); diff --git a/src/gpgpu-sim/power_stat.cc b/src/gpgpu-sim/power_stat.cc index 034f7bb..74c8aef 100644 --- a/src/gpgpu-sim/power_stat.cc +++ b/src/gpgpu-sim/power_stat.cc @@ -96,8 +96,8 @@ void power_mem_stat_t::init(){ // Interconnect stats //n_mem_to_simt[i] = (unsigned *)calloc(m_config->m_n_mem,sizeof(unsigned)); // Counted at memory partition - n_mem_to_simt[i] = (unsigned *)calloc(m_core_config->n_simt_clusters,sizeof(unsigned)); // Counted at SM - n_simt_to_mem[i] = (unsigned *)calloc(m_core_config->n_simt_clusters,sizeof(unsigned)); // Counted at SM + n_mem_to_simt[i] = (long *)calloc(m_core_config->n_simt_clusters,sizeof(long)); // Counted at SM + n_simt_to_mem[i] = (long *)calloc(m_core_config->n_simt_clusters,sizeof(long)); // Counted at SM } } diff --git a/src/gpgpu-sim/power_stat.h b/src/gpgpu-sim/power_stat.h index 28909f0..75bdd28 100644 --- a/src/gpgpu-sim/power_stat.h +++ b/src/gpgpu-sim/power_stat.h @@ -112,8 +112,8 @@ struct mem_power_stats_pod{ unsigned *n_req[2]; // Interconnect stats - unsigned *n_simt_to_mem[2]; - unsigned *n_mem_to_simt[2]; + long *n_simt_to_mem[2]; + long *n_mem_to_simt[2]; }; @@ -585,16 +585,16 @@ public: return total; } - unsigned get_icnt_simt_to_mem(){ - unsigned total=0; + long get_icnt_simt_to_mem(){ + long total=0; for(unsigned i=0; in_simt_clusters; ++i){ total += (pwr_mem_stat->n_simt_to_mem[0][i] - pwr_mem_stat->n_simt_to_mem[1][i]); } return total; } - unsigned get_icnt_mem_to_simt(){ - unsigned total=0; + long get_icnt_mem_to_simt(){ + long total=0; for(unsigned i=0; in_simt_clusters; ++i){ total += (pwr_mem_stat->n_mem_to_simt[0][i] - pwr_mem_stat->n_mem_to_simt[1][i]); } diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc index 011a21d..c649967 100644 --- a/src/gpgpu-sim/shader.cc +++ b/src/gpgpu-sim/shader.cc @@ -2595,7 +2595,7 @@ void shader_core_ctx::get_cache_stats(unsigned &read_accesses, unsigned &write_a m_ldst_unit->get_cache_stats(read_accesses, write_accesses, read_misses, write_misses, cache_type); } -void shader_core_ctx::set_icnt_power_stats(unsigned &n_simt_to_mem, unsigned &n_mem_to_simt) const{ +void shader_core_ctx::set_icnt_power_stats(long &n_simt_to_mem, long &n_mem_to_simt) const{ n_simt_to_mem += m_stats->n_simt_to_mem[m_sid]; n_mem_to_simt += m_stats->n_mem_to_simt[m_sid]; } @@ -3084,7 +3084,7 @@ void simt_core_cluster::icnt_cycle() mf->set_status(IN_CLUSTER_TO_SHADER_QUEUE,gpu_sim_cycle+gpu_tot_sim_cycle); //m_memory_stats->memlatstat_read_done(mf,m_shader_config->max_warps_per_shader); m_response_fifo.push_back(mf); - m_stats->n_mem_to_simt[m_config->sid_to_cid(mf->get_sid())] += mf->get_num_flits(false); + m_stats->n_mem_to_simt[m_cluster_id] += mf->get_num_flits(false); } } @@ -3119,9 +3119,9 @@ void simt_core_cluster::get_cache_stats(unsigned &read_accesses, unsigned &write } } -void simt_core_cluster::set_icnt_stats(unsigned &n_simt_to_mem, unsigned &n_mem_to_simt) const { - unsigned simt_to_mem=0; - unsigned mem_to_simt=0; +void simt_core_cluster::set_icnt_stats(long &n_simt_to_mem, long &n_mem_to_simt) const { + long simt_to_mem=0; + long mem_to_simt=0; for ( unsigned i = 0; i < m_config->n_simt_cores_per_cluster; ++i ) { m_core[i]->set_icnt_power_stats(simt_to_mem, mem_to_simt); } diff --git a/src/gpgpu-sim/shader.h b/src/gpgpu-sim/shader.h index f4d300b..3979ad1 100644 --- a/src/gpgpu-sim/shader.h +++ b/src/gpgpu-sim/shader.h @@ -1375,8 +1375,8 @@ struct shader_core_stats_pod { unsigned *l1d_write_access; // L1 Data cache write access unsigned *l1d_write_miss; // L1 Data cache write miss - unsigned *n_simt_to_mem; // Interconnect power stats - unsigned *n_mem_to_simt; + long *n_simt_to_mem; // Interconnect power stats + long *n_mem_to_simt; }; class shader_core_stats : public shader_core_stats_pod { @@ -1438,8 +1438,8 @@ public: l1d_write_access = (unsigned *)calloc(config->num_shader(), sizeof(unsigned)); l1d_write_miss = (unsigned *)calloc(config->num_shader(), sizeof(unsigned)); - n_simt_to_mem = (unsigned *)calloc(config->num_shader(), sizeof(unsigned)); - n_mem_to_simt = (unsigned *)calloc(config->num_shader(), sizeof(unsigned)); + n_simt_to_mem = (long *)calloc(config->num_shader(), sizeof(long)); + n_mem_to_simt = (long *)calloc(config->num_shader(), sizeof(long)); gpgpu_n_shmem_bank_access = (unsigned *)calloc(config->num_shader(), sizeof(unsigned)); @@ -1586,7 +1586,7 @@ public: void print_cache_stats( FILE *fp, unsigned& dl1_accesses, unsigned& dl1_misses ); void get_cache_stats(unsigned &read_accesses, unsigned &write_accesses, unsigned &read_misses, unsigned &write_misses, unsigned cache_type); - void set_icnt_power_stats(unsigned &n_simt_to_mem, unsigned &n_mem_to_simt) const; + void set_icnt_power_stats(long &n_simt_to_mem, long &n_mem_to_simt) const; // debug: void display_simt_state(FILE *fout, int mask ) const; @@ -1830,7 +1830,7 @@ public: void print_cache_stats( FILE *fp, unsigned& dl1_accesses, unsigned& dl1_misses ) const; void get_cache_stats(unsigned &read_accesses, unsigned &write_accesses, unsigned &read_misses, unsigned &write_misses, unsigned cache_type) const; - void set_icnt_stats(unsigned &n_simt_to_mem, unsigned &n_mem_to_simt) const; + void set_icnt_stats(long &n_simt_to_mem, long &n_mem_to_simt) const; private: unsigned m_cluster_id; @@ -1854,8 +1854,8 @@ public: } virtual void push(mem_fetch *mf) { - m_cluster->icnt_inject_request_packet(mf); - m_core->inc_simt_to_mem(mf->get_num_flits(true)); + m_core->inc_simt_to_mem(mf->get_num_flits(true)); + m_cluster->icnt_inject_request_packet(mf); } private: shader_core_ctx *m_core; @@ -1873,8 +1873,8 @@ public: { if ( mf && mf->isatomic() ) mf->do_atomic(); // execute atomic inside the "memory subsystem" - m_cluster->push_response_fifo(mf); m_core->inc_simt_to_mem(mf->get_num_flits(true)); + m_cluster->push_response_fifo(mf); } private: shader_core_ctx *m_core; diff --git a/src/gpuwattch/gpgpu_sim_wrapper.cc b/src/gpuwattch/gpgpu_sim_wrapper.cc index 0f534b9..6a67b67 100644 --- a/src/gpuwattch/gpgpu_sim_wrapper.cc +++ b/src/gpuwattch/gpgpu_sim_wrapper.cc @@ -408,7 +408,7 @@ void gpgpu_sim_wrapper::set_active_lanes_power(double sp_avg_active_lane, double p->sys.core[0].sfu_average_active_lanes = sfu_avg_active_lane; } -void gpgpu_sim_wrapper::set_NoC_power(double noc_tot_reads,double noc_tot_writes ) +void gpgpu_sim_wrapper::set_NoC_power(double noc_tot_reads, double noc_tot_writes ) { p->sys.NoC[0].total_accesses = noc_tot_reads * p->sys.scaling_coefficients[NOC_A] + noc_tot_writes * p->sys.scaling_coefficients[NOC_A]; perf_count[NOC_A]=noc_tot_reads+noc_tot_writes; diff --git a/src/gpuwattch/gpgpu_sim_wrapper.h b/src/gpuwattch/gpgpu_sim_wrapper.h index f37d4f8..f7f5066 100644 --- a/src/gpuwattch/gpgpu_sim_wrapper.h +++ b/src/gpuwattch/gpgpu_sim_wrapper.h @@ -77,7 +77,7 @@ public: void set_mem_ctrl_power(double reads, double writes, double dram_precharge); void set_exec_unit_power(double fpu_accesses, double ialu_accesses, double sfu_accesses); void set_active_lanes_power(double sp_avg_active_lane, double sfu_avg_active_lane); - void set_NoC_power(double noc_tot_reads,double noc_tot_write); + void set_NoC_power(double noc_tot_reads, double noc_tot_write); bool sanity_check(double a, double b); private: -- cgit v1.3