summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJRPAN <[email protected]>2021-05-19 15:45:35 -0400
committerJRPAN <[email protected]>2021-05-19 15:46:08 -0400
commit4c354ebda2c92bb5866c20f03a254743c8ec85a3 (patch)
treebd35fe5e86be921cdf5658a9abee72fb7622816c /src
parentf70f5d6e5599c643074b0d00d3e3dcc385e5913d (diff)
minor improvements
Diffstat (limited to 'src')
-rw-r--r--src/gpgpu-sim/gpu-cache.cc14
-rw-r--r--src/gpgpu-sim/gpu-cache.h6
2 files changed, 11 insertions, 9 deletions
diff --git a/src/gpgpu-sim/gpu-cache.cc b/src/gpgpu-sim/gpu-cache.cc
index 05b338e..98951ca 100644
--- a/src/gpgpu-sim/gpu-cache.cc
+++ b/src/gpgpu-sim/gpu-cache.cc
@@ -279,17 +279,19 @@ enum cache_request_status tag_array::probe(new_addr_type addr, unsigned &idx,
}
}
if (!line->is_reserved_line()) {
+ // percentage of dirty lines in the cache
+ // number of dirty lines / total lines in the cache
+ float dirty_line_percentage =
+ (float) (m_dirty / (m_config.m_nset * m_config.m_assoc )) * 100;
if (!line->is_modified_line() ||
- m_dirty / (m_config.m_nset * m_config.m_assoc * 100) >=
- m_config.m_wr_percent) {
+ dirty_line_percentage >= m_config.m_wr_percent) {
+ // if number of dirty lines in the cache is greater than
+ // a specific value
all_reserved = false;
if (line->is_invalid_line()) {
invalid_line = index;
} else {
// valid line : keep track of most appropriate replacement candidate
-
- // don't evict write until dirty lines reach threshold
- // make sure at least 1 candidate is assigned
if (m_config.m_replacement_policy == LRU) {
if (line->get_last_access_time() < valid_timestamp) {
valid_timestamp = line->get_last_access_time();
@@ -363,7 +365,7 @@ enum cache_request_status tag_array::access(new_addr_type addr, unsigned time,
m_lines[idx]->set_byte_mask(mf);
evicted.set_info(m_lines[idx]->m_block_addr,
m_lines[idx]->get_modified_size(),
- m_lines[idx]->get_byte_mask(),
+ m_lines[idx]->get_dirty_byte_mask(),
m_lines[idx]->get_dirty_sector_mask());
m_dirty--;
}
diff --git a/src/gpgpu-sim/gpu-cache.h b/src/gpgpu-sim/gpu-cache.h
index 5179173..dc3b39a 100644
--- a/src/gpgpu-sim/gpu-cache.h
+++ b/src/gpgpu-sim/gpu-cache.h
@@ -135,7 +135,7 @@ struct cache_block_t {
mem_access_sector_mask_t sector_mask) = 0;
virtual void set_byte_mask(mem_fetch *mf) = 0;
virtual void set_byte_mask(mem_access_byte_mask_t byte_mask) = 0;
- virtual mem_access_byte_mask_t get_byte_mask() = 0;
+ virtual mem_access_byte_mask_t get_dirty_byte_mask() = 0;
virtual mem_access_sector_mask_t get_dirty_sector_mask() = 0;
virtual unsigned long long get_last_access_time() = 0;
virtual void set_last_access_time(unsigned long long time,
@@ -215,7 +215,7 @@ struct line_cache_block : public cache_block_t {
virtual void set_byte_mask(mem_access_byte_mask_t byte_mask) {
m_byte_mask = m_byte_mask | byte_mask;
}
- virtual mem_access_byte_mask_t get_byte_mask() {
+ virtual mem_access_byte_mask_t get_dirty_byte_mask() {
return m_byte_mask;
}
virtual mem_access_sector_mask_t get_dirty_sector_mask() {
@@ -410,7 +410,7 @@ struct sector_cache_block : public cache_block_t {
virtual void set_byte_mask(mem_access_byte_mask_t byte_mask) {
m_byte_mask = m_byte_mask | byte_mask;
}
- virtual mem_access_byte_mask_t get_byte_mask() {
+ virtual mem_access_byte_mask_t get_dirty_byte_mask() {
return m_byte_mask;
}
virtual mem_access_sector_mask_t get_dirty_sector_mask() {