summaryrefslogtreecommitdiff
path: root/src/gpgpu-sim/gpu-cache.cc
diff options
context:
space:
mode:
authorAhmed El-Shafiey <[email protected]>2013-04-14 20:14:54 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:50:46 -0700
commite040bcb69a3dbcbc50cb747da845e281467075a4 (patch)
treef7172eb3b317e5f9ed3a0adbbc64b07de3781575 /src/gpgpu-sim/gpu-cache.cc
parent2a6fb492f767618a4abfe1ebaf439ad32a1607f4 (diff)
- Adding support for cudaFuncSetCacheConfig API, that allows changing the
L1 Cache and Shared Memory configurations across kernels. The support enable the user to specify two more configurations (Preferred L1) or (Preferred Shared Memory) besides the default config. If the cudaFuncSetCacheConfig API is used to set the cache configuration of a specific kernel to either of these configuration (cudaFuncCachePreferShared, cudaFuncCachePreferL1), the simulator will change the cache configuration at kernel launch accordingly, if there is no alternative configurations provided to the simulator it will use the default configurations with a warning message display [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 15816]
Diffstat (limited to 'src/gpgpu-sim/gpu-cache.cc')
-rw-r--r--src/gpgpu-sim/gpu-cache.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gpgpu-sim/gpu-cache.cc b/src/gpgpu-sim/gpu-cache.cc
index d5856aa..3d8d911 100644
--- a/src/gpgpu-sim/gpu-cache.cc
+++ b/src/gpgpu-sim/gpu-cache.cc
@@ -29,6 +29,9 @@
#include "stat-tool.h"
#include <assert.h>
+#define MAX_DEFAULT_CACHE_SIZE_MULTIBLIER 4
+// used to allocate memory that is large enough to adapt the changes in cache size across kernels
+
const char * cache_request_status_str(enum cache_request_status status)
{
static const char * static_cache_request_status_str[] = {
@@ -45,7 +48,7 @@ const char * cache_request_status_str(enum cache_request_status status)
}
void l2_cache_config::init(linear_to_raw_address_translation *address_mapping){
- cache_config::init();
+ cache_config::init(m_config_string);
m_address_mapping = address_mapping;
}
@@ -64,7 +67,7 @@ tag_array::~tag_array()
delete[] m_lines;
}
-tag_array::tag_array( const cache_config &config,
+tag_array::tag_array( cache_config &config,
int core_id,
int type_id,
cache_block_t* new_lines)
@@ -74,13 +77,18 @@ tag_array::tag_array( const cache_config &config,
init( core_id, type_id );
}
-tag_array::tag_array( const cache_config &config,
+void tag_array::update_cache_parameters(cache_config &config)
+{
+ m_config=config;
+}
+
+tag_array::tag_array( cache_config &config,
int core_id,
int type_id )
: m_config( config )
{
//assert( m_config.m_write_policy == READ_ONLY ); Old assert
- m_lines = new cache_block_t[ config.get_num_lines()];
+ m_lines = new cache_block_t[MAX_DEFAULT_CACHE_SIZE_MULTIBLIER*config.get_num_lines()];
init( core_id, type_id );
}