summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJRPAN <[email protected]>2021-06-03 13:56:04 -0400
committerJRPAN <[email protected]>2021-06-03 13:56:04 -0400
commite9d781a467dd21c3ec3f1508aede803cb3ffb2c3 (patch)
tree47adfab2fa38d45aa5f18b598fb3da0646564ff4
parent04462cbf5b56e0416c3a733b4214351ac227f4c0 (diff)
minor improvements
-rw-r--r--src/gpgpu-sim/l2cache.cc9
-rw-r--r--src/gpgpu-sim/shader.cc32
2 files changed, 18 insertions, 23 deletions
diff --git a/src/gpgpu-sim/l2cache.cc b/src/gpgpu-sim/l2cache.cc
index 57e8ea9..f1c761f 100644
--- a/src/gpgpu-sim/l2cache.cc
+++ b/src/gpgpu-sim/l2cache.cc
@@ -716,7 +716,7 @@ memory_sub_partition::breakdown_request_to_sector_requests(mem_fetch *mf) {
if (mf->get_data_size() == SECTOR_SIZE &&
mf->get_access_sector_mask().count() == 1) {
result.push_back(mf);
- } else if (mf->get_data_size() == 128) {
+ } else if (mf->get_data_size() == MAX_MEMORY_ACCESS_SIZE) {
// break down every sector
mem_access_byte_mask_t mask;
for (unsigned i = 0; i < SECTOR_CHUNCK_SIZE; i++) {
@@ -732,11 +732,12 @@ memory_sub_partition::breakdown_request_to_sector_requests(mem_fetch *mf) {
result.push_back(n_mf);
}
+ // This is for constant cache
} else if (mf->get_data_size() == 64 &&
- (mf->get_access_sector_mask().to_string() == "1111" ||
- mf->get_access_sector_mask().to_string() == "0000")) {
+ (mf->get_access_sector_mask().all() ||
+ mf->get_access_sector_mask().none())) {
unsigned start;
- if (mf->get_addr() % 128 == 0)
+ if (mf->get_addr() % MAX_MEMORY_ACCESS_SIZE == 0)
start = 0;
else
start = 2;
diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc
index c65affd..0f66312 100644
--- a/src/gpgpu-sim/shader.cc
+++ b/src/gpgpu-sim/shader.cc
@@ -3344,30 +3344,24 @@ unsigned int shader_core_config::max_cta(const kernel_info_t &k) const {
// Unified cache config is in KB. Converting to B
unsigned total_unified = m_L1D_config.m_unified_cache_size * 1024;
- switch (adaptive_cache_config) {
- case FIXED:
- break;
- case ADAPTIVE_CACHE: {
- bool l1d_configured = false;
- unsigned max_assoc = m_L1D_config.get_max_assoc();
+ bool l1d_configured = false;
+ unsigned max_assoc = m_L1D_config.get_max_assoc();
- for (std::vector<unsigned>::const_iterator it = shmem_opt_list.begin();
- it < shmem_opt_list.end(); it++) {
- if (total_shmem <= *it) {
- float l1_ratio = 1 - ((float)*(it) / total_unified);
- m_L1D_config.set_assoc(max_assoc * l1_ratio);
- l1d_configured = true;
- break;
- }
- }
-
- assert(l1d_configured && "no shared memory option found");
+ for (std::vector<unsigned>::const_iterator it = shmem_opt_list.begin();
+ it < shmem_opt_list.end(); it++) {
+ if (total_shmem <= *it) {
+ float l1_ratio = 1 - ((float)*(it) / total_unified);
+ // make sure the ratio is between 0 and 1
+ assert(0 <= l1_ratio && l1_ratio <= 1);
+ // round to nearest instead of round down
+ m_L1D_config.set_assoc(max_assoc * l1_ratio + 0.5f);
+ l1d_configured = true;
break;
}
- default:
- assert(0);
}
+ assert(l1d_configured && "no shared memory option found");
+
if (m_L1D_config.is_streaming()) {
// for streaming cache, if the whole memory is allocated
// to the L1 cache, then make the allocation to be on_MISS