From 95215f59825ff9def72c3bb237c58bb02c8c2411 Mon Sep 17 00:00:00 2001 From: Wilson Fung Date: Mon, 13 Feb 2012 10:36:29 -0800 Subject: Fixed the stat collection for gpgpu_n_shmem_insn. See Bug 128 for more detail. For verification, I added a directed test with a pre-calculated number of shared memory instructions. [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 11454] --- src/gpgpu-sim/gpu-sim.cc | 13 +++++++------ src/gpgpu-sim/shader.cc | 7 +++++++ src/gpgpu-sim/shader.h | 3 +-- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index 6b448ab..3200c9c 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -639,30 +639,31 @@ unsigned gpgpu_sim::threads_per_core() const void shader_core_ctx::mem_instruction_stats(const warp_inst_t &inst) { + unsigned active_count = inst.active_count(); //this breaks some encapsulation: the is_[space] functions, if you change those, change this. switch (inst.space.get_type()) { case undefined_space: case reg_space: break; case shared_space: - m_stats->gpgpu_n_shmem_insn++; + m_stats->gpgpu_n_shmem_insn += active_count; break; case const_space: - m_stats->gpgpu_n_const_insn++; + m_stats->gpgpu_n_const_insn += active_count; break; case param_space_kernel: case param_space_local: - m_stats->gpgpu_n_param_insn++; + m_stats->gpgpu_n_param_insn += active_count; break; case tex_space: - m_stats->gpgpu_n_tex_insn++; + m_stats->gpgpu_n_tex_insn += active_count; break; case global_space: case local_space: if( inst.is_store() ) - m_stats->gpgpu_n_store_insn++; + m_stats->gpgpu_n_store_insn += active_count; else - m_stats->gpgpu_n_load_insn++; + m_stats->gpgpu_n_load_insn += active_count; break; default: abort(); diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc index 42f43fe..82e4540 100644 --- a/src/gpgpu-sim/shader.cc +++ b/src/gpgpu-sim/shader.cc @@ -1026,6 +1026,13 @@ unsigned ldst_unit::clock_multiplier() const return m_config->mem_warp_parts; } +void ldst_unit::issue( warp_inst_t *&inst ) +{ + // stat collection + m_core->mem_instruction_stats(*inst); + pipelined_simd_unit::issue(inst); +} + void ldst_unit::cycle() { writeback(); diff --git a/src/gpgpu-sim/shader.h b/src/gpgpu-sim/shader.h index 43121a1..d367b7f 100644 --- a/src/gpgpu-sim/shader.h +++ b/src/gpgpu-sim/shader.h @@ -834,6 +834,7 @@ public: unsigned sid, unsigned tpc ); // modifiers + virtual void issue( warp_inst_t *&inst ); virtual void cycle(); void fill( mem_fetch *mf ); @@ -1283,8 +1284,6 @@ public: } virtual void push(mem_fetch *mf) { - if( !mf->get_inst().empty() ) - m_core->mem_instruction_stats(mf->get_inst()); // not I$-fetch m_cluster->icnt_inject_request_packet(mf); } private: -- cgit v1.3