From e040bcb69a3dbcbc50cb747da845e281467075a4 Mon Sep 17 00:00:00 2001 From: Ahmed El-Shafiey Date: Sun, 14 Apr 2013 20:14:54 -0800 Subject: - 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] --- src/gpgpu-sim/gpu-cache.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/gpgpu-sim/gpu-cache.cc') 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 +#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 ); } -- cgit v1.3