changeset b4fc9ad648aa in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=b4fc9ad648aa
description:
mem: Add crossbar latencies
This patch introduces latencies in crossbar that were neglected
before. In particular, it adds three parameters in crossbar model:
front_end_latency, forward_latency, and response_latency. Along with
these parameters, three corresponding members are added:
frontEndLatency, forwardLatency, and responseLatency. The coherent
crossbar has an additional snoop_response_latency.
The latency of the request path through the xbar is set as
--> frontEndLatency + forwardLatency
In case the snoop filter is enabled, the request path latency is charged
also by look-up latency of the snoop filter.
--> frontEndLatency + SF(lookupLatency) + forwardLatency.
The latency of the response path through the xbar is set instead as
--> responseLatency.
In case of snoop response, if the response is treated as a normal
response
the latency associated is again
--> responseLatency;
If instead it is forwarded as snoop response we add an additional
variable
+ snoopResponseLatency
and the latency associated is
--> snoopResponseLatency;
Furthermore, this patch lets the crossbar progress on the next clock
edge after an unused retry, changing the time the crossbar considers
itself busy after sending a retry that was not acted upon.
diffstat:
src/mem/XBar.py | 42 +++++++++++++++++++++++++++-----
src/mem/coherent_xbar.cc | 51 +++++++++++++++++++++++++++++++--------
src/mem/coherent_xbar.hh | 5 +++-
src/mem/noncoherent_xbar.cc | 31 ++++++++++++++++++------
src/mem/noncoherent_xbar.hh | 2 +-
src/mem/xbar.cc | 57 ++++++++++++++++++++++++++------------------
src/mem/xbar.hh | 16 ++++++++++--
7 files changed, 150 insertions(+), 54 deletions(-)
diffs (truncated from 396 to 300 lines):
diff -r 4ed87af2930f -r b4fc9ad648aa src/mem/XBar.py
--- a/src/mem/XBar.py Mon Mar 02 04:00:44 2015 -0500
+++ b/src/mem/XBar.py Mon Mar 02 04:00:46 2015 -0500
@@ -1,4 +1,4 @@
-# Copyright (c) 2012 ARM Limited
+# Copyright (c) 2012, 2015 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
@@ -49,10 +49,29 @@
type = 'BaseXBar'
abstract = True
cxx_header = "mem/xbar.hh"
- slave = VectorSlavePort("vector port for connecting masters")
- master = VectorMasterPort("vector port for connecting slaves")
- header_cycles = Param.Cycles(1, "cycles of overhead per transaction")
- width = Param.Unsigned(8, "xbar width (bytes)")
+
+ slave = VectorSlavePort("Vector port for connecting masters")
+ master = VectorMasterPort("Vector port for connecting slaves")
+
+ # Latencies governing the time taken for the variuos paths a
+ # packet has through the crossbar. Note that the crossbar itself
+ # does not add the latency due to assumptions in the coherency
+ # mechanism. Instead the latency is annotated on the packet and
+ # left to the neighbouring modules.
+ #
+ # A request incurs the frontend latency, possibly snoop filter
+ # lookup latency, and forward latency. A response incurs the
+ # response latency. Frontend latency encompasses arbitration and
+ # deciding what to do when a request arrives. the forward latency
+ # is the latency involved once a decision is made to forward the
+ # request. The response latency, is similar to the forward
+ # latency, but for responses rather than requests.
+ frontend_latency = Param.Cycles(3, "Frontend latency")
+ forward_latency = Param.Cycles(4, "Forward latency")
+ response_latency = Param.Cycles(2, "Response latency")
+
+ # Width governing the throughput of the crossbar
+ width = Param.Unsigned(8, "Datapath width per port (bytes)")
# The default port can be left unconnected, or be used to connect
# a default slave port
@@ -74,12 +93,21 @@
type = 'CoherentXBar'
cxx_header = "mem/coherent_xbar.hh"
+ # The coherent crossbar additionally has snoop responses that are
+ # forwarded after a specific latency.
+ snoop_response_latency = Param.Cycles(4, "Snoop response latency")
+
+ # An optional snoop filter
+ snoop_filter = Param.SnoopFilter(NULL, "Selected snoop filter")
+
system = Param.System(Parent.any, "System that the crossbar belongs to.")
- snoop_filter = Param.SnoopFilter(NULL, "Selected snoop filter.")
class SnoopFilter(SimObject):
type = 'SnoopFilter'
cxx_header = "mem/snoop_filter.hh"
- lookup_latency = Param.Cycles(3, "lookup latency (cycles)")
+
+ # Lookup latency of the snoop filter, added to requests that pass
+ # through a coherent crossbar.
+ lookup_latency = Param.Cycles(1, "Lookup latency")
system = Param.System(Parent.any, "System that the crossbar belongs to.")
diff -r 4ed87af2930f -r b4fc9ad648aa src/mem/coherent_xbar.cc
--- a/src/mem/coherent_xbar.cc Mon Mar 02 04:00:44 2015 -0500
+++ b/src/mem/coherent_xbar.cc Mon Mar 02 04:00:46 2015 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014 ARM Limited
+ * Copyright (c) 2011-2015 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -55,7 +55,8 @@
#include "sim/system.hh"
CoherentXBar::CoherentXBar(const CoherentXBarParams *p)
- : BaseXBar(p), system(p->system), snoopFilter(p->snoop_filter)
+ : BaseXBar(p), system(p->system), snoopFilter(p->snoop_filter),
+ snoopResponseLatency(p->snoop_response_latency)
{
// create the ports based on the size of the master and slave
// vector ports, and the presence of the default port, the ports
@@ -167,8 +168,17 @@
unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
unsigned int pkt_cmd = pkt->cmdToIndex();
- calcPacketTiming(pkt);
- Tick packetFinishTime = curTick() + pkt->payloadDelay;
+ // store the old header delay so we can restore it if needed
+ Tick old_header_delay = pkt->headerDelay;
+
+ // a request sees the frontend and forward latency
+ Tick xbar_delay = (frontendLatency + forwardLatency) * clockPeriod();
+
+ // set the packet header and payload delay
+ calcPacketTiming(pkt, xbar_delay);
+
+ // determine how long to be crossbar layer is busy
+ Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
// uncacheable requests need never be snooped
if (!pkt->req->isUncacheable() && !system->bypassCaches()) {
@@ -177,6 +187,10 @@
if (snoopFilter) {
// check with the snoop filter where to forward this packet
auto sf_res = snoopFilter->lookupRequest(pkt, *src_port);
+ // If SnoopFilter is enabled, the total time required by a packet
+ // to be delivered through the xbar has to be charged also with
+ // to lookup latency of the snoop filter (sf_res.second).
+ pkt->headerDelay += sf_res.second * clockPeriod();
packetFinishTime += sf_res.second * clockPeriod();
DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x"\
" SF size: %i lat: %i\n", src_port->name(),
@@ -221,15 +235,15 @@
assert(!is_express_snoop);
assert(!pkt->memInhibitAsserted());
- // undo the calculation so we can check for 0 again
- pkt->headerDelay = pkt->payloadDelay = 0;
+ // restore the header delay
+ pkt->headerDelay = old_header_delay;
DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x RETRY\n",
src_port->name(), pkt->cmdString(), pkt->getAddr());
// update the layer state and schedule an idle event
reqLayers[master_port_id]->failedTiming(src_port,
- clockEdge(headerCycles));
+ clockEdge(Cycles(1)));
} else {
// express snoops currently bypass the crossbar state entirely
if (!is_express_snoop) {
@@ -300,8 +314,14 @@
unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
unsigned int pkt_cmd = pkt->cmdToIndex();
- calcPacketTiming(pkt);
- Tick packetFinishTime = curTick() + pkt->payloadDelay;
+ // a response sees the response latency
+ Tick xbar_delay = responseLatency * clockPeriod();
+
+ // set the packet header and payload delay
+ calcPacketTiming(pkt, xbar_delay);
+
+ // determine how long to be crossbar layer is busy
+ Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
if (snoopFilter && !pkt->req->isUncacheable() && !system->bypassCaches()) {
// let the snoop filter inspect the response and update its state
@@ -426,8 +446,17 @@
// responses are never express snoops
assert(!pkt->isExpressSnoop());
- calcPacketTiming(pkt);
- Tick packetFinishTime = curTick() + pkt->payloadDelay;
+ // a snoop response sees the snoop response latency, and if it is
+ // forwarded as a normal response, the response latency
+ Tick xbar_delay =
+ (forwardAsSnoop ? snoopResponseLatency : responseLatency) *
+ clockPeriod();
+
+ // set the packet header and payload delay
+ calcPacketTiming(pkt, xbar_delay);
+
+ // determine how long to be crossbar layer is busy
+ Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
// forward it either as a snoop response or a normal response
if (forwardAsSnoop) {
diff -r 4ed87af2930f -r b4fc9ad648aa src/mem/coherent_xbar.hh
--- a/src/mem/coherent_xbar.hh Mon Mar 02 04:00:44 2015 -0500
+++ b/src/mem/coherent_xbar.hh Mon Mar 02 04:00:46 2015 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014 ARM Limited
+ * Copyright (c) 2011-2015 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -272,6 +272,9 @@
* broadcast needed for probes. NULL denotes an absent filter. */
SnoopFilter *snoopFilter;
+ /** Cycles of snoop response latency.*/
+ const Cycles snoopResponseLatency;
+
/** Function called by the port when the crossbar is recieving a Timing
request packet.*/
bool recvTimingReq(PacketPtr pkt, PortID slave_port_id);
diff -r 4ed87af2930f -r b4fc9ad648aa src/mem/noncoherent_xbar.cc
--- a/src/mem/noncoherent_xbar.cc Mon Mar 02 04:00:44 2015 -0500
+++ b/src/mem/noncoherent_xbar.cc Mon Mar 02 04:00:46 2015 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014 ARM Limited
+ * Copyright (c) 2011-2015 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -127,8 +127,17 @@
unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
unsigned int pkt_cmd = pkt->cmdToIndex();
- calcPacketTiming(pkt);
- Tick packetFinishTime = curTick() + pkt->payloadDelay;
+ // store the old header delay so we can restore it if needed
+ Tick old_header_delay = pkt->headerDelay;
+
+ // a request sees the frontend and forward latency
+ Tick xbar_delay = (frontendLatency + forwardLatency) * clockPeriod();
+
+ // set the packet header and payload delay
+ calcPacketTiming(pkt, xbar_delay);
+
+ // determine how long to be crossbar layer is busy
+ Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
// before forwarding the packet (and possibly altering it),
// remember if we are expecting a response
@@ -145,12 +154,12 @@
DPRINTF(NoncoherentXBar, "recvTimingReq: src %s %s 0x%x RETRY\n",
src_port->name(), pkt->cmdString(), pkt->getAddr());
- // undo the calculation so we can check for 0 again
- pkt->headerDelay = pkt->payloadDelay = 0;
+ // restore the header delay as it is additive
+ pkt->headerDelay = old_header_delay;
// occupy until the header is sent
reqLayers[master_port_id]->failedTiming(src_port,
- clockEdge(headerCycles));
+ clockEdge(Cycles(1)));
return false;
}
@@ -200,8 +209,14 @@
unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
unsigned int pkt_cmd = pkt->cmdToIndex();
- calcPacketTiming(pkt);
- Tick packetFinishTime = curTick() + pkt->payloadDelay;
+ // a response sees the response latency
+ Tick xbar_delay = responseLatency * clockPeriod();
+
+ // set the packet header and payload delay
+ calcPacketTiming(pkt, xbar_delay);
+
+ // determine how long to be crossbar layer is busy
+ Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
// send the packet through the destination slave port
bool success M5_VAR_USED = slavePorts[slave_port_id]->sendTimingResp(pkt);
diff -r 4ed87af2930f -r b4fc9ad648aa src/mem/noncoherent_xbar.hh
--- a/src/mem/noncoherent_xbar.hh Mon Mar 02 04:00:44 2015 -0500
+++ b/src/mem/noncoherent_xbar.hh Mon Mar 02 04:00:46 2015 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014 ARM Limited
+ * Copyright (c) 2011-2015 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
diff -r 4ed87af2930f -r b4fc9ad648aa src/mem/xbar.cc
--- a/src/mem/xbar.cc Mon Mar 02 04:00:44 2015 -0500
+++ b/src/mem/xbar.cc Mon Mar 02 04:00:46 2015 -0500
@@ -56,7 +56,10 @@
BaseXBar::BaseXBar(const BaseXBarParams *p)
: MemObject(p),
- headerCycles(p->header_cycles), width(p->width),
+ frontendLatency(p->frontend_latency),
+ forwardLatency(p->forward_latency),
+ responseLatency(p->response_latency),
+ width(p->width),
gotAddrRanges(p->port_default_connection_count +
p->port_master_connection_count, false),
gotAllAddrRanges(false), defaultPortID(InvalidPortID),
@@ -102,34 +105,41 @@
}
void
-BaseXBar::calcPacketTiming(PacketPtr pkt)
+BaseXBar::calcPacketTiming(PacketPtr pkt, Tick header_delay)
{
// the crossbar will be called at a time that is not necessarily
// coinciding with its own clock, so start by determining how long
// until the next clock edge (could be zero)
Tick offset = clockEdge() - curTick();
- // Determine how many cycles are needed to send the data
- // If the packet has no data we take into account just the cycle to send
- // the header.
- unsigned dataCycles = pkt->hasData() ? divCeil(pkt->getSize(), width) : 0;
+ // the header delay depends on the path through the crossbar, and
+ // we therefore rely on the caller to provide the actual
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev