ruby: rename networktest to garnet_synthetic_traffic.
networktest is essentially a collection of synthetic traffic patterns for the network. The protocol name and the tester having the same name led to multiple python configuration files with the same name, adding confusion. This patch renames networktest to garnet_synthetic_traffic, and also adds more synthetic traffic patterns.
This commit is contained in:
parent
aca869bf2d
commit
0f68b50ff1
5 changed files with 229 additions and 116 deletions
|
@ -1,5 +1,4 @@
|
||||||
# Copyright (c) 2006-2007 The Regents of The University of Michigan
|
# Copyright (c) 2016 Georgia Institute of Technology
|
||||||
# Copyright (c) 2010 Advanced Micro Devices, Inc.
|
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -25,8 +24,7 @@
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
# Authors: Ron Dreslinski
|
# Author: Tushar Krishna
|
||||||
# Tushar Krishna
|
|
||||||
|
|
||||||
import m5
|
import m5
|
||||||
from m5.objects import *
|
from m5.objects import *
|
||||||
|
@ -48,9 +46,10 @@ m5_root = os.path.dirname(config_root)
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
Options.addCommonOptions(parser)
|
Options.addCommonOptions(parser)
|
||||||
|
|
||||||
parser.add_option("--synthetic", type="int", default=0,
|
parser.add_option("--synthetic", type="choice", default="uniform_random",
|
||||||
help="Synthetic Traffic type. 0 = Uniform Random,\
|
choices=['uniform_random', 'tornado', 'bit_complement', \
|
||||||
1 = Tornado, 2 = Bit Complement")
|
'bit_reverse', 'bit_rotation', 'neighbor', \
|
||||||
|
'shuffle', 'transpose'])
|
||||||
|
|
||||||
parser.add_option("-i", "--injectionrate", type="float", default=0.1,
|
parser.add_option("-i", "--injectionrate", type="float", default=0.1,
|
||||||
metavar="I",
|
metavar="I",
|
||||||
|
@ -65,12 +64,22 @@ parser.add_option("--precision", type="int", default=3,
|
||||||
parser.add_option("--sim-cycles", type="int", default=1000,
|
parser.add_option("--sim-cycles", type="int", default=1000,
|
||||||
help="Number of simulation cycles")
|
help="Number of simulation cycles")
|
||||||
|
|
||||||
parser.add_option("--fixed-pkts", action="store_true",
|
parser.add_option("--num-packets-max", type="int", default=-1,
|
||||||
help="Network_test: inject --maxpackets and stop")
|
help="Stop injecting after --num-packets-max.\
|
||||||
|
Set to -1 to disable.")
|
||||||
|
|
||||||
parser.add_option("--maxpackets", type="int", default=1,
|
parser.add_option("--single-sender-id", type="int", default=-1,
|
||||||
help="Stop injecting after --maxpackets. \
|
help="Only inject from this sender.\
|
||||||
Works only with --fixed-pkts")
|
Set to -1 to disable.")
|
||||||
|
|
||||||
|
parser.add_option("--single-dest-id", type="int", default=-1,
|
||||||
|
help="Only send to this destination.\
|
||||||
|
Set to -1 to disable.")
|
||||||
|
|
||||||
|
parser.add_option("--inj-vnet", type="int", default=-1,
|
||||||
|
help="Only inject in this vnet (0, 1 or 2).\
|
||||||
|
0 and 1 are 1-flit, 2 is 5-flit.\
|
||||||
|
Set to -1 to inject randomly in all vnets.")
|
||||||
|
|
||||||
#
|
#
|
||||||
# Add the ruby specific and protocol specific options
|
# Add the ruby specific and protocol specific options
|
||||||
|
@ -85,21 +94,24 @@ if args:
|
||||||
print "Error: script doesn't take any positional arguments"
|
print "Error: script doesn't take any positional arguments"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
block_size = 64
|
|
||||||
|
|
||||||
if options.num_cpus > block_size:
|
if options.inj_vnet > 2:
|
||||||
print "Error: Number of cores %d limited to %d because of false sharing" \
|
print "Error: Injection vnet %d should be 0 (1-flit), 1 (1-flit) \
|
||||||
% (options.num_cpus, block_size)
|
or 2 (5-flit) or -1 (random)"\
|
||||||
sys.exit(1)
|
% (options.inj_vnet)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
cpus = [ NetworkTest(fixed_pkts=options.fixed_pkts,
|
cpus = [ GarnetSyntheticTraffic(
|
||||||
max_packets=options.maxpackets,
|
num_packets_max=options.num_packets_max,
|
||||||
|
single_sender=options.single_sender_id,
|
||||||
|
single_dest=options.single_dest_id,
|
||||||
sim_cycles=options.sim_cycles,
|
sim_cycles=options.sim_cycles,
|
||||||
traffic_type=options.synthetic,
|
traffic_type=options.synthetic,
|
||||||
inj_rate=options.injectionrate,
|
inj_rate=options.injectionrate,
|
||||||
|
inj_vnet=options.inj_vnet,
|
||||||
precision=options.precision,
|
precision=options.precision,
|
||||||
num_memories=options.num_dirs) \
|
num_dest=options.num_dirs) \
|
||||||
for i in xrange(options.num_cpus) ]
|
for i in xrange(options.num_cpus) ]
|
||||||
|
|
||||||
# create the desired simulated system
|
# create the desired simulated system
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Advanced Micro Devices, Inc.
|
* Copyright (c) 2016 Georgia Institute of Technology
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -37,8 +37,8 @@
|
||||||
#include "base/misc.hh"
|
#include "base/misc.hh"
|
||||||
#include "base/random.hh"
|
#include "base/random.hh"
|
||||||
#include "base/statistics.hh"
|
#include "base/statistics.hh"
|
||||||
#include "cpu/testers/networktest/networktest.hh"
|
#include "cpu/testers/garnet_synthetic_traffic/GarnetSyntheticTraffic.hh"
|
||||||
#include "debug/NetworkTest.hh"
|
#include "debug/GarnetSyntheticTraffic.hh"
|
||||||
#include "mem/mem_object.hh"
|
#include "mem/mem_object.hh"
|
||||||
#include "mem/packet.hh"
|
#include "mem/packet.hh"
|
||||||
#include "mem/port.hh"
|
#include "mem/port.hh"
|
||||||
|
@ -52,20 +52,20 @@ using namespace std;
|
||||||
int TESTER_NETWORK=0;
|
int TESTER_NETWORK=0;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
NetworkTest::CpuPort::recvTimingResp(PacketPtr pkt)
|
GarnetSyntheticTraffic::CpuPort::recvTimingResp(PacketPtr pkt)
|
||||||
{
|
{
|
||||||
networktest->completeRequest(pkt);
|
tester->completeRequest(pkt);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NetworkTest::CpuPort::recvReqRetry()
|
GarnetSyntheticTraffic::CpuPort::recvReqRetry()
|
||||||
{
|
{
|
||||||
networktest->doRetry();
|
tester->doRetry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NetworkTest::sendPkt(PacketPtr pkt)
|
GarnetSyntheticTraffic::sendPkt(PacketPtr pkt)
|
||||||
{
|
{
|
||||||
if (!cachePort.sendTimingReq(pkt)) {
|
if (!cachePort.sendTimingReq(pkt)) {
|
||||||
retryPkt = pkt; // RubyPort will retry sending
|
retryPkt = pkt; // RubyPort will retry sending
|
||||||
|
@ -73,34 +73,43 @@ NetworkTest::sendPkt(PacketPtr pkt)
|
||||||
numPacketsSent++;
|
numPacketsSent++;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkTest::NetworkTest(const Params *p)
|
GarnetSyntheticTraffic::GarnetSyntheticTraffic(const Params *p)
|
||||||
: MemObject(p),
|
: MemObject(p),
|
||||||
tickEvent(this),
|
tickEvent(this),
|
||||||
cachePort("network-test", this),
|
cachePort("GarnetSyntheticTraffic", this),
|
||||||
retryPkt(NULL),
|
retryPkt(NULL),
|
||||||
size(p->memory_size),
|
size(p->memory_size),
|
||||||
blockSizeBits(p->block_offset),
|
blockSizeBits(p->block_offset),
|
||||||
numMemories(p->num_memories),
|
numDestinations(p->num_dest),
|
||||||
simCycles(p->sim_cycles),
|
simCycles(p->sim_cycles),
|
||||||
fixedPkts(p->fixed_pkts),
|
numPacketsMax(p->num_packets_max),
|
||||||
maxPackets(p->max_packets),
|
|
||||||
numPacketsSent(0),
|
numPacketsSent(0),
|
||||||
|
singleSender(p->single_sender),
|
||||||
|
singleDest(p->single_dest),
|
||||||
trafficType(p->traffic_type),
|
trafficType(p->traffic_type),
|
||||||
injRate(p->inj_rate),
|
injRate(p->inj_rate),
|
||||||
|
injVnet(p->inj_vnet),
|
||||||
precision(p->precision),
|
precision(p->precision),
|
||||||
|
responseLimit(p->response_limit),
|
||||||
masterId(p->system->getMasterId(name()))
|
masterId(p->system->getMasterId(name()))
|
||||||
{
|
{
|
||||||
// set up counters
|
// set up counters
|
||||||
noResponseCycles = 0;
|
noResponseCycles = 0;
|
||||||
schedule(tickEvent, 0);
|
schedule(tickEvent, 0);
|
||||||
|
|
||||||
|
initTrafficType();
|
||||||
|
if (trafficStringToEnum.count(trafficType) == 0) {
|
||||||
|
fatal("Unknown Traffic Type: %s!\n", traffic);
|
||||||
|
}
|
||||||
|
traffic = trafficStringToEnum[trafficType];
|
||||||
|
|
||||||
id = TESTER_NETWORK++;
|
id = TESTER_NETWORK++;
|
||||||
DPRINTF(NetworkTest,"Config Created: Name = %s , and id = %d\n",
|
DPRINTF(GarnetSyntheticTraffic,"Config Created: Name = %s , and id = %d\n",
|
||||||
name(), id);
|
name(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseMasterPort &
|
BaseMasterPort &
|
||||||
NetworkTest::getMasterPort(const std::string &if_name, PortID idx)
|
GarnetSyntheticTraffic::getMasterPort(const std::string &if_name, PortID idx)
|
||||||
{
|
{
|
||||||
if (if_name == "test")
|
if (if_name == "test")
|
||||||
return cachePort;
|
return cachePort;
|
||||||
|
@ -109,18 +118,19 @@ NetworkTest::getMasterPort(const std::string &if_name, PortID idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NetworkTest::init()
|
GarnetSyntheticTraffic::init()
|
||||||
{
|
{
|
||||||
numPacketsSent = 0;
|
numPacketsSent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NetworkTest::completeRequest(PacketPtr pkt)
|
GarnetSyntheticTraffic::completeRequest(PacketPtr pkt)
|
||||||
{
|
{
|
||||||
Request *req = pkt->req;
|
Request *req = pkt->req;
|
||||||
|
|
||||||
DPRINTF(NetworkTest, "Completed injection of %s packet for address %x\n",
|
DPRINTF(GarnetSyntheticTraffic,
|
||||||
|
"Completed injection of %s packet for address %x\n",
|
||||||
pkt->isWrite() ? "write" : "read\n",
|
pkt->isWrite() ? "write" : "read\n",
|
||||||
req->getPaddr());
|
req->getPaddr());
|
||||||
|
|
||||||
|
@ -132,34 +142,36 @@ NetworkTest::completeRequest(PacketPtr pkt)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NetworkTest::tick()
|
GarnetSyntheticTraffic::tick()
|
||||||
{
|
{
|
||||||
if (++noResponseCycles >= 500000) {
|
if (++noResponseCycles >= responseLimit) {
|
||||||
cerr << name() << ": deadlocked at cycle " << curTick() << endl;
|
fatal("%s deadlocked at cycle %d\n", name(), curTick());
|
||||||
fatal("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// make new request based on injection rate
|
// make new request based on injection rate
|
||||||
// (injection rate's range depends on precision)
|
// (injection rate's range depends on precision)
|
||||||
// - generate a random number between 0 and 10^precision
|
// - generate a random number between 0 and 10^precision
|
||||||
// - send pkt if this number is < injRate*(10^precision)
|
// - send pkt if this number is < injRate*(10^precision)
|
||||||
bool send_this_cycle;
|
bool sendAllowedThisCycle;
|
||||||
double injRange = pow((double) 10, (double) precision);
|
double injRange = pow((double) 10, (double) precision);
|
||||||
unsigned trySending = random_mt.random<unsigned>(0, (int) injRange);
|
unsigned trySending = random_mt.random<unsigned>(0, (int) injRange);
|
||||||
if (trySending < injRate*injRange)
|
if (trySending < injRate*injRange)
|
||||||
send_this_cycle = true;
|
sendAllowedThisCycle = true;
|
||||||
else
|
else
|
||||||
send_this_cycle = false;
|
sendAllowedThisCycle = false;
|
||||||
|
|
||||||
// always generatePkt unless fixedPkts is enabled
|
// always generatePkt unless fixedPkts or singleSender is enabled
|
||||||
if (send_this_cycle) {
|
if (sendAllowedThisCycle) {
|
||||||
if (fixedPkts) {
|
bool senderEnable = true;
|
||||||
if (numPacketsSent < maxPackets) {
|
|
||||||
generatePkt();
|
if (numPacketsMax >= 0 && numPacketsSent >= numPacketsMax)
|
||||||
}
|
senderEnable = false;
|
||||||
} else {
|
|
||||||
|
if (singleSender >= 0 && id != singleSender)
|
||||||
|
senderEnable = false;
|
||||||
|
|
||||||
|
if (senderEnable)
|
||||||
generatePkt();
|
generatePkt();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schedule wakeup
|
// Schedule wakeup
|
||||||
|
@ -172,30 +184,64 @@ NetworkTest::tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NetworkTest::generatePkt()
|
GarnetSyntheticTraffic::generatePkt()
|
||||||
{
|
{
|
||||||
|
int num_destinations = numDestinations;
|
||||||
|
int radix = (int) sqrt(num_destinations);
|
||||||
unsigned destination = id;
|
unsigned destination = id;
|
||||||
if (trafficType == 0) { // Uniform Random
|
int dest_x = -1;
|
||||||
destination = random_mt.random<unsigned>(0, numMemories - 1);
|
int dest_y = -1;
|
||||||
} else if (trafficType == 1) { // Tornado
|
int source = id;
|
||||||
int networkDimension = (int) sqrt(numMemories);
|
int src_x = id%radix;
|
||||||
int my_x = id%networkDimension;
|
int src_y = id/radix;
|
||||||
int my_y = id/networkDimension;
|
|
||||||
|
|
||||||
int dest_x = my_x + (int) ceil(networkDimension/2) - 1;
|
if (singleDest >= 0)
|
||||||
dest_x = dest_x%networkDimension;
|
{
|
||||||
int dest_y = my_y;
|
destination = singleDest;
|
||||||
|
} else if (traffic == UNIFORM_RANDOM_) {
|
||||||
|
destination = random_mt.random<unsigned>(0, num_destinations - 1);
|
||||||
|
} else if (traffic == BIT_COMPLEMENT_) {
|
||||||
|
dest_x = radix - src_x - 1;
|
||||||
|
dest_y = radix - src_y - 1;
|
||||||
|
destination = dest_y*radix + dest_x;
|
||||||
|
} else if (traffic == BIT_REVERSE_) {
|
||||||
|
unsigned int straight = source;
|
||||||
|
unsigned int reverse = source & 1; // LSB
|
||||||
|
|
||||||
destination = dest_y*networkDimension + dest_x;
|
int num_bits = (int) log2(num_destinations);
|
||||||
} else if (trafficType == 2) { // Bit Complement
|
|
||||||
int networkDimension = (int) sqrt(numMemories);
|
|
||||||
int my_x = id%networkDimension;
|
|
||||||
int my_y = id/networkDimension;
|
|
||||||
|
|
||||||
int dest_x = networkDimension - my_x - 1;
|
for (int i = 1; i < num_bits; i++)
|
||||||
int dest_y = networkDimension - my_y - 1;
|
{
|
||||||
|
reverse <<= 1;
|
||||||
destination = dest_y*networkDimension + dest_x;
|
straight >>= 1;
|
||||||
|
reverse |= (straight & 1); // LSB
|
||||||
|
}
|
||||||
|
destination = reverse;
|
||||||
|
} else if (traffic == BIT_ROTATION_) {
|
||||||
|
if (source%2 == 0)
|
||||||
|
destination = source/2;
|
||||||
|
else // (source%2 == 1)
|
||||||
|
destination = ((source/2) + (num_destinations/2));
|
||||||
|
} else if (traffic == NEIGHBOR_) {
|
||||||
|
dest_x = (src_x + 1) % radix;
|
||||||
|
dest_y = src_y;
|
||||||
|
destination = dest_y*radix + dest_x;
|
||||||
|
} else if (traffic == SHUFFLE_) {
|
||||||
|
if (source < num_destinations/2)
|
||||||
|
destination = source*2;
|
||||||
|
else
|
||||||
|
destination = (source*2 - num_destinations + 1);
|
||||||
|
} else if (traffic == TRANSPOSE_) {
|
||||||
|
dest_x = src_y;
|
||||||
|
dest_y = src_x;
|
||||||
|
destination = dest_y*radix + dest_x;
|
||||||
|
} else if (traffic == TORNADO_) {
|
||||||
|
dest_x = (src_x + (int) ceil(radix/2) - 1) % radix;
|
||||||
|
dest_y = src_y;
|
||||||
|
destination = dest_y*radix + dest_x;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fatal("Unknown Traffic Type: %s!\n", traffic);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The source of the packets is a cache.
|
// The source of the packets is a cache.
|
||||||
|
@ -207,7 +253,7 @@ NetworkTest::generatePkt()
|
||||||
|
|
||||||
// Modeling different coherence msg types over different msg classes.
|
// Modeling different coherence msg types over different msg classes.
|
||||||
//
|
//
|
||||||
// networktest assumes the Network_test coherence protocol
|
// GarnetSyntheticTraffic assumes the Garnet_standalone coherence protocol
|
||||||
// which models three message classes/virtual networks.
|
// which models three message classes/virtual networks.
|
||||||
// These are: request, forward, response.
|
// These are: request, forward, response.
|
||||||
// requests and forwards are "control" packets (typically 8 bytes),
|
// requests and forwards are "control" packets (typically 8 bytes),
|
||||||
|
@ -234,18 +280,28 @@ NetworkTest::generatePkt()
|
||||||
Request *req = nullptr;
|
Request *req = nullptr;
|
||||||
Request::Flags flags;
|
Request::Flags flags;
|
||||||
|
|
||||||
unsigned randomReqType = random_mt.random(0, 2);
|
// Inject in specific Vnet
|
||||||
if (randomReqType == 0) {
|
// Vnet 0 and 1 are for control packets (1-flit)
|
||||||
|
// Vnet 2 is for data packets (5-flit)
|
||||||
|
int injReqType = injVnet;
|
||||||
|
|
||||||
|
if (injReqType < 0 || injReqType > 2)
|
||||||
|
{
|
||||||
|
// randomly inject in any vnet
|
||||||
|
injReqType = random_mt.random(0, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (injReqType == 0) {
|
||||||
// generate packet for virtual network 0
|
// generate packet for virtual network 0
|
||||||
requestType = MemCmd::ReadReq;
|
requestType = MemCmd::ReadReq;
|
||||||
req = new Request(paddr, access_size, flags, masterId);
|
req = new Request(paddr, access_size, flags, masterId);
|
||||||
} else if (randomReqType == 1) {
|
} else if (injReqType == 1) {
|
||||||
// generate packet for virtual network 1
|
// generate packet for virtual network 1
|
||||||
requestType = MemCmd::ReadReq;
|
requestType = MemCmd::ReadReq;
|
||||||
flags.set(Request::INST_FETCH);
|
flags.set(Request::INST_FETCH);
|
||||||
req = new Request(0, 0x0, access_size, flags, masterId, 0x0, 0);
|
req = new Request(0, 0x0, access_size, flags, masterId, 0x0, 0);
|
||||||
req->setPaddr(paddr);
|
req->setPaddr(paddr);
|
||||||
} else { // if (randomReqType == 2)
|
} else { // if (injReqType == 2)
|
||||||
// generate packet for virtual network 2
|
// generate packet for virtual network 2
|
||||||
requestType = MemCmd::WriteReq;
|
requestType = MemCmd::WriteReq;
|
||||||
req = new Request(paddr, access_size, flags, masterId);
|
req = new Request(paddr, access_size, flags, masterId);
|
||||||
|
@ -256,7 +312,7 @@ NetworkTest::generatePkt()
|
||||||
//No need to do functional simulation
|
//No need to do functional simulation
|
||||||
//We just do timing simulation of the network
|
//We just do timing simulation of the network
|
||||||
|
|
||||||
DPRINTF(NetworkTest,
|
DPRINTF(GarnetSyntheticTraffic,
|
||||||
"Generated packet with destination %d, embedded in address %x\n",
|
"Generated packet with destination %d, embedded in address %x\n",
|
||||||
destination, req->getPaddr());
|
destination, req->getPaddr());
|
||||||
|
|
||||||
|
@ -268,7 +324,20 @@ NetworkTest::generatePkt()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NetworkTest::doRetry()
|
GarnetSyntheticTraffic::initTrafficType()
|
||||||
|
{
|
||||||
|
trafficStringToEnum["bit_complement"] = BIT_COMPLEMENT_;
|
||||||
|
trafficStringToEnum["bit_reverse"] = BIT_REVERSE_;
|
||||||
|
trafficStringToEnum["bit_rotation"] = BIT_ROTATION_;
|
||||||
|
trafficStringToEnum["neighbor"] = NEIGHBOR_;
|
||||||
|
trafficStringToEnum["shuffle"] = SHUFFLE_;
|
||||||
|
trafficStringToEnum["tornado"] = TORNADO_;
|
||||||
|
trafficStringToEnum["transpose"] = TRANSPOSE_;
|
||||||
|
trafficStringToEnum["uniform_random"] = UNIFORM_RANDOM_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GarnetSyntheticTraffic::doRetry()
|
||||||
{
|
{
|
||||||
if (cachePort.sendTimingReq(retryPkt)) {
|
if (cachePort.sendTimingReq(retryPkt)) {
|
||||||
retryPkt = NULL;
|
retryPkt = NULL;
|
||||||
|
@ -276,14 +345,14 @@ NetworkTest::doRetry()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NetworkTest::printAddr(Addr a)
|
GarnetSyntheticTraffic::printAddr(Addr a)
|
||||||
{
|
{
|
||||||
cachePort.printAddr(a);
|
cachePort.printAddr(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NetworkTest *
|
GarnetSyntheticTraffic *
|
||||||
NetworkTestParams::create()
|
GarnetSyntheticTrafficParams::create()
|
||||||
{
|
{
|
||||||
return new NetworkTest(this);
|
return new GarnetSyntheticTraffic(this);
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Advanced Micro Devices, Inc.
|
* Copyright (c) 2016 Georgia Institute of Technology
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -28,26 +28,36 @@
|
||||||
* Authors: Tushar Krishna
|
* Authors: Tushar Krishna
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CPU_NETWORKTEST_NETWORKTEST_HH__
|
#ifndef __CPU_GARNET_SYNTHETIC_TRAFFIC_HH__
|
||||||
#define __CPU_NETWORKTEST_NETWORKTEST_HH__
|
#define __CPU_GARNET_SYNTHETIC_TRAFFIC_HH__
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "base/statistics.hh"
|
#include "base/statistics.hh"
|
||||||
#include "mem/mem_object.hh"
|
#include "mem/mem_object.hh"
|
||||||
#include "mem/port.hh"
|
#include "mem/port.hh"
|
||||||
#include "params/NetworkTest.hh"
|
#include "params/GarnetSyntheticTraffic.hh"
|
||||||
#include "sim/eventq.hh"
|
#include "sim/eventq.hh"
|
||||||
#include "sim/sim_exit.hh"
|
#include "sim/sim_exit.hh"
|
||||||
#include "sim/sim_object.hh"
|
#include "sim/sim_object.hh"
|
||||||
#include "sim/stats.hh"
|
#include "sim/stats.hh"
|
||||||
|
|
||||||
|
enum TrafficType {BIT_COMPLEMENT_ = 0,
|
||||||
|
BIT_REVERSE_ = 1,
|
||||||
|
BIT_ROTATION_ = 2,
|
||||||
|
NEIGHBOR_ = 3,
|
||||||
|
SHUFFLE_ = 4,
|
||||||
|
TORNADO_ = 5,
|
||||||
|
TRANSPOSE_ = 6,
|
||||||
|
UNIFORM_RANDOM_ = 7,
|
||||||
|
NUM_TRAFFIC_PATTERNS_};
|
||||||
|
|
||||||
class Packet;
|
class Packet;
|
||||||
class NetworkTest : public MemObject
|
class GarnetSyntheticTraffic : public MemObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef NetworkTestParams Params;
|
typedef GarnetSyntheticTrafficParams Params;
|
||||||
NetworkTest(const Params *p);
|
GarnetSyntheticTraffic(const Params *p);
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
|
@ -67,24 +77,27 @@ class NetworkTest : public MemObject
|
||||||
class TickEvent : public Event
|
class TickEvent : public Event
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
NetworkTest *cpu;
|
GarnetSyntheticTraffic *cpu;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TickEvent(NetworkTest *c) : Event(CPU_Tick_Pri), cpu(c) {}
|
TickEvent(GarnetSyntheticTraffic *c) : Event(CPU_Tick_Pri), cpu(c) {}
|
||||||
void process() { cpu->tick(); }
|
void process() { cpu->tick(); }
|
||||||
virtual const char *description() const { return "NetworkTest tick"; }
|
virtual const char *description() const
|
||||||
|
{
|
||||||
|
return "GarnetSyntheticTraffic tick";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TickEvent tickEvent;
|
TickEvent tickEvent;
|
||||||
|
|
||||||
class CpuPort : public MasterPort
|
class CpuPort : public MasterPort
|
||||||
{
|
{
|
||||||
NetworkTest *networktest;
|
GarnetSyntheticTraffic *tester;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CpuPort(const std::string &_name, NetworkTest *_networktest)
|
CpuPort(const std::string &_name, GarnetSyntheticTraffic *_tester)
|
||||||
: MasterPort(_name, _networktest), networktest(_networktest)
|
: MasterPort(_name, _tester), tester(_tester)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -96,11 +109,11 @@ class NetworkTest : public MemObject
|
||||||
|
|
||||||
CpuPort cachePort;
|
CpuPort cachePort;
|
||||||
|
|
||||||
class NetworkTestSenderState : public Packet::SenderState
|
class GarnetSyntheticTrafficSenderState : public Packet::SenderState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Constructor. */
|
/** Constructor. */
|
||||||
NetworkTestSenderState(uint8_t *_data)
|
GarnetSyntheticTrafficSenderState(uint8_t *_data)
|
||||||
: data(_data)
|
: data(_data)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -112,33 +125,41 @@ class NetworkTest : public MemObject
|
||||||
unsigned size;
|
unsigned size;
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
|
std::map<std::string, TrafficType> trafficStringToEnum;
|
||||||
|
|
||||||
unsigned blockSizeBits;
|
unsigned blockSizeBits;
|
||||||
|
|
||||||
Tick noResponseCycles;
|
Tick noResponseCycles;
|
||||||
|
|
||||||
int numMemories;
|
int numDestinations;
|
||||||
Tick simCycles;
|
Tick simCycles;
|
||||||
bool fixedPkts;
|
int numPacketsMax;
|
||||||
int maxPackets;
|
|
||||||
int numPacketsSent;
|
int numPacketsSent;
|
||||||
|
int singleSender;
|
||||||
|
int singleDest;
|
||||||
|
|
||||||
int trafficType;
|
std::string trafficType; // string
|
||||||
|
TrafficType traffic; // enum from string
|
||||||
double injRate;
|
double injRate;
|
||||||
|
int injVnet;
|
||||||
int precision;
|
int precision;
|
||||||
|
|
||||||
|
const Cycles responseLimit;
|
||||||
|
|
||||||
MasterID masterId;
|
MasterID masterId;
|
||||||
|
|
||||||
void completeRequest(PacketPtr pkt);
|
void completeRequest(PacketPtr pkt);
|
||||||
|
|
||||||
void generatePkt();
|
void generatePkt();
|
||||||
void sendPkt(PacketPtr pkt);
|
void sendPkt(PacketPtr pkt);
|
||||||
|
void initTrafficType();
|
||||||
|
|
||||||
void doRetry();
|
void doRetry();
|
||||||
|
|
||||||
friend class MemCompleteEvent;
|
friend class MemCompleteEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __CPU_NETWORKTEST_NETWORKTEST_HH__
|
#endif // __CPU_GARNET_SYNTHETIC_TRAFFIC_HH__
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2009 Advanced Micro Devices, Inc.
|
# Copyright (c) 2016 Georgia Institute of Technology
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -30,17 +30,28 @@ from MemObject import MemObject
|
||||||
from m5.params import *
|
from m5.params import *
|
||||||
from m5.proxy import *
|
from m5.proxy import *
|
||||||
|
|
||||||
class NetworkTest(MemObject):
|
class GarnetSyntheticTraffic(MemObject):
|
||||||
type = 'NetworkTest'
|
type = 'GarnetSyntheticTraffic'
|
||||||
cxx_header = "cpu/testers/networktest/networktest.hh"
|
cxx_header = \
|
||||||
|
"cpu/testers/garnet_synthetic_traffic/GarnetSyntheticTraffic.hh"
|
||||||
block_offset = Param.Int(6, "block offset in bits")
|
block_offset = Param.Int(6, "block offset in bits")
|
||||||
num_memories = Param.Int(1, "Num Memories")
|
num_dest = Param.Int(1, "Number of Destinations")
|
||||||
memory_size = Param.Int(65536, "memory size")
|
memory_size = Param.Int(65536, "memory size")
|
||||||
sim_cycles = Param.Int(1000, "Number of simulation cycles")
|
sim_cycles = Param.Int(1000, "Number of simulation cycles")
|
||||||
fixed_pkts = Param.Bool(False, "Send fixed number of packets")
|
num_packets_max = Param.Int(-1, "Max number of packets to send. \
|
||||||
max_packets = Param.Counter(0, "Number of packets to send when in fixed_pkts mode")
|
Default is to keep sending till simulation ends")
|
||||||
traffic_type = Param.Counter(0, "Traffic type: uniform random, tornado, bit complement")
|
single_sender = Param.Int(-1, "Send only from this node. \
|
||||||
|
By default every node sends")
|
||||||
|
single_dest = Param.Int(-1, "Send only to this dest. \
|
||||||
|
Default depends on traffic_type")
|
||||||
|
traffic_type = Param.String("uniform_random", "Traffic type")
|
||||||
inj_rate = Param.Float(0.1, "Packet injection rate")
|
inj_rate = Param.Float(0.1, "Packet injection rate")
|
||||||
precision = Param.Int(3, "Number of digits of precision after decimal point")
|
inj_vnet = Param.Int(-1, "Vnet to inject in. \
|
||||||
|
0 and 1 are 1-flit, 2 is 5-flit. \
|
||||||
|
Default is to inject in all three vnets")
|
||||||
|
precision = Param.Int(3, "Number of digits of precision \
|
||||||
|
after decimal point")
|
||||||
|
response_limit = Param.Cycles(5000000, "Cycles before exiting \
|
||||||
|
due to lack of progress")
|
||||||
test = MasterPort("Port to the memory system to test")
|
test = MasterPort("Port to the memory system to test")
|
||||||
system = Param.System(Parent.any, "System we belong to")
|
system = Param.System(Parent.any, "System we belong to")
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- mode:python -*-
|
# -*- mode:python -*-
|
||||||
|
|
||||||
# Copyright (c) 2009 Advanced Micro Devices, Inc.
|
# Copyright (c) 2016 Georgia Institute of Technology.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -30,8 +30,8 @@
|
||||||
|
|
||||||
Import('*')
|
Import('*')
|
||||||
|
|
||||||
SimObject('NetworkTest.py')
|
SimObject('GarnetSyntheticTraffic.py')
|
||||||
|
|
||||||
Source('networktest.cc')
|
Source('GarnetSyntheticTraffic.cc')
|
||||||
|
|
||||||
DebugFlag('NetworkTest')
|
DebugFlag('GarnetSyntheticTraffic')
|
Loading…
Reference in a new issue