summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortgrogers <[email protected]>2017-11-18 15:48:26 -0500
committertgrogers <[email protected]>2017-11-18 15:48:26 -0500
commit9233f6f9eeea537187deb64add77a320442aa621 (patch)
treec2351512f93d44354ea31509a2964d03fe530c71
parenta2b163e4476387df8693c1a784cf094f8868a086 (diff)
vectoradd is successfully filling the l2
-rw-r--r--src/cuda-sim/cuda-sim.cc4
-rw-r--r--src/gpgpu-sim/gpu-cache.cc23
-rw-r--r--src/gpgpu-sim/gpu-cache.h11
-rw-r--r--src/gpgpu-sim/gpu-sim.cc17
-rw-r--r--src/gpgpu-sim/gpu-sim.h2
-rw-r--r--src/gpgpu-sim/l2cache.cc9
-rw-r--r--src/gpgpu-sim/l2cache.h6
7 files changed, 66 insertions, 6 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index a668db1..685ae53 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -401,6 +401,10 @@ void gpgpu_t::memcpy_to_gpu( size_t dst_start_addr, const void *src, size_t coun
char *src_data = (char*)src;
for (unsigned n=0; n < count; n ++ )
m_global_mem->write(dst_start_addr+n,1, src_data+n,NULL,NULL);
+
+ // Copy into the performance model.
+ extern gpgpu_sim* g_the_gpu;
+ g_the_gpu->memcpy_to_gpu(dst_start_addr, src, count);
if(g_debug_execution >= 3) {
printf( " done.\n");
fflush(stdout);
diff --git a/src/gpgpu-sim/gpu-cache.cc b/src/gpgpu-sim/gpu-cache.cc
index 32c2bb1..37fc5ea 100644
--- a/src/gpgpu-sim/gpu-cache.cc
+++ b/src/gpgpu-sim/gpu-cache.cc
@@ -190,11 +190,17 @@ void tag_array::init( int core_id, int type_id )
m_type_id = type_id;
}
+
enum cache_request_status tag_array::probe( new_addr_type addr, unsigned &idx, mem_fetch* mf) const {
+ mem_access_sector_mask_t mask = mf->get_access_sector_mask();
+ return probe(addr, idx, mask);
+}
+
+
+enum cache_request_status tag_array::probe( new_addr_type addr, unsigned &idx, mem_access_sector_mask_t mask) const {
//assert( m_config.m_write_policy == READ_ONLY );
unsigned set_index = m_config.set_index(addr);
new_addr_type tag = m_config.tag(addr);
- mem_access_sector_mask_t mask = mf->get_access_sector_mask();
unsigned invalid_line = (unsigned)-1;
unsigned valid_line = (unsigned)-1;
@@ -310,18 +316,23 @@ enum cache_request_status tag_array::access( new_addr_type addr, unsigned time,
void tag_array::fill( new_addr_type addr, unsigned time, mem_fetch* mf)
{
- assert( m_config.m_alloc_policy == ON_FILL );
+ fill(addr, time, mf->get_access_sector_mask());
+}
+
+void tag_array::fill( new_addr_type addr, unsigned time, mem_access_sector_mask_t mask )
+{
+ //assert( m_config.m_alloc_policy == ON_FILL );
unsigned idx;
- enum cache_request_status status = probe(addr,idx,mf);
+ enum cache_request_status status = probe(addr,idx,mask);
assert(status==MISS||status==SECTOR_MISS); // MSHR should have prevented redundant memory request
if(status==MISS)
- m_lines[idx]->allocate( m_config.tag(addr), m_config.block_addr(addr), time, mf->get_access_sector_mask() );
+ m_lines[idx]->allocate( m_config.tag(addr), m_config.block_addr(addr), time, mask );
else if (status==SECTOR_MISS) {
assert(m_config.m_cache_type == SECTOR);
- ((sector_cache_block*)m_lines[idx])->allocate_sector( time, mf->get_access_sector_mask() );
+ ((sector_cache_block*)m_lines[idx])->allocate_sector( time, mask );
}
- m_lines[idx]->fill(time, mf->get_access_sector_mask());
+ m_lines[idx]->fill(time, mask);
}
void tag_array::fill( unsigned index, unsigned time, mem_fetch* mf)
diff --git a/src/gpgpu-sim/gpu-cache.h b/src/gpgpu-sim/gpu-cache.h
index 3e1691a..3713126 100644
--- a/src/gpgpu-sim/gpu-cache.h
+++ b/src/gpgpu-sim/gpu-cache.h
@@ -690,11 +690,13 @@ public:
~tag_array();
enum cache_request_status probe( new_addr_type addr, unsigned &idx, mem_fetch* mf ) const;
+ enum cache_request_status probe( new_addr_type addr, unsigned &idx, mem_access_sector_mask_t mask ) const;
enum cache_request_status access( new_addr_type addr, unsigned time, unsigned &idx, mem_fetch* mf );
enum cache_request_status access( new_addr_type addr, unsigned time, unsigned &idx, bool &wb, evicted_block_info &evicted, mem_fetch* mf );
void fill( new_addr_type addr, unsigned time, mem_fetch* mf );
void fill( unsigned idx, unsigned time, mem_fetch* mf );
+ void fill( new_addr_type addr, unsigned time, mem_access_sector_mask_t mask );
unsigned size() const { return m_config.get_num_lines();}
cache_block_t* get_block(unsigned idx) { return m_lines[idx];}
@@ -969,6 +971,15 @@ public:
bool data_port_free() const { return m_bandwidth_management.data_port_free(); }
bool fill_port_free() const { return m_bandwidth_management.fill_port_free(); }
+ // This is a gapping hole we are poking in the system to quickly handle
+ // filling the cache on cudamemcopies. We don't care about anything other than
+ // L2 state after the memcopy - so just force the tag array to act as though
+ // something is read or written without doing anything else.
+ void force_tag_access( new_addr_type addr, unsigned time, mem_access_sector_mask_t mask )
+ {
+ m_tag_array->fill( addr, time, mask );
+ }
+
protected:
// Constructor that can be used by derived classes with custom tag arrays
baseline_cache( const char *name,
diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc
index 11ac5df..263cbad 100644
--- a/src/gpgpu-sim/gpu-sim.cc
+++ b/src/gpgpu-sim/gpu-sim.cc
@@ -1595,6 +1595,23 @@ void shader_core_ctx::dump_warp_state( FILE *fout ) const
m_warp[w].print(fout);
}
+
+void gpgpu_sim::memcpy_to_gpu( size_t dst_start_addr, const void *src, size_t count )
+{
+ assert (dst_start_addr % 32 == 0);
+ // Right now - I am just going to assume you write the whole last cache line...
+// assert (count % 128 == 0);
+ for ( unsigned counter = 0; counter < count; counter += 32 ) {
+ const size_t wr_addr = dst_start_addr + counter;
+ addrdec_t raw_addr;
+ mem_access_sector_mask_t mask;
+ mask.set(wr_addr % 128 / 32);
+ m_memory_config->m_address_mapping.addrdec_tlx( wr_addr, &raw_addr );
+ const unsigned partition_id = raw_addr.sub_partition / m_memory_config->m_n_sub_partition_per_memory_channel;
+ m_memory_partition_unit[ partition_id ]->handle_memcpy_to_gpu( wr_addr, raw_addr.sub_partition, mask );
+ }
+}
+
void gpgpu_sim::dump_pipeline( int mask, int s, int m ) const
{
/*
diff --git a/src/gpgpu-sim/gpu-sim.h b/src/gpgpu-sim/gpu-sim.h
index c04648c..6382adf 100644
--- a/src/gpgpu-sim/gpu-sim.h
+++ b/src/gpgpu-sim/gpu-sim.h
@@ -425,6 +425,8 @@ public:
void gpu_print_stat();
void dump_pipeline( int mask, int s, int m ) const;
+ void memcpy_to_gpu( size_t dst_start_addr, const void *src, size_t count );
+
//The next three functions added to be used by the functional simulation function
//! Get shader core configuration
diff --git a/src/gpgpu-sim/l2cache.cc b/src/gpgpu-sim/l2cache.cc
index 8fbf448..1df7858 100644
--- a/src/gpgpu-sim/l2cache.cc
+++ b/src/gpgpu-sim/l2cache.cc
@@ -74,6 +74,15 @@ memory_partition_unit::memory_partition_unit( unsigned partition_id,
}
}
+void memory_partition_unit::handle_memcpy_to_gpu( size_t addr, unsigned global_subpart_id, mem_access_sector_mask_t mask )
+{
+ unsigned p = global_sub_partition_id_to_local_id(global_subpart_id);
+ std::string mystring =
+ mask.to_string<char,std::string::traits_type,std::string::allocator_type>();
+ MEMPART_DPRINTF("Copy Engine Request Received For Address=%zu, local_subpart=%u, sector_mask=%s \n", addr, p, mystring.c_str());
+ m_sub_partition[p]->force_l2_tag_update(addr,gpu_sim_cycle+gpu_tot_sim_cycle, mask);
+}
+
memory_partition_unit::~memory_partition_unit()
{
delete m_dram;
diff --git a/src/gpgpu-sim/l2cache.h b/src/gpgpu-sim/l2cache.h
index 2cc0e76..b613a94 100644
--- a/src/gpgpu-sim/l2cache.h
+++ b/src/gpgpu-sim/l2cache.h
@@ -72,6 +72,7 @@ public:
void print_stat( FILE *fp ) { m_dram->print_stat(fp); }
void visualize() const { m_dram->visualize(); }
void print( FILE *fp ) const;
+ void handle_memcpy_to_gpu( size_t dst_start_addr, unsigned subpart_id, mem_access_sector_mask_t mask );
class memory_sub_partition * get_sub_partition(int sub_partition_id)
{
@@ -178,6 +179,11 @@ public:
void accumulate_L2cache_stats(class cache_stats &l2_stats) const;
void get_L2cache_sub_stats(struct cache_sub_stats &css) const;
+ void force_l2_tag_update(new_addr_type addr, unsigned time, mem_access_sector_mask_t mask)
+ {
+ m_L2cache->force_tag_access( addr, time, mask );
+ }
+
private:
// data
unsigned m_id; //< the global sub partition ID