From a05d1c1a5abb37f129c95c92991f69f3a43158ed Mon Sep 17 00:00:00 2001 From: Ayub Gubran Date: Mon, 16 Jul 2012 23:49:05 -0800 Subject: Fix for bug 9: Now querying the state of the pdom stack in call_imp and callp_imp using a core_t function, thus moving the querying function into the abstract model of the core instead of shader_core_ctx which represents the performance mode. This code simplify the querying and also avoid the unnecessary calling hierarchy that was used. [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 13375] --- src/abstract_hardware_model.cc | 5 +++++ src/abstract_hardware_model.h | 1 + src/cuda-sim/cuda-sim.cc | 2 +- src/cuda-sim/instructions.cc | 8 ++------ src/gpgpu-sim/gpu-sim.h | 2 -- src/gpgpu-sim/shader.cc | 18 ------------------ src/gpgpu-sim/shader.h | 2 -- 7 files changed, 9 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/abstract_hardware_model.cc b/src/abstract_hardware_model.cc index 01899d5..396e45a 100644 --- a/src/abstract_hardware_model.cc +++ b/src/abstract_hardware_model.cc @@ -732,3 +732,8 @@ m_simt_stack = new simt_stack*[warps]; for (unsigned i = 0; i < warps; ++i) m_simt_stack[i] = new simt_stack(i,warpsSize); } + +void core_t::get_pdom_stack_top_info( unsigned warpId, unsigned *pc, unsigned *rpc ) const +{ + m_simt_stack[warpId]->get_pdom_stack_top_info(pc,rpc); +} diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h index a2d144f..1fc10b9 100644 --- a/src/abstract_hardware_model.h +++ b/src/abstract_hardware_model.h @@ -854,6 +854,7 @@ class core_t { void updateSIMTStack(unsigned warpId, unsigned warpSize, warp_inst_t * inst); void initilizeSIMTStack(unsigned warps, unsigned warpsSize); warp_inst_t getExecuteWarp(unsigned warpId); + void get_pdom_stack_top_info( unsigned warpId, unsigned *pc, unsigned *rpc ) const; protected: class gpgpu_sim *m_gpu; diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc index 752985c..e08e521 100644 --- a/src/cuda-sim/cuda-sim.cc +++ b/src/cuda-sim/cuda-sim.cc @@ -1609,7 +1609,7 @@ void functionalCoreSim::initializeCTA() //get threads for a cta for(unsigned i=0; ithreads_per_cta();i++) { - ptx_sim_init_thread(*m_kernel,&m_thread[i],0,i,m_kernel->threads_per_cta()-i,m_kernel->threads_per_cta(),NULL,0,i/m_maxWarpSize,(gpgpu_t*)m_gpu, true); + ptx_sim_init_thread(*m_kernel,&m_thread[i],0,i,m_kernel->threads_per_cta()-i,m_kernel->threads_per_cta(),this,0,i/m_maxWarpSize,(gpgpu_t*)m_gpu, true); assert(m_thread[i]!=NULL && !m_thread[i]->is_done()); ctaLiveThreads++; } diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc index 37e5d00..6976ba0 100644 --- a/src/cuda-sim/instructions.cc +++ b/src/cuda-sim/instructions.cc @@ -1258,12 +1258,10 @@ void call_impl( const ptx_instruction *pI, ptx_thread_info *thread ) return_var_src = target_func->get_return_var(); } - unsigned sid = thread->get_hw_sid(); - unsigned tid = thread->get_hw_tid(); gpgpu_sim *gpu = thread->get_gpu(); unsigned callee_pc=0, callee_rpc=0; if( gpu->simd_model() == POST_DOMINATOR ) { - gpu->get_pdom_stack_top_info(sid,tid,&callee_pc,&callee_rpc); + thread->get_core()->get_pdom_stack_top_info(thread->get_hw_wid(),&callee_pc,&callee_rpc); assert( callee_pc == thread->get_pc() ); } @@ -1286,12 +1284,10 @@ void callp_impl( const ptx_instruction *pI, ptx_thread_info *thread ) const symbol *return_var_src = NULL; const symbol *return_var_dst = NULL; - unsigned sid = thread->get_hw_sid(); - unsigned tid = thread->get_hw_tid(); gpgpu_sim *gpu = thread->get_gpu(); unsigned callee_pc=0, callee_rpc=0; if( gpu->simd_model() == POST_DOMINATOR ) { - gpu->get_pdom_stack_top_info(sid,tid,&callee_pc,&callee_rpc); + thread->get_core()->get_pdom_stack_top_info(thread->get_hw_wid(),&callee_pc,&callee_rpc); assert( callee_pc == thread->get_pc() ); } diff --git a/src/gpgpu-sim/gpu-sim.h b/src/gpgpu-sim/gpu-sim.h index 2c0fed8..ac2be00 100644 --- a/src/gpgpu-sim/gpu-sim.h +++ b/src/gpgpu-sim/gpu-sim.h @@ -245,8 +245,6 @@ public: void update_stats(); void deadlock_check(); - void get_pdom_stack_top_info( unsigned sid, unsigned tid, unsigned *pc, unsigned *rpc ); - int shared_mem_size() const; int num_registers_per_core() const; int wrp_size() const; diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc index 8ed907d..ddb544a 100644 --- a/src/gpgpu-sim/shader.cc +++ b/src/gpgpu-sim/shader.cc @@ -289,18 +289,6 @@ address_type shader_core_ctx::next_pc( int tid ) const return the_thread->get_pc(); // PC should already be updatd to next PC at this point (was set in shader_decode() last time thread ran) } -void gpgpu_sim::get_pdom_stack_top_info( unsigned sid, unsigned tid, unsigned *pc, unsigned *rpc ) -{ - unsigned cluster_id = m_shader_config->sid_to_cluster(sid); - m_cluster[cluster_id]->get_pdom_stack_top_info(sid,tid,pc,rpc); -} - -void shader_core_ctx::get_pdom_stack_top_info( unsigned tid, unsigned *pc, unsigned *rpc ) const -{ - unsigned warp_id = tid/m_config->warp_size; - m_simt_stack[warp_id]->get_pdom_stack_top_info(pc,rpc); -} - void shader_core_stats::print( FILE* fout ) const { unsigned icount_uarch=0; @@ -2449,12 +2437,6 @@ void simt_core_cluster::icnt_cycle() } } -void simt_core_cluster::get_pdom_stack_top_info( unsigned sid, unsigned tid, unsigned *pc, unsigned *rpc ) const -{ - unsigned cid = m_config->sid_to_cid(sid); - m_core[cid]->get_pdom_stack_top_info(tid,pc,rpc); -} - void simt_core_cluster::display_pipeline( unsigned sid, FILE *fout, int print_mem, int mask ) { m_core[m_config->sid_to_cid(sid)]->display_pipeline(fout,print_mem,mask); diff --git a/src/gpgpu-sim/shader.h b/src/gpgpu-sim/shader.h index 5612150..558335e 100644 --- a/src/gpgpu-sim/shader.h +++ b/src/gpgpu-sim/shader.h @@ -1227,7 +1227,6 @@ public: // accessors virtual bool warp_waiting_at_barrier( unsigned warp_id ) const; - void get_pdom_stack_top_info( unsigned tid, unsigned *pc, unsigned *rpc ) const; // used by pipeline timing model components: // modifiers @@ -1360,7 +1359,6 @@ public: m_response_fifo.push_back(mf); } - void get_pdom_stack_top_info( unsigned sid, unsigned tid, unsigned *pc, unsigned *rpc ) const; unsigned max_cta( const kernel_info_t &kernel ); unsigned get_not_completed() const; void print_not_completed( FILE *fp ) const; -- cgit v1.3