Re: [Gems-users] How to access cache entry in LRUPolicy


Date: Thu, 11 Feb 2010 08:09:45 -0600
From: Dan Gibson <degibson@xxxxxxxx>
Subject: Re: [Gems-users] How to access cache entry in LRUPolicy
Liz,
1. I don't see a getVictimOwner() function, nor an m_cache member, in LRUPolicy.h. Are you adding this function and this member variable? If not what version of GEMS are you using? I'm going to assume 'yes', and '2.1' respectively.

2. The problems below relate to templates, I think. I'm not *sure* because I cannot see the declaration of m_cache.

In many places in Ruby, m_cache is a Vector<Vector<ENTRY> >, where ENTRY is a templatized parameter. See CacheMemory.h for an example. ENTRY is typically bound to L1Cache_Entry and L2Cache_Entry.

The problem below arises because LRUPolicy.h has no idea what a particular cache entry contains. In fact, it cannot know, because LRUPolicy doesn't know whether it is applied to an L1 cache or an L2 cache. In this particular case, type ENTRY isn't defined, because LRUPolicy isn't templatized.

See also this templates tutorial: http://www.iis.sinica.edu.tw/~kathy/vcstl/templates.htm

Regards,
Dan

On Thu, Feb 11, 2010 at 5:59 AM, Liz Joy <lizjoy86@xxxxxxxxx> wrote:
Hii
I want to access each cache entry m_cache[set][i] in getVictimOwner(Index set,NodeID processorid) of LRUPolicy.h file.
I need to check the condition.
for(unsigned int i=0;i < m_assoc; i++)
{
        if(m_cache[set][i].m_Address.m_processorid == processorid)............................//line no 98
        {
                smallest_time = m_last_ref_ptr[set][i];
                smallest_index = i;
                break;

        }
}

for (unsigned int i=0; i < m_assoc; i++)
 {

        if(m_cache[set][i].m_Address.m_processorid == processorid)....................//line no 109
        {
                 time = m_last_ref_ptr[set][i];
                                 //assert(m_cache[cacheSet][i].m_Permission != AccessPermission_NotPresent);

                if (time < smallest_time)
                {
                         smallest_index = i;
                         smallest_time = time;
                }
         }
  }
But the checking condition is giving an error saying
system/LRUPolicy.h: In member function `virtual Index LRUPolicy::getVictimOwner(Index, NodeID) const':
system/LRUPolicy.h:98: error: invalid use of undefined type `const struct ENTRY'
slicc_interface/AbstractChip.h:77: error: forward declaration of `const struct ENTRY'
system/LRUPolicy.h:108: error: invalid initialization of reference of type 'ENTRY&' from _expression_ of type 'const ENTRY'
system/LRUPolicy.h:109: error: invalid use of undefined type `struct ENTRY'
slicc_interface/AbstractChip.h:77: error: forward declaration of `struct ENTRY'
system/LRUPolicy.h: In member function `virtual Index LRUPolicy::getVictimChangeOwnership(Index, NodeID) const':
system/LRUPolicy.h:140: error: invalid use of undefined type `const struct ENTRY'
slicc_interface/AbstractChip.h:77: error: forward declaration of `const struct ENTRY'
system/LRUPolicy.h:152: error: invalid use of undefined type `const struct ENTRY'
slicc_interface/AbstractChip.h:77: error: forward declaration of `const struct ENTRY'
system/CacheMemory.h: In constructor `CacheMemory<ENTRY>::CacheMemory(AbstractChip*, int, int, MachineType, const std::string&) [with ENTRY = L1Cache_Entry]':
generated/MSI_MOSI_CMP_directory/Chip.C:126:   instantiated from here
system/CacheMemory.h:247: warning: converting to `int' from `double'
system/CacheMemory.h: In constructor `CacheMemory<ENTRY>::CacheMemory(AbstractChip*, int, int, MachineType, const std::string&) [with ENTRY = L2Cache_Entry]':
generated/MSI_MOSI_CMP_directory/Chip.C:284:   instantiated from here
system/CacheMemory.h:247: warning: converting to `int' from `double'
../common/Vector.h: In destructor `Vector<TYPE>::~Vector() [with TYPE = ENTRY]':
../common/Vector.h:149:   instantiated from `Vector<TYPE>::~Vector() [with TYPE = Vector<ENTRY>]'
system/LRUPolicy.h:43:   instantiated from here
../common/Vector.h:149: error: invalid use of undefined type `struct ENTRY'
slicc_interface/AbstractChip.h:77: error: forward declaration of `struct ENTRY'
../common/Vector.h: In member function `const TYPE& Vector<TYPE>::ref(int) const [with TYPE = ENTRY]':
../common/Vector.h:108:   instantiated from `const TYPE& Vector<TYPE>::operator[](int) const [with TYPE = ENTRY]'
system/LRUPolicy.h:98:   instantiated from here
../common/Vector.h:160: error: invalid use of undefined type `struct ENTRY'
slicc_interface/AbstractChip.h:77: error: forward declaration of `struct ENTRY'
make[1]: *** [x86-linux/generated/MSI_MOSI_CMP_directory/obj/Chip.o] Error 1
make[1]: Leaving directory `/scratch/liz/simulator/gems-2.1.1/ruby'
make: *** [all] Error 2

Can anyone please help to remove this error.How can I access m_cache[set][j].m_Address.m_processorid???
Expecting a reply soon
Thanks in advance
Liz

_______________________________________________
Gems-users mailing list
Gems-users@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/gems-users
Use Google to search the GEMS Users mailing list by adding "site:https://lists.cs.wisc.edu/archive/gems-users/" to your search.





--
http://www.cs.wisc.edu/~gibson [esc]:wq!
[← Prev in Thread] Current Thread [Next in Thread→]