summaryrefslogtreecommitdiff
path: root/src/mem/snoop_filter.hh
diff options
context:
space:
mode:
authorTiago Muck <tiago.muck@arm.com>2019-02-07 13:37:40 -0600
committerTiago Mück <tiago.muck@arm.com>2019-05-28 16:14:22 +0000
commitc73b7e50d06a8313174de0133ea4050ccb5959d9 (patch)
treede1366aa2ec9ff6c4844b7a241df888d2e92b4f0 /src/mem/snoop_filter.hh
parentcdc03f96a70b659ba3067c2dae1901aac5cda9df (diff)
downloadgem5-c73b7e50d06a8313174de0133ea4050ccb5959d9.tar.xz
mem: Snoop filter support for large systems
Changed SnoopMask to use std::bitset instead of uint64 so we can simulate larger systems without having to workaround limitations on the number of ports. No noticeable performance drop was observed after this change. The size of the bitset is currently set to 256 which should fit most needs. Change-Id: I216882300500e2dcb789889756e73a1033271621 Signed-off-by: Tiago Muck <tiago.muck@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18791 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/mem/snoop_filter.hh')
-rw-r--r--src/mem/snoop_filter.hh21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/mem/snoop_filter.hh b/src/mem/snoop_filter.hh
index 85cc75e9b..9c066155c 100644
--- a/src/mem/snoop_filter.hh
+++ b/src/mem/snoop_filter.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 ARM Limited
+ * Copyright (c) 2013-2016,2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -45,6 +45,7 @@
#ifndef __MEM_SNOOP_FILTER_HH__
#define __MEM_SNOOP_FILTER_HH__
+#include <bitset>
#include <unordered_map>
#include <utility>
@@ -86,6 +87,10 @@
*/
class SnoopFilter : public SimObject {
public:
+
+ // Change for systems with more than 256 ports tracked by this object
+ static const int SNOOP_MASK_SIZE = 256;
+
typedef std::vector<QueuedSlavePort*> SnoopList;
SnoopFilter (const SnoopFilterParams *p) :
@@ -114,9 +119,9 @@ class SnoopFilter : public SimObject {
}
// make sure we can deal with this many ports
- fatal_if(id > 8 * sizeof(SnoopMask),
+ fatal_if(id > SNOOP_MASK_SIZE,
"Snoop filter only supports %d snooping ports, got %d\n",
- 8 * sizeof(SnoopMask), id);
+ SNOOP_MASK_SIZE, id);
}
/**
@@ -198,13 +203,9 @@ class SnoopFilter : public SimObject {
/**
* The underlying type for the bitmask we use for tracking. This
- * limits the number of snooping ports supported per crossbar. For
- * the moment it is an uint64_t to offer maximum
- * scalability. However, it is possible to use e.g. a uint16_t or
- * uint32_to slim down the footprint of the hash map (and
- * ultimately improve the simulation performance).
+ * limits the number of snooping ports supported per crossbar.
*/
- typedef uint64_t SnoopMask;
+ typedef std::bitset<SNOOP_MASK_SIZE> SnoopMask;
/**
* Per cache line item tracking a bitmask of SlavePorts who have an
@@ -314,7 +315,7 @@ SnoopFilter::maskToPortList(SnoopMask port_mask) const
{
SnoopList res;
for (const auto& p : slavePorts)
- if (port_mask & portToMask(*p))
+ if ((port_mask & portToMask(*p)).any())
res.push_back(p);
return res;
}