summaryrefslogtreecommitdiff
path: root/src/gpgpu-sim/gpu-cache.h
diff options
context:
space:
mode:
authorMahmoud <[email protected]>2017-11-19 20:05:53 -0500
committerMahmoud <[email protected]>2017-11-19 20:05:53 -0500
commit6a2f9978b9325fb78e8af1be5d5aaf90814e08d7 (patch)
tree189adf02f534869654c7ebe5f5dd4c4838def3a3 /src/gpgpu-sim/gpu-cache.h
parent8719ea402730f6f429e32d63304f9af79bb83df0 (diff)
Doing lazy fetch-on-read policy
Diffstat (limited to 'src/gpgpu-sim/gpu-cache.h')
-rw-r--r--src/gpgpu-sim/gpu-cache.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/gpgpu-sim/gpu-cache.h b/src/gpgpu-sim/gpu-cache.h
index 6a84a3a..0d07878 100644
--- a/src/gpgpu-sim/gpu-cache.h
+++ b/src/gpgpu-sim/gpu-cache.h
@@ -123,8 +123,11 @@ struct cache_block_t {
virtual void set_ignore_on_fill(bool m_ignore, mem_access_sector_mask_t sector_mask) = 0;
virtual void set_modified_on_fill(bool m_modified, mem_access_sector_mask_t sector_mask) = 0;
virtual unsigned get_modified_size() = 0;
+ virtual void set_m_readable(bool readable, mem_access_sector_mask_t sector_mask)=0;
+ virtual bool is_readable(mem_access_sector_mask_t sector_mask)=0;
virtual ~cache_block_t() {}
+
new_addr_type m_tag;
new_addr_type m_block_addr;
@@ -139,6 +142,7 @@ struct line_cache_block: public cache_block_t {
m_status=INVALID;
m_ignore_on_fill_status = false;
m_set_modified_on_fill = false;
+ m_readable = true;
}
void allocate( new_addr_type tag, new_addr_type block_addr, unsigned time, mem_access_sector_mask_t sector_mask )
{
@@ -209,6 +213,13 @@ struct line_cache_block: public cache_block_t {
{
return SECTOR_CHUNCK_SIZE * SECTOR_SIZE; //i.e. cache line size
}
+ virtual void set_m_readable(bool readable, mem_access_sector_mask_t sector_mask)
+ {
+ m_readable = readable;
+ }
+ virtual bool is_readable(mem_access_sector_mask_t sector_mask) {
+ return m_readable;
+ }
private:
@@ -218,6 +229,7 @@ private:
cache_block_state m_status;
bool m_ignore_on_fill_status;
bool m_set_modified_on_fill;
+ bool m_readable;
};
struct sector_cache_block : public cache_block_t {
@@ -234,6 +246,7 @@ struct sector_cache_block : public cache_block_t {
m_status[i]= INVALID;
m_ignore_on_fill_status[i] = false;
m_set_modified_on_fill[i] = false;
+ m_readable[i] = true;
}
m_line_alloc_time=0;
m_line_last_access_time=0;
@@ -279,9 +292,15 @@ struct sector_cache_block : public cache_block_t {
m_sector_alloc_time[sidx]=time;
m_last_sector_access_time[sidx]=time;
m_sector_fill_time[sidx]=0;
+ if(m_status[sidx]==MODIFIED) //this should be the case only for fetch-on-write policy //TO DO
+ m_set_modified_on_fill[sidx] = true;
+ else
+ m_set_modified_on_fill[sidx] = false;
+
m_status[sidx]=RESERVED;
m_ignore_on_fill_status[sidx] = false;
- m_set_modified_on_fill[sidx] = false;
+ //m_set_modified_on_fill[sidx] = false;
+ m_readable[sidx] = true;
//set line stats
m_line_last_access_time=time;
@@ -362,6 +381,15 @@ struct sector_cache_block : public cache_block_t {
unsigned sidx = get_sector_index(sector_mask);
m_set_modified_on_fill[sidx] = m_modified;
}
+ virtual void set_m_readable(bool readable, mem_access_sector_mask_t sector_mask)
+ {
+ unsigned sidx = get_sector_index(sector_mask);
+ m_readable[sidx] = readable;
+ }
+ virtual bool is_readable(mem_access_sector_mask_t sector_mask) {
+ unsigned sidx = get_sector_index(sector_mask);
+ return m_readable[sidx];
+ }
virtual unsigned get_modified_size()
{
@@ -383,6 +411,7 @@ private:
cache_block_state m_status[SECTOR_CHUNCK_SIZE];
bool m_ignore_on_fill_status[SECTOR_CHUNCK_SIZE];
bool m_set_modified_on_fill[SECTOR_CHUNCK_SIZE];
+ bool m_readable[SECTOR_CHUNCK_SIZE];
unsigned get_sector_index(mem_access_sector_mask_t sector_mask)
{