diff options
Diffstat (limited to 'src/gpgpu-sim')
| -rw-r--r-- | src/gpgpu-sim/shader.cc | 13 | ||||
| -rw-r--r-- | src/gpgpu-sim/shader.h | 34 |
2 files changed, 40 insertions, 7 deletions
diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc index 5779537..7bf711f 100644 --- a/src/gpgpu-sim/shader.cc +++ b/src/gpgpu-sim/shader.cc @@ -100,7 +100,12 @@ shader_core_ctx::shader_core_ctx( class gpgpu_sim *gpu, m_threadState[i].m_active = false; } - m_icnt = new shader_memory_interface(this,cluster); + // m_icnt = new shader_memory_interface(this,cluster); + if ( m_config->gpgpu_perfect_mem ) { + m_icnt = new perfect_memory_interface(this,cluster); + } else { + m_icnt = new shader_memory_interface(this,cluster); + } m_mem_fetch_allocator = new shader_core_mem_fetch_allocator(shader_id,tpc_id,mem_config); // fetch @@ -924,7 +929,7 @@ pipelined_simd_unit::pipelined_simd_unit( warp_inst_t **result_port, const shade m_pipeline_reg[i] = new warp_inst_t( config ); } -ldst_unit::ldst_unit( shader_memory_interface *icnt, +ldst_unit::ldst_unit( mem_fetch_interface *icnt, shader_core_mem_fetch_allocator *mf_allocator, shader_core_ctx *core, opndcoll_rfu_t *operand_collector, @@ -1070,7 +1075,7 @@ void ldst_unit::cycle() m_L1C->fill(mf,gpu_sim_cycle+gpu_tot_sim_cycle); m_response_fifo.pop_front(); } else { - if( mf->get_type() == WRITE_ACK ) { + if( mf->get_type() == WRITE_ACK || ( m_config->gpgpu_perfect_mem && mf->get_is_write() )) { m_core->store_ack(mf); m_response_fifo.pop_front(); delete mf; @@ -1768,7 +1773,7 @@ void shader_core_ctx::accept_ldst_unit_response(mem_fetch * mf) void shader_core_ctx::store_ack( class mem_fetch *mf ) { - assert( mf->get_type() == WRITE_ACK ); + assert( mf->get_type() == WRITE_ACK || ( m_config->gpgpu_perfect_mem && mf->get_is_write() ) ); unsigned warp_id = mf->get_wid(); m_warp[warp_id].dec_store_req(); } diff --git a/src/gpgpu-sim/shader.h b/src/gpgpu-sim/shader.h index b0a9c3a..1d481dd 100644 --- a/src/gpgpu-sim/shader.h +++ b/src/gpgpu-sim/shader.h @@ -823,7 +823,7 @@ class cache_t; class ldst_unit: public pipelined_simd_unit { public: - ldst_unit( shader_memory_interface *icnt, + ldst_unit( mem_fetch_interface *icnt, shader_core_mem_fetch_allocator *mf_allocator, shader_core_ctx *core, opndcoll_rfu_t *operand_collector, @@ -868,7 +868,7 @@ private: mem_stage_stall_type process_memory_access_queue( cache_t *cache, warp_inst_t &inst ); const memory_config *m_memory_config; - shader_memory_interface *m_icnt; + class mem_fetch_interface *m_icnt; shader_core_mem_fetch_allocator *m_mf_allocator; class shader_core_ctx *m_core; unsigned m_sid; @@ -1213,7 +1213,7 @@ private: thread_ctx_t *m_threadState; // interconnect interface - shader_memory_interface *m_icnt; + mem_fetch_interface *m_icnt; shader_core_mem_fetch_allocator *m_mem_fetch_allocator; // fetch @@ -1263,6 +1263,14 @@ public: bool icnt_injection_buffer_full(unsigned size, bool write); void icnt_inject_request_packet(class mem_fetch *mf); + // for perfect memory interface + bool response_queue_full() { + return ( m_response_fifo.size() >= m_config->n_simt_ejection_buffer_size ); + } + void push_response_fifo(class mem_fetch *mf) { + m_response_fifo.push_back(mf); + } + void get_pdom_stack_top_info( unsigned sid, unsigned tid, unsigned *pc, unsigned *rpc ) const; unsigned max_cta( const kernel_info_t &kernel ); unsigned get_not_completed() const; @@ -1302,4 +1310,24 @@ private: simt_core_cluster *m_cluster; }; +class perfect_memory_interface : public mem_fetch_interface { +public: + perfect_memory_interface( shader_core_ctx *core, simt_core_cluster *cluster ) { m_core=core; m_cluster=cluster; } + virtual bool full( unsigned size, bool write) const + { + return m_cluster->response_queue_full(); + } + virtual void push(mem_fetch *mf) + { + if( !mf->get_inst().empty() ) + m_core->mem_instruction_stats(mf->get_inst()); // not I$-fetch + if ( mf && mf->isatomic() ) + mf->do_atomic(); // execute atomic inside the "memory subsystem" + m_cluster->push_response_fifo(mf); + } +private: + shader_core_ctx *m_core; + simt_core_cluster *m_cluster; +}; + #endif /* SHADER_H */ |
