Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/19249

Change subject: mem-cache: Use findEntry in Signature Prefetcher V2
......................................................................

mem-cache: Use findEntry in Signature Prefetcher V2

Use the proper table function to find an entry for the global history
register.

As a side effect, getPossibleEntries was removed from the associative
set class.

Change-Id: I226855f7cdc1de8af8ca71e009cb391a883050d9
Signed-off-by: Daniel R. Carvalho <[email protected]>
---
M src/mem/cache/prefetch/associative_set.hh
M src/mem/cache/prefetch/associative_set_impl.hh
M src/mem/cache/prefetch/signature_path_v2.cc
3 files changed, 12 insertions(+), 44 deletions(-)



diff --git a/src/mem/cache/prefetch/associative_set.hh b/src/mem/cache/prefetch/associative_set.hh
index e4e1b04..548f30c 100644
--- a/src/mem/cache/prefetch/associative_set.hh
+++ b/src/mem/cache/prefetch/associative_set.hh
@@ -181,14 +181,6 @@
     Entry* findVictim(Addr addr);

     /**
-     * Find the set of entries that could be replaced given
-     * that we want to add a new entry with the provided key
-     * @param addr key to select the set of entries
-     * @result vector of candidates matching with the provided key
-     */
-    std::vector<Entry *> getPossibleEntries(const Addr addr) const;
-
-    /**
      * Indicate that an entry has just been inserted
      * @param addr key of the container
      * @param is_secure tag component of the container
diff --git a/src/mem/cache/prefetch/associative_set_impl.hh b/src/mem/cache/prefetch/associative_set_impl.hh
index 5e6e7c5..8a531cd 100644
--- a/src/mem/cache/prefetch/associative_set_impl.hh
+++ b/src/mem/cache/prefetch/associative_set_impl.hh
@@ -90,22 +90,6 @@
     return victim;
 }

-
-template<class Entry>
-std::vector<Entry *>
-AssociativeSet<Entry>::getPossibleEntries(const Addr addr) const
-{
-    std::vector<ReplaceableEntry *> selected_entries =
-        indexingPolicy->getPossibleEntries(addr);
-    std::vector<Entry *> entries(selected_entries.size(), nullptr);
-
-    unsigned int idx = 0;
-    for (auto &entry : selected_entries) {
-        entries[idx++] = static_cast<Entry *>(entry);
-    }
-    return entries;
-}
-
 template<class Entry>
 void
 AssociativeSet<Entry>::insertEntry(Addr addr, bool is_secure, Entry* entry)
diff --git a/src/mem/cache/prefetch/signature_path_v2.cc b/src/mem/cache/prefetch/signature_path_v2.cc
index 908e8da..8d24bdb 100644
--- a/src/mem/cache/prefetch/signature_path_v2.cc
+++ b/src/mem/cache/prefetch/signature_path_v2.cc
@@ -51,24 +51,15 @@
 SignaturePathPrefetcherV2::handleSignatureTableMiss(stride_t current_block,
     signature_t &new_signature, double &new_conf, stride_t &new_stride)
 {
-    bool found = false;
+    GlobalHistoryEntry* gh_entry =
+        globalHistoryRegister.findEntry(current_block, false);

-    // This should return all entries of the GHR, since it is a fully
-    // associative table
-    std::vector<GlobalHistoryEntry *> all_ghr_entries =
- globalHistoryRegister.getPossibleEntries(0 /* any value works */);
-
-    for (auto gh_entry : all_ghr_entries) {
-        if (gh_entry->lastBlock + gh_entry->delta == current_block) {
-            new_signature = gh_entry->signature;
-            new_conf = gh_entry->confidence;
-            new_stride = gh_entry->delta;
-            found = true;
-            globalHistoryRegister.accessEntry(gh_entry);
-            break;
-        }
-    }
-    if (!found) {
+    if (gh_entry) {
+        new_signature = gh_entry->signature;
+        new_conf = gh_entry->confidence;
+        new_stride = gh_entry->delta;
+        globalHistoryRegister.accessEntry(gh_entry);
+    } else {
         new_signature = current_block;
         new_conf = 1.0;
         new_stride = current_block;
@@ -116,12 +107,13 @@
SignaturePathPrefetcherV2::handlePageCrossingLookahead(signature_t signature,
             stride_t last_offset, stride_t delta, double path_confidence)
 {
+    const Addr tag = static_cast<Addr>(last_offset + delta);
+
     // Always use the replacement policy to assign new entries, as all
     // of them are unique, there are never "hits" in the GHR
-    GlobalHistoryEntry *gh_entry = globalHistoryRegister.findVictim(0);
+    GlobalHistoryEntry *gh_entry = globalHistoryRegister.findVictim(tag);
     assert(gh_entry != nullptr);
-    // Any address value works, as it is never used
-    globalHistoryRegister.insertEntry(0, false, gh_entry);
+    globalHistoryRegister.insertEntry(tag, false, gh_entry);

     gh_entry->signature = signature;
     gh_entry->lastBlock = last_offset;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/19249
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I226855f7cdc1de8af8ca71e009cb391a883050d9
Gerrit-Change-Number: 19249
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to