diff options
| author | Inderpreet Singh <[email protected]> | 2012-10-15 13:36:31 -0800 |
|---|---|---|
| committer | Andrew Boktor <[email protected]> | 2014-08-14 13:49:21 -0700 |
| commit | cca02c10622f5a3f29d864abad23e8138909dc18 (patch) | |
| tree | e80c732758ecf1de4d75baa0a52df7713d97c858 | |
| parent | 013bb97792050d17a4e6dac95a18d16eed858a2e (diff) | |
Added functional execution support for shared memory atomic operations.
Integrated in CL14335 and CL14336
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 14366]
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | src/cuda-sim/instructions.cc | 50 | ||||
| -rw-r--r-- | src/gpgpu-sim/shader.cc | 4 |
3 files changed, 41 insertions, 14 deletions
@@ -20,6 +20,7 @@ Version 3.1.1+edits (development branch) versus 3.1.1 - Modified the cache hierarchy (cache_t -> baseline_cache -> [read_only_cache, data_cache, ...]) - Enabled configurable cache policies (write-back, write-through) and implemented a write-allocate policy +- Added functional execution support for shared memory atomic operations - Bug Fixes: - Fixed a compile error that happens with newer gcc/g++ versions (4.7.1) - Fixed a bug with the association between cuobjdump output and cubin diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc index fe2d0ef..e7bb50a 100644 --- a/src/cuda-sim/instructions.cc +++ b/src/cuda-sim/instructions.cc @@ -899,18 +899,33 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread ) // Check state space addr_t effective_address = src1_data.u64; - memory_space_t space = pI->get_space(); + memory_space_t space = pI->get_space(); if (space == undefined_space) { - // generic space - determine space via address - space = whichspace(effective_address); - assert( space == global_space ); - effective_address = generic_to_global(effective_address); + // generic space - determine space via address + if( whichspace(effective_address) == global_space ) { + effective_address = generic_to_global(effective_address); + space = global_space; + } else if( whichspace(effective_address) == shared_space ) { + unsigned smid = thread->get_hw_sid(); + effective_address = generic_to_shared(smid,effective_address); + space = shared_space; + } else { + abort(); + } } - assert( space == global_space ); + assert( space == global_space || space == shared_space ); + + memory_space *mem = NULL; + if(space == global_space) + mem = thread->get_global_memory(); + else if(space == shared_space) + mem = thread->m_shared_mem; + else + abort(); // Copy value pointed to in operand 'a' into register 'd' // (i.e. copy src1_data to dst) - thread->get_global_memory()->read(effective_address,size/8,&data.s64); + mem->read(effective_address,size/8,&data.s64); if (dst.get_symbol()->type()){ thread->set_operand_value(dst, data, to_type, thread, pI); // Write value into register 'd' } @@ -1151,9 +1166,9 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread ) } } - // Write operation result into global memory + // Write operation result into memory // (i.e. copy src1_data to dst) - thread->get_global_memory()->write(effective_address,size/8,&op_result.s64,thread,pI); + mem->write(effective_address,size/8,&op_result.s64,thread,pI); } // atom_impl will now result in a callback being called in mem_ctrl_pop (gpu-sim.c) @@ -1177,16 +1192,23 @@ void atom_impl( const ptx_instruction *pI, ptx_thread_info *thread ) // handle generic memory space by converting it to global if ( space == undefined_space ) { - assert( whichspace(effective_address) == global_space ); - effective_address_final = generic_to_global(effective_address); - space = global_space; + if( whichspace(effective_address) == global_space ) { + effective_address_final = generic_to_global(effective_address); + space = global_space; + } else if( whichspace(effective_address) == shared_space ) { + unsigned smid = thread->get_hw_sid(); + effective_address_final = generic_to_shared(smid,effective_address); + space = shared_space; + } else { + abort(); + } } else { - assert( space == global_space ); + assert( space == global_space || space == shared_space ); effective_address_final = effective_address; } // Check state space - assert( space == global_space ); + assert( space == global_space || space == shared_space ); thread->m_last_effective_address = effective_address_final; thread->m_last_memory_space = space; diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc index 0dd8fd0..fb8165f 100644 --- a/src/gpgpu-sim/shader.cc +++ b/src/gpgpu-sim/shader.cc @@ -1169,6 +1169,10 @@ void ldst_unit::writeback() case 0: // shared memory if( !m_pipeline_reg[0]->empty() ) { m_next_wb = *m_pipeline_reg[0]; + if(m_next_wb.isatomic()) { + m_next_wb.do_atomic(); + m_core->decrement_atomic_count(m_next_wb.warp_id(), m_next_wb.active_count()); + } m_core->dec_inst_in_pipeline(m_pipeline_reg[0]->warp_id()); m_pipeline_reg[0]->clear(); serviced_client = next_client; |
