From aa3cb10c91b1d0e5571172fdefa00aa575f26ebe Mon Sep 17 00:00:00 2001 From: Tim Rogers Date: Tue, 25 Jun 2013 13:30:10 -0800 Subject: Adding the ability to querry the WARPSZ flag from the ptx script. Also changed some initialization code when cores are created in both the funcational and perfromance simulator review:3001 lgtm:5 [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 16506] --- src/abstract_hardware_model.cc | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'src/abstract_hardware_model.cc') diff --git a/src/abstract_hardware_model.cc b/src/abstract_hardware_model.cc index fd227e1..5ba0270 100644 --- a/src/abstract_hardware_model.cc +++ b/src/abstract_hardware_model.cc @@ -746,13 +746,13 @@ void simt_stack::update( simt_mask_t &thread_done, addr_vector_t &next_pc, addre } } -void core_t::execute_warp_inst_t(warp_inst_t &inst, unsigned warpSize, unsigned warpId) +void core_t::execute_warp_inst_t(warp_inst_t &inst, unsigned warpId) { - for ( unsigned t=0; t < warpSize; t++ ) { + for ( unsigned t=0; t < m_warp_size; t++ ) { if( inst.active(t) ) { if(warpId==(unsigned (-1))) warpId = inst.warp_id(); - unsigned tid=warpSize*warpId+t; + unsigned tid=m_warp_size*warpId+t; m_thread[tid]->ptx_exec_inst(inst,t); //virtual function @@ -766,12 +766,12 @@ bool core_t::ptx_thread_done( unsigned hw_thread_id ) const return ((m_thread[ hw_thread_id ]==NULL) || m_thread[ hw_thread_id ]->is_done()); } -void core_t::updateSIMTStack(unsigned warpId, unsigned warpSize, warp_inst_t * inst) +void core_t::updateSIMTStack(unsigned warpId, warp_inst_t * inst) { simt_mask_t thread_done; addr_vector_t next_pc; - unsigned wtid = warpId * warpSize; - for (unsigned i = 0; i < warpSize; i++) { + unsigned wtid = warpId * m_warp_size; + for (unsigned i = 0; i < m_warp_size; i++) { if( ptx_thread_done(wtid+i) ) { thread_done.set(i); next_pc.push_back( (address_type)-1 ); @@ -794,11 +794,23 @@ warp_inst_t core_t::getExecuteWarp(unsigned warpId) return wi; } -void core_t::initilizeSIMTStack(unsigned warps, unsigned warpsSize) +void core_t::deleteSIMTStack() +{ + if ( m_simt_stack ) { + for (unsigned i = 0; i < m_warp_count; ++i) + delete m_simt_stack[i]; + delete[] m_simt_stack; + m_simt_stack = NULL; + } +} + +void core_t::initilizeSIMTStack(unsigned warp_count, unsigned warp_size) { - m_simt_stack = new simt_stack*[warps]; - for (unsigned i = 0; i < warps; ++i) - m_simt_stack[i] = new simt_stack(i,warpsSize); + m_simt_stack = new simt_stack*[warp_count]; + for (unsigned i = 0; i < warp_count; ++i) + m_simt_stack[i] = new simt_stack(i,warp_size); + m_warp_size = warp_size; + m_warp_count = warp_count; } void core_t::get_pdom_stack_top_info( unsigned warpId, unsigned *pc, unsigned *rpc ) const -- cgit v1.3