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/cuda-sim/cuda-sim.cc | 37 ++++++++++++++++++------------------- src/cuda-sim/cuda-sim.h | 15 +++++++-------- src/cuda-sim/ptx_sim.cc | 2 +- 3 files changed, 26 insertions(+), 28 deletions(-) (limited to 'src/cuda-sim') diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc index a7294c1..ef50588 100644 --- a/src/cuda-sim/cuda-sim.cc +++ b/src/cuda-sim/cuda-sim.cc @@ -1702,7 +1702,11 @@ void gpgpu_cuda_ptx_sim_main_func( kernel_info_t &kernel, bool openCL ) //we excute the kernel one CTA (Block) at the time, as synchronization functions work block wise while(!kernel.no_more_ctas_to_run()){ - functionalCoreSim cta(&kernel, g_the_gpu, g_the_gpu->getShaderCoreConfig()->warp_size); + functionalCoreSim cta( + &kernel, + g_the_gpu, + g_the_gpu->getShaderCoreConfig()->warp_size + ); cta.execute(); } @@ -1744,27 +1748,22 @@ void gpgpu_cuda_ptx_sim_main_func( kernel_info_t &kernel, bool openCL ) void functionalCoreSim::initializeCTA() { int ctaLiveThreads=0; - m_warpsCount= ceil((double)m_kernel->threads_per_cta()/m_maxWarpSize); - initilizeSIMTStack(m_warpsCount,m_maxWarpSize); - m_warpAtBarrier = new bool [m_warpsCount]; - m_liveThreadCount = new unsigned [m_warpsCount]; - m_thread = new ptx_thread_info*[m_warpsCount*m_maxWarpSize]; - for(int i=0; i< m_warpsCount; i++){ + for(int i=0; i< m_warp_count; i++){ m_warpAtBarrier[i]=false; m_liveThreadCount[i]=0; } - for(int i=0; i< m_warpsCount*m_maxWarpSize;i++) + for(int i=0; i< m_warp_count*m_warp_size;i++) m_thread[i]=NULL; //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(),this,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_warp_size,(gpgpu_t*)m_gpu, true); assert(m_thread[i]!=NULL && !m_thread[i]->is_done()); ctaLiveThreads++; } - for(int k=0;klaunch(m_thread[warpId*m_maxWarpSize]->get_pc(),initialMask); + assert(m_thread[warpId*m_warp_size]!=NULL); + m_simt_stack[warpId]->launch(m_thread[warpId*m_warp_size]->get_pc(),initialMask); m_liveThreadCount[warpId]= liveThreadsCount; } @@ -1791,12 +1790,12 @@ void functionalCoreSim::execute() while(true){ bool someOneLive= false; bool allAtBarrier = true; - for(unsigned i=0;i0) someOneLive=true; if(!m_warpAtBarrier[i]&& m_liveThreadCount[i]>0) allAtBarrier = false; @@ -1989,7 +1988,7 @@ address_type get_converge_point( address_type pc ) void functionalCoreSim::warp_exit( unsigned warp_id ) { - for(int i=0;im_cta_info->register_deleted_thread(m_thread[i]); delete m_thread[i]; diff --git a/src/cuda-sim/cuda-sim.h b/src/cuda-sim/cuda-sim.h index 96953fb..4c26350 100644 --- a/src/cuda-sim/cuda-sim.h +++ b/src/cuda-sim/cuda-sim.h @@ -85,12 +85,13 @@ void set_param_gpgpu_num_shaders(int num_shaders); class functionalCoreSim: public core_t { public: - functionalCoreSim(kernel_info_t * kernel, gpgpu_sim *g, unsigned maxwarpSize){ - this->m_kernel=kernel; - m_gpu=g; - m_maxWarpSize = maxwarpSize; + functionalCoreSim(kernel_info_t * kernel, gpgpu_sim *g, unsigned warp_size) + : core_t( g, kernel, warp_size, kernel->threads_per_cta() ) + { + m_warpAtBarrier = new bool [m_warp_count]; + m_liveThreadCount = new unsigned [m_warp_count]; } - ~functionalCoreSim(){ + virtual ~functionalCoreSim(){ warp_exit(0); delete[] m_liveThreadCount; delete[] m_warpAtBarrier; @@ -110,15 +111,13 @@ private: virtual void checkExecutionStatusAndUpdate(warp_inst_t &inst, unsigned t, unsigned tid) { if(m_thread[tid]==NULL || m_thread[tid]->is_done()){ - m_liveThreadCount[tid/m_maxWarpSize]--; + m_liveThreadCount[tid/m_warp_size]--; } } // lunches the stack and set the threads count void createWarp(unsigned warpId); - unsigned m_maxWarpSize; - unsigned m_warpsCount; //each warp live thread count and barrier indicator unsigned * m_liveThreadCount; bool* m_warpAtBarrier; diff --git a/src/cuda-sim/ptx_sim.cc b/src/cuda-sim/ptx_sim.cc index e969e88..9b32e68 100644 --- a/src/cuda-sim/ptx_sim.cc +++ b/src/cuda-sim/ptx_sim.cc @@ -270,7 +270,7 @@ unsigned ptx_thread_info::get_builtin( int builtin_id, unsigned dim_mod ) if( dim_mod == 2 ) return m_tid.z; abort(); break; - case WARPSZ_REG: feature_not_implemented( "WARP_SZ" ); return 0; + case WARPSZ_REG: return m_core->get_warp_size() ; default: assert(0); } -- cgit v1.3