summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJRPAN <[email protected]>2021-05-19 17:27:43 -0400
committerJRPAN <[email protected]>2021-05-19 17:34:06 -0400
commitf27da224f3e468d600499a9d3619009ed9c70256 (patch)
tree429938ac20a69eb6160b8da85eed08cf6d3246e8 /src
parent4a762a933a054b5124fa46a12789ea98f5e2411d (diff)
Use cache config multipilier when possible
Diffstat (limited to 'src')
-rw-r--r--src/abstract_hardware_model.h1
-rw-r--r--src/gpgpu-sim/gpu-cache.h28
-rw-r--r--src/gpgpu-sim/gpu-sim.cc2
-rw-r--r--src/gpgpu-sim/shader.cc8
4 files changed, 19 insertions, 20 deletions
diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h
index bd10a93..dbe138a 100644
--- a/src/abstract_hardware_model.h
+++ b/src/abstract_hardware_model.h
@@ -374,7 +374,6 @@ class core_config {
unsigned mem_warp_parts;
mutable unsigned gpgpu_shmem_size;
char *gpgpu_shmem_option;
- unsigned gpgpu_unified_l1d_size;
unsigned gpgpu_shmem_sizeDefault;
unsigned gpgpu_shmem_sizePrefL1;
unsigned gpgpu_shmem_sizePrefShared;
diff --git a/src/gpgpu-sim/gpu-cache.h b/src/gpgpu-sim/gpu-cache.h
index 0162b6c..87a6b13 100644
--- a/src/gpgpu-sim/gpu-cache.h
+++ b/src/gpgpu-sim/gpu-cache.h
@@ -512,6 +512,14 @@ class cache_config {
exit_parse_error();
}
+ // set * assoc * cacheline size. Then convert Byte to KB
+ unsigned original_size = m_nset * m_assoc * m_line_sz / 1024;
+ if (m_unified_cache_size > 0) {
+ max_cache_multiplier = m_unified_cache_size / original_size;
+ } else {
+ max_cache_multiplier = MAX_DEFAULT_CACHE_SIZE_MULTIBLIER;
+ }
+
switch (ct) {
case 'N':
m_cache_type = NORMAL;
@@ -588,7 +596,7 @@ class cache_config {
// https://ieeexplore.ieee.org/document/8344474/
m_is_streaming = true;
m_alloc_policy = ON_FILL;
- m_mshr_entries = m_nset * m_assoc * MAX_DEFAULT_CACHE_SIZE_MULTIBLIER;
+ m_mshr_entries = m_nset * m_assoc * max_cache_multiplier;
if (m_cache_type == SECTOR) m_mshr_entries *= SECTOR_CHUNCK_SIZE;
m_mshr_max_merge = MAX_WARP_PER_SM;
}
@@ -616,7 +624,6 @@ class cache_config {
m_atom_sz = (m_cache_type == SECTOR) ? SECTOR_SIZE : m_line_sz;
m_sector_sz_log2 = LOGB2(SECTOR_SIZE);
original_m_assoc = m_assoc;
- original_sz = m_nset * original_m_assoc * m_line_sz;
// For more details about difference between FETCH_ON_WRITE and WRITE
@@ -706,19 +713,13 @@ class cache_config {
}
unsigned get_max_num_lines() const {
assert(m_valid);
- return MAX_DEFAULT_CACHE_SIZE_MULTIBLIER * m_nset * original_m_assoc;
+ // gpgpu_unified_cache_size is in KB while original_sz is in B
+ return max_cache_multiplier * m_nset * original_m_assoc;
}
unsigned get_max_assoc() const {
assert(m_valid);
- return MAX_DEFAULT_CACHE_SIZE_MULTIBLIER * original_m_assoc;
- }
- unsigned get_original_assoc() const {
- assert(m_valid);
- return original_m_assoc;
- }
- unsigned get_original_sz() const {
- assert(m_valid);
- return original_sz;
+ // gpgpu_unified_cache_size is in KB while original_sz is in B
+ return max_cache_multiplier * original_m_assoc;
}
void print(FILE *fp) const {
fprintf(fp, "Size = %d B (%d Set x %d-way x %d byte line)\n",
@@ -766,6 +767,7 @@ class cache_config {
char *m_config_stringPrefShared;
FuncCache cache_status;
unsigned m_wr_percent;
+ unsigned m_unified_cache_size;
write_allocate_policy_t get_write_allocate_policy() {
return m_write_alloc_policy;
}
@@ -787,8 +789,8 @@ class cache_config {
unsigned m_atom_sz;
unsigned m_sector_sz_log2;
unsigned original_m_assoc;
- unsigned original_sz;
bool m_is_streaming;
+ unsigned max_cache_multiplier;
enum replacement_policy_t m_replacement_policy; // 'L' = LRU, 'F' = FIFO
enum write_policy_t
diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc
index a2aa929..df30047 100644
--- a/src/gpgpu-sim/gpu-sim.cc
+++ b/src/gpgpu-sim/gpu-sim.cc
@@ -331,7 +331,7 @@ void shader_core_config::reg_options(class OptionParser *opp) {
opp, "-gpgpu_shmem_option", OPT_CSTR, &gpgpu_shmem_option,
"Option list of shared memory sizes", "0");
option_parser_register(
- opp, "-gpgpu_unified_l1d_size", OPT_UINT32, &gpgpu_unified_l1d_size,
+ opp, "-gpgpu_unified_l1d_size", OPT_UINT32, &m_L1D_config.m_unified_cache_size,
"Size of unified data cache(L1D + shared memory) in KB", "0");
option_parser_register(opp, "-gpgpu_adaptive_cache_config", OPT_BOOL,
&adaptive_cache_config, "adaptive_cache_config", "0");
diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc
index 141c700..3efef2b 100644
--- a/src/gpgpu-sim/shader.cc
+++ b/src/gpgpu-sim/shader.cc
@@ -3315,7 +3315,8 @@ unsigned int shader_core_config::max_cta(const kernel_info_t &k) const {
}
unsigned total_shmem = kernel_info->smem * result;
- unsigned total_unified = gpgpu_unified_l1d_size * 1024;
+ // Unified cache config is in KB. Converting to B
+ unsigned total_unified = m_L1D_config.m_unified_cache_size * 1024;
std::sort(shmem_list.begin(), shmem_list.end());
assert(total_shmem >= 0 && total_shmem <= shmem_list.back());
@@ -3325,10 +3326,7 @@ unsigned int shader_core_config::max_cta(const kernel_info_t &k) const {
case ADAPTIVE_CACHE: {
// For more info about adaptive cache, see
bool l1d_configured = false;
- unsigned l1_defined = m_L1D_config.get_original_sz() / 1024;
- assert(gpgpu_unified_l1d_size % l1_defined == 0);
- unsigned max_assoc = m_L1D_config.get_original_assoc() *
- gpgpu_unified_l1d_size / l1_defined;
+ unsigned max_assoc = m_L1D_config.get_max_assoc();
if (total_shmem == 0) {
m_L1D_config.set_assoc(max_assoc);