diff options
| author | Wilson Fung <[email protected]> | 2011-01-20 18:59:45 -0800 |
|---|---|---|
| committer | Wilson Fung <[email protected]> | 2011-01-20 18:59:45 -0800 |
| commit | 34149bec142ba633f1e1b26a528ef6d77a05a3f6 (patch) | |
| tree | 57d6126ef2f1b294dcba69e8607531748ed7a371 /src | |
| parent | f18e4327b836ac66843a1c21cb429cc71bea9714 (diff) | |
Integration change. Bug fixes from AMD-CMU trace gen branch.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 8389]
Diffstat (limited to 'src')
| -rw-r--r-- | src/cuda-sim/cuda-sim.cc | 41 | ||||
| -rw-r--r-- | src/gpgpu-sim/gpu-sim.cc | 1 | ||||
| -rw-r--r-- | src/gpgpu-sim/shader.cc | 6 | ||||
| -rw-r--r-- | src/gpgpu-sim/shader.h | 2 | ||||
| -rw-r--r-- | src/stream_manager.cc | 12 |
5 files changed, 32 insertions, 30 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc index e33181f..9555010 100644 --- a/src/cuda-sim/cuda-sim.cc +++ b/src/cuda-sim/cuda-sim.cc @@ -313,7 +313,7 @@ memory_space_t whichspace( addr_t addr ) { if( (addr >= GLOBAL_HEAP_START) || (addr < STATIC_ALLOC_LIMIT) ) { return global_space; - } else if( addr > SHARED_GENERIC_START ) { + } else if( addr >= SHARED_GENERIC_START ) { return shared_space; } else { return local_space; @@ -851,6 +851,19 @@ void init_inst_classification_stat() g_inst_op_classification_stat[g_ptx_kernel_count] = StatCreate(kernelname,1,100); } +static unsigned get_tex_datasize( const ptx_instruction *pI, ptx_thread_info *thread ) +{ + const operand_info &src1 = pI->src1(); //the name of the texture + std::string texname = src1.name(); + + gpgpu_t *gpu = thread->get_gpu(); + const struct textureReference* texref = gpu->get_texref(texname); + const struct textureInfo* texInfo = gpu->get_texinfo(texref); + + unsigned data_size = texInfo->texel_size; + return data_size; +} + void ptx_thread_info::ptx_exec_inst( warp_inst_t &inst, unsigned lane_id ) { bool skip = false; @@ -960,31 +973,7 @@ void ptx_thread_info::ptx_exec_inst( warp_inst_t &inst, unsigned lane_id ) if (pI->get_opcode() == TEX_OP) { inst.set_addr(lane_id, last_eaddr() ); assert( inst.space == last_space() ); - - unsigned to_type = pI->get_type(); - switch ( to_type ) { - case B8_TYPE: - case S8_TYPE: - case U8_TYPE: - inst.data_size = 1; break; - case B16_TYPE: - case S16_TYPE: - case U16_TYPE: - case F16_TYPE: - inst.data_size = 2; break; - case B32_TYPE: - case S32_TYPE: - case U32_TYPE: - case F32_TYPE: - inst.data_size = 4; break; - case B64_TYPE: - case S64_TYPE: - case U64_TYPE: - case F64_TYPE: - case FF64_TYPE: - inst.data_size = 8; break; - default: assert(0); break; - } + insn_data_size = get_tex_datasize(pI, this); // texture obtain its data granularity from the texture info } // Output register information to file and stdout diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index 05a9b55..1526ef3 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -711,6 +711,7 @@ void shader_core_ctx::issue_block2core( kernel_info_t &kernel ) m_thread[i].m_cta_id = free_cta_hw_id; unsigned warp_id = i/m_config->warp_size; nthreads_in_block += ptx_sim_init_thread(kernel,&m_thread[i].m_functional_model_thread_state,m_sid,i,cta_size-(i-start_thread),m_config->n_thread_per_shader,this,free_cta_hw_id,warp_id,m_cluster->get_gpu()); + m_thread[i].m_active = true; warps.set( warp_id ); } assert( nthreads_in_block > 0 && nthreads_in_block <= m_config->n_thread_per_shader); // should be at least one, but less than max diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc index 2380bcf..2233566 100644 --- a/src/gpgpu-sim/shader.cc +++ b/src/gpgpu-sim/shader.cc @@ -135,6 +135,7 @@ shader_core_ctx::shader_core_ctx( class gpgpu_sim *gpu, for (unsigned i = 0; i<config->n_thread_per_shader; i++) { m_thread[i].m_functional_model_thread_state = NULL; m_thread[i].m_cta_id = -1; + m_thread[i].m_active = false; } m_icnt = new shader_memory_interface(this,cluster); @@ -519,12 +520,13 @@ void shader_core_ctx::fetch() bool did_exit=false; for( unsigned t=0; t<m_config->warp_size;t++) { unsigned tid=warp_id*m_config->warp_size+t; - if( m_thread[tid].m_functional_model_thread_state ) { + if( m_thread[tid].m_active == true ) { + m_thread[tid].m_active = false; unsigned cta_id = m_warp[warp_id].get_cta_id(); register_cta_thread_exit(cta_id); m_not_completed -= 1; m_active_threads.reset(tid); - m_thread[tid].m_functional_model_thread_state=NULL; + assert( m_thread[tid].m_functional_model_thread_state != NULL ); did_exit=true; } } diff --git a/src/gpgpu-sim/shader.h b/src/gpgpu-sim/shader.h index 2b834a6..ee0269f 100644 --- a/src/gpgpu-sim/shader.h +++ b/src/gpgpu-sim/shader.h @@ -120,6 +120,8 @@ public: unsigned n_l1_mis_ac; unsigned n_l1_mrghit_ac; unsigned n_l1_access_ac; + + bool m_active; }; class shd_warp_t { diff --git a/src/stream_manager.cc b/src/stream_manager.cc index 54e2ee7..b9a83d8 100644 --- a/src/stream_manager.cc +++ b/src/stream_manager.cc @@ -370,8 +370,16 @@ void stream_manager::push( stream_operation op ) print_impl(stdout); pthread_mutex_unlock(&m_lock); if( m_cuda_launch_blocking || stream == NULL ) { - while( !empty() ) - ; + unsigned int wait_amount = 100; + unsigned int wait_cap = 100000; // 100ms + while( !empty() ) { + // sleep to prevent CPU hog by empty spin + // sleep time increased exponentially ensure fast response when needed + usleep(wait_amount); + wait_amount *= 2; + if (wait_amount > wait_cap) + wait_amount = wait_cap; + } } } |
