From 960a55b075be901ca14d1878f886bbea73456663 Mon Sep 17 00:00:00 2001 From: Wilson Fung Date: Wed, 12 Sep 2012 20:15:37 -0800 Subject: Minor refactoring for the SIMT Stack implementation and fixing some indentation [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 14067] --- src/abstract_hardware_model.cc | 53 ++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'src/abstract_hardware_model.cc') diff --git a/src/abstract_hardware_model.cc b/src/abstract_hardware_model.cc index 7a9fcf8..a2539af 100644 --- a/src/abstract_hardware_model.cc +++ b/src/abstract_hardware_model.cc @@ -716,16 +716,17 @@ 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 warpSize, unsigned warpId) +{ for ( unsigned t=0; t < warpSize; t++ ) { if( inst.active(t) ) { - if(warpId==(unsigned (-1))) - warpId = inst.warp_id(); - unsigned tid=warpSize*warpId+t; - m_thread[tid]->ptx_exec_inst(inst,t); - - //virtual function - checkExecutionStatusAndUpdate(inst,t,tid); + if(warpId==(unsigned (-1))) + warpId = inst.warp_id(); + unsigned tid=warpSize*warpId+t; + m_thread[tid]->ptx_exec_inst(inst,t); + + //virtual function + checkExecutionStatusAndUpdate(inst,t,tid); } } } @@ -735,25 +736,27 @@ 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){ -simt_mask_t thread_done; -addr_vector_t next_pc; -unsigned wtid = warpId * warpSize; -for (unsigned i = 0; i < warpSize; i++) { - if( ptx_thread_done(wtid+i) ) { - thread_done.set(i); - next_pc.push_back( (address_type)-1 ); - } else { - if( inst->reconvergence_pc == RECONVERGE_RETURN_PC ) - inst->reconvergence_pc = get_return_pc(m_thread[wtid+i]); - next_pc.push_back( m_thread[wtid+i]->get_pc() ); - } -} -m_simt_stack[warpId]->update(thread_done,next_pc,inst->reconvergence_pc, inst->op); +void core_t::updateSIMTStack(unsigned warpId, unsigned warpSize, 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++) { + if( ptx_thread_done(wtid+i) ) { + thread_done.set(i); + next_pc.push_back( (address_type)-1 ); + } else { + if( inst->reconvergence_pc == RECONVERGE_RETURN_PC ) + inst->reconvergence_pc = get_return_pc(m_thread[wtid+i]); + next_pc.push_back( m_thread[wtid+i]->get_pc() ); + } + } + m_simt_stack[warpId]->update(thread_done,next_pc,inst->reconvergence_pc, inst->op); } //! Get the warp to be executed using the data taken form the SIMT stack -warp_inst_t core_t::getExecuteWarp(unsigned warpId){ +warp_inst_t core_t::getExecuteWarp(unsigned warpId) +{ unsigned pc,rpc; m_simt_stack[warpId]->get_pdom_stack_top_info(&pc,&rpc); warp_inst_t wi= *ptx_fetch_inst(pc); @@ -763,7 +766,7 @@ warp_inst_t core_t::getExecuteWarp(unsigned warpId){ void core_t::initilizeSIMTStack(unsigned warps, unsigned warpsSize) { -m_simt_stack = new simt_stack*[warps]; + m_simt_stack = new simt_stack*[warps]; for (unsigned i = 0; i < warps; ++i) m_simt_stack[i] = new simt_stack(i,warpsSize); } -- cgit v1.3