diff options
| author | Tor Aamodt <[email protected]> | 2010-10-05 13:34:47 -0800 |
|---|---|---|
| committer | Tor Aamodt <[email protected]> | 2010-10-05 13:34:47 -0800 |
| commit | e0f1b4359832ba2952ddcff3a400cd7e1e3d02b5 (patch) | |
| tree | 12f3dbd8366e15b4a9a299b0368df6fafea11847 /src/cuda-sim | |
| parent | d859e08188eb5863888a9b018cf4aec6d0419c40 (diff) | |
broken change list: builds, but does not run, yet
refactoring: create warp_inst_t that provides notion of a group of scalar instructions
traveling down the pipeline.
delete DWF
delete MIMD
delete warp_tracker
delete old writeback stage, replace it with a stub that just writes back everything
delete old pipeline model
current status: MSHR's need to change to deal with the new structure
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 7814]
Diffstat (limited to 'src/cuda-sim')
| -rw-r--r-- | src/cuda-sim/cuda-sim.cc | 102 | ||||
| -rw-r--r-- | src/cuda-sim/cuda-sim.h | 11 | ||||
| -rw-r--r-- | src/cuda-sim/instructions.cc | 11 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_ir.cc | 2 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_ir.h | 2 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_sim.h | 2 |
6 files changed, 14 insertions, 116 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc index c28f1a0..dcf1fd4 100644 --- a/src/cuda-sim/cuda-sim.cc +++ b/src/cuda-sim/cuda-sim.cc @@ -463,71 +463,6 @@ void gpgpu_ptx_sim_memset( size_t dst_start_addr, int c, size_t count ) fflush(stdout); } -const char * ptx_get_fname( unsigned PC ) -{ - static const char *null_ptr = "<null finfo ptr>"; - std::map<unsigned,function_info*>::iterator f=g_pc_to_finfo.find(PC); - if( f== g_pc_to_finfo.end() ) - return null_ptr; - return f->second->get_name().c_str(); -} - -unsigned ptx_thread_donecycle( void *thr ) -{ - ptx_thread_info *the_thread = (ptx_thread_info *) thr; - if( the_thread == NULL ) - return 0; - return the_thread->donecycle(); -} - -void* ptx_thread_get_next_finfo( void *thd ) -{ - ptx_thread_info *the_thread = (ptx_thread_info *) thd; - if ( the_thread == NULL ) - return NULL; - return the_thread->get_finfo(); // finfo should already be updatd to next PC at this point (was set in shader_decode() last time thread ran) -} - -int ptx_thread_at_barrier( void *thd ) -{ - ptx_thread_info *the_thread = (ptx_thread_info *) thd; - if ( the_thread == NULL ) - return 0; - return the_thread->is_at_barrier(); -} - -int ptx_thread_all_at_barrier( void *thd ) -{ - ptx_thread_info *the_thread = (ptx_thread_info *) thd; - if ( the_thread == NULL ) - return 0; - return the_thread->all_at_barrier()?1:0; -} - -unsigned long long ptx_thread_get_cta_uid( void *thd ) -{ - ptx_thread_info *the_thread = (ptx_thread_info *) thd; - if ( the_thread == NULL ) - return 0; - return the_thread->get_cta_uid(); -} - -void ptx_thread_reset_barrier( void *thd ) -{ - ptx_thread_info *the_thread = (ptx_thread_info *) thd; - if ( the_thread == NULL ) - return; - the_thread->clear_barrier(); -} - -void ptx_thread_release_barrier( void *thd ) -{ - ptx_thread_info *the_thread = (ptx_thread_info *) thd; - if ( the_thread == NULL ) - return; - the_thread->release_barrier(); -} - void ptx_print_insn( address_type pc, FILE *fp ) { std::map<unsigned,function_info*>::iterator f = g_pc_to_finfo.find(pc); @@ -919,9 +854,7 @@ void init_inst_classification_stat() g_inst_op_classification_stat[g_ptx_kernel_count] = StatCreate(kernelname,1,100); } -unsigned g_warp_active_mask; - -void ptx_thread_info::ptx_exec_inst( inst_t &inst ) +void ptx_thread_info::ptx_exec_inst( warp_inst_t &inst, unsigned lane_id ) { inst.memory_op = no_memory_op; bool skip = false; @@ -956,7 +889,6 @@ void ptx_thread_info::ptx_exec_inst( inst_t &inst ) skip = !pred_lookup(pI->get_pred_mod(), pred_value.pred & 0x000F); } } - g_warp_active_mask = inst.warp_active_mask; if( !skip ) { switch ( pI->get_opcode() ) { #define OP_DEF(OP,FUNC,STR,DST,CLASSIFICATION) case OP: FUNC(pI,this); op_classification = CLASSIFICATION; break; @@ -1014,21 +946,13 @@ void ptx_thread_info::ptx_exec_inst( inst_t &inst ) if ( pI->get_opcode() == ATOM_OP ) { insn_memaddr = last_eaddr(); insn_space = last_space(); - inst.callback.function = last_callback().function; - inst.callback.instruction = last_callback().instruction; - inst.callback.thread = this; - + inst.add_callback( lane_id, last_callback().function, last_callback().instruction, this ); unsigned to_type = pI->get_type(); insn_data_size = datatype2size(to_type); - } else { - // make sure that the callback isn't set - inst.callback.function = NULL; - inst.callback.instruction = NULL; - inst.callback.thread = NULL; } if (pI->get_opcode() == TEX_OP) { - inst.memreqaddr = last_eaddr(); + inst.set_addr(lane_id, last_eaddr() ); inst.space = last_space(); unsigned to_type = pI->get_type(); @@ -1106,11 +1030,10 @@ void ptx_thread_info::ptx_exec_inst( inst_t &inst ) // "Return values" if(!skip) { inst.space = insn_space; - inst.memreqaddr = insn_memaddr; + inst.set_addr(lane_id, insn_memaddr); inst.data_size = insn_data_size; inst.memory_op = insn_memory_op; } else { - inst.memreqaddr = 0xFEEBDAED; inst.space = undefined_space; inst.memory_op = no_memory_op; } @@ -1137,7 +1060,7 @@ const struct gpgpu_ptx_sim_kernel_info* ptx_sim_kernel_info(function_info *kerne return kernel->get_kernel_info(); } -const inst_t *ptx_fetch_inst( address_type pc ) +const warp_inst_t *ptx_fetch_inst( address_type pc ) { return function_info::pc_to_instruction(pc); } @@ -1550,10 +1473,7 @@ void gpgpu_cuda_ptx_sim_main_func( kernel_info_t kernel, dim3 gridDim, dim3 bloc break; } - inst_t inst; - inst.warp_active_mask = (unsigned)-1; // vote instruction with diverged warps won't execute correctly - // in functional simulation mode - thread->ptx_exec_inst( inst ); + abort(); // need to exec. inst } } } @@ -1685,8 +1605,6 @@ void ptxinfo_opencl_addinfo( std::map<std::string,function_info*> &kernels ) clear_ptxinfo(); } -void dwf_insert_reconv_pt(address_type pc); - struct rec_pts { gpgpu_recon_t *s_kernel_recon_points; int s_num_recon; @@ -1744,11 +1662,3 @@ unsigned int get_converge_point( unsigned int pc, void *thd ) abort(); // returning garbage! } -void dwf_process_reconv_pts(function_info *entry) -{ - rec_pts tmp = find_reconvergence_points(entry); - for (int i = 0; i < tmp.s_num_recon; ++i) { - dwf_insert_reconv_pt(tmp.s_kernel_recon_points[i].target_pc); - } -} - diff --git a/src/cuda-sim/cuda-sim.h b/src/cuda-sim/cuda-sim.h index 4a0185a..322e8a2 100644 --- a/src/cuda-sim/cuda-sim.h +++ b/src/cuda-sim/cuda-sim.h @@ -56,19 +56,10 @@ unsigned ptx_sim_init_thread( kernel_info_t &kernel, class core_t *core, unsigned hw_cta_id, unsigned hw_warp_id ); -const inst_t *ptx_fetch_inst( address_type pc ); +const warp_inst_t *ptx_fetch_inst( address_type pc ); const struct gpgpu_ptx_sim_kernel_info* ptx_sim_kernel_info(class function_info *kernel); -unsigned ptx_thread_donecycle( void *thr ); -void* ptx_thread_get_next_finfo( void *thd ); -int ptx_thread_at_barrier( void *thd ); -int ptx_thread_all_at_barrier( void *thd ); -unsigned long long ptx_thread_get_cta_uid( void *thd ); -void ptx_thread_reset_barrier( void *thd ); -void ptx_thread_release_barrier( void *thd ); void ptx_print_insn( address_type pc, FILE *fp ); unsigned int ptx_set_tex_cache_linesize( unsigned linesize); - -void dwf_process_reconv_pts(function_info *entry); void set_param_gpgpu_num_shaders(int num_shaders); unsigned int get_converge_point(unsigned int pc, void *thd); const char *get_ptxinfo_kname(); diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc index 78996bb..23d6cc8 100644 --- a/src/cuda-sim/instructions.cc +++ b/src/cuda-sim/instructions.cc @@ -831,10 +831,9 @@ void andn_impl( const ptx_instruction *pI, ptx_thread_info *thread ) thread->set_operand_value(dst,data, i_type, thread, pI); } -void atom_callback( void* ptx_inst, void* thd ) +void atom_callback( const inst_t* inst, ptx_thread_info* thread ) { - ptx_thread_info *thread = (ptx_thread_info*)thd; - ptx_instruction *pI = (ptx_instruction*)ptx_inst; + const ptx_instruction *pI = dynamic_cast<const ptx_instruction*>(inst); // Check state space assert( pI->get_space()==global_space ); @@ -1112,7 +1111,7 @@ void atom_impl( const ptx_instruction *pI, ptx_thread_info *thread ) thread->m_last_effective_address = src1_data.u32; thread->m_last_memory_space = space; thread->m_last_dram_callback.function = atom_callback; - thread->m_last_dram_callback.instruction = (void*)pI; + thread->m_last_dram_callback.instruction = pI; } void bar_sync_impl( const ptx_instruction *pI, ptx_thread_info *thread ) @@ -3787,8 +3786,6 @@ void vshl_impl( const ptx_instruction *pI, ptx_thread_info *thread ) { inst_not_ void vshr_impl( const ptx_instruction *pI, ptx_thread_info *thread ) { inst_not_implemented(pI); } void vsub_impl( const ptx_instruction *pI, ptx_thread_info *thread ) { inst_not_implemented(pI); } -extern unsigned g_warp_active_mask; - void vote_impl( const ptx_instruction *pI, ptx_thread_info *thread ) { static bool first_in_warp = true; @@ -3804,7 +3801,7 @@ void vote_impl( const ptx_instruction *pI, ptx_thread_info *thread ) or_all = false; unsigned mask=0x80000000; unsigned offset=31; - while( mask && ((mask & g_warp_active_mask)==0) ) { + while( mask && !pI->active(mask) ) { mask = mask>>1; offset--; } diff --git a/src/cuda-sim/ptx_ir.cc b/src/cuda-sim/ptx_ir.cc index 2d63227..b7ec3ac 100644 --- a/src/cuda-sim/ptx_ir.cc +++ b/src/cuda-sim/ptx_ir.cc @@ -983,7 +983,7 @@ ptx_instruction::ptx_instruction( int opcode, const char *file, unsigned line, const char *source, - unsigned warp_size ) : inst_t() + unsigned warp_size ) : warp_inst_t(warp_size) { m_uid = ++g_num_ptx_inst_uid; m_PC = 0; diff --git a/src/cuda-sim/ptx_ir.h b/src/cuda-sim/ptx_ir.h index afb2476..6010caf 100644 --- a/src/cuda-sim/ptx_ir.h +++ b/src/cuda-sim/ptx_ir.h @@ -786,7 +786,7 @@ struct gpgpu_recon_t { address_type target_pc; }; -class ptx_instruction : public inst_t { +class ptx_instruction : public warp_inst_t { public: ptx_instruction( int opcode, const symbol *pred, diff --git a/src/cuda-sim/ptx_sim.h b/src/cuda-sim/ptx_sim.h index 3a6d9ad..80ccde3 100644 --- a/src/cuda-sim/ptx_sim.h +++ b/src/cuda-sim/ptx_sim.h @@ -277,7 +277,7 @@ public: ptx_thread_info(); void ptx_fetch_inst( inst_t &inst ) const; - void ptx_exec_inst( inst_t &inst ); + void ptx_exec_inst( warp_inst_t &inst, unsigned lane_id ); const ptx_version &get_ptx_version() const; void set_reg( const symbol *reg, const ptx_reg_t &value ); |
