2007-07-01 02:59:45 +02:00
|
|
|
# Copyright (c) 2006-2007 The Regents of The University of Michigan
|
2006-11-13 22:09:47 +01:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are
|
|
|
|
# met: redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer;
|
|
|
|
# redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution;
|
|
|
|
# neither the name of the copyright holders nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived from
|
|
|
|
# this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
# Authors: Ron Dreslinski
|
|
|
|
|
|
|
|
# Simple test script
|
|
|
|
#
|
|
|
|
# "m5 test.py"
|
|
|
|
|
2009-09-23 00:24:16 +02:00
|
|
|
import os
|
|
|
|
import optparse
|
|
|
|
import sys
|
|
|
|
|
2006-11-13 22:09:47 +01:00
|
|
|
import m5
|
|
|
|
from m5.objects import *
|
2009-09-23 00:24:16 +02:00
|
|
|
|
|
|
|
m5.util.addToPath('../common')
|
2006-11-13 22:09:47 +01:00
|
|
|
|
|
|
|
# --------------------
|
|
|
|
# Define Command Line Options
|
|
|
|
# ====================
|
|
|
|
|
|
|
|
parser = optparse.OptionParser()
|
|
|
|
|
|
|
|
parser.add_option("-d", "--detailed", action="store_true")
|
|
|
|
parser.add_option("-t", "--timing", action="store_true")
|
|
|
|
parser.add_option("-m", "--maxtick", type="int")
|
|
|
|
parser.add_option("-c", "--numclusters",
|
|
|
|
help="Number of clusters", type="int")
|
|
|
|
parser.add_option("-n", "--numcpus",
|
|
|
|
help="Number of cpus in total", type="int")
|
|
|
|
parser.add_option("-f", "--frequency",
|
|
|
|
default = "1GHz",
|
|
|
|
help="Frequency of each CPU")
|
|
|
|
parser.add_option("--l1size",
|
|
|
|
default = "32kB")
|
|
|
|
parser.add_option("--l1latency",
|
|
|
|
default = 1)
|
|
|
|
parser.add_option("--l2size",
|
|
|
|
default = "256kB")
|
|
|
|
parser.add_option("--l2latency",
|
|
|
|
default = 10)
|
|
|
|
parser.add_option("--rootdir",
|
|
|
|
help="ROot directory of Splash2",
|
|
|
|
default="/dist/splash2/codes/")
|
|
|
|
parser.add_option("-b", "--benchmark",
|
|
|
|
help="Splash 2 benchmark to run")
|
|
|
|
|
|
|
|
(options, args) = parser.parse_args()
|
|
|
|
|
|
|
|
if args:
|
|
|
|
print "Error: script doesn't take any positional arguments"
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
# --------------------
|
|
|
|
# Define Splash2 Benchmarks
|
|
|
|
# ====================
|
|
|
|
class Cholesky(LiveProcess):
|
|
|
|
executable = options.rootdir + '/kernels/cholesky/CHOLESKY'
|
|
|
|
cmd = 'CHOLESKY -p' + str(options.numcpus) + ' '\
|
|
|
|
+ options.rootdir + '/kernels/cholesky/inputs/tk23.O'
|
|
|
|
|
|
|
|
class FFT(LiveProcess):
|
|
|
|
executable = options.rootdir + 'kernels/fft/FFT'
|
|
|
|
cmd = 'FFT -p' + str(options.numcpus) + ' -m18'
|
|
|
|
|
|
|
|
class LU_contig(LiveProcess):
|
|
|
|
executable = options.rootdir + 'kernels/lu/contiguous_blocks/LU'
|
|
|
|
cmd = 'LU -p' + str(options.numcpus)
|
|
|
|
|
|
|
|
class LU_noncontig(LiveProcess):
|
|
|
|
executable = options.rootdir + 'kernels/lu/non_contiguous_blocks/LU'
|
|
|
|
cmd = 'LU -p' + str(options.numcpus)
|
|
|
|
|
|
|
|
class Radix(LiveProcess):
|
|
|
|
executable = options.rootdir + 'kernels/radix/RADIX'
|
|
|
|
cmd = 'RADIX -n524288 -p' + str(options.numcpus)
|
|
|
|
|
|
|
|
class Barnes(LiveProcess):
|
|
|
|
executable = options.rootdir + 'apps/barnes/BARNES'
|
|
|
|
cmd = 'BARNES'
|
|
|
|
input = options.rootdir + 'apps/barnes/input.p' + str(options.numcpus)
|
|
|
|
|
|
|
|
class FMM(LiveProcess):
|
|
|
|
executable = options.rootdir + 'apps/fmm/FMM'
|
|
|
|
cmd = 'FMM'
|
|
|
|
input = options.rootdir + 'apps/fmm/inputs/input.2048.p' + str(options.numcpus)
|
|
|
|
|
|
|
|
class Ocean_contig(LiveProcess):
|
|
|
|
executable = options.rootdir + 'apps/ocean/contiguous_partitions/OCEAN'
|
|
|
|
cmd = 'OCEAN -p' + str(options.numcpus)
|
|
|
|
|
|
|
|
class Ocean_noncontig(LiveProcess):
|
|
|
|
executable = options.rootdir + 'apps/ocean/non_contiguous_partitions/OCEAN'
|
|
|
|
cmd = 'OCEAN -p' + str(options.numcpus)
|
|
|
|
|
|
|
|
class Raytrace(LiveProcess):
|
|
|
|
executable = options.rootdir + 'apps/raytrace/RAYTRACE'
|
|
|
|
cmd = 'RAYTRACE -p' + str(options.numcpus) + ' ' \
|
|
|
|
+ options.rootdir + 'apps/raytrace/inputs/teapot.env'
|
|
|
|
|
|
|
|
class Water_nsquared(LiveProcess):
|
|
|
|
executable = options.rootdir + 'apps/water-nsquared/WATER-NSQUARED'
|
|
|
|
cmd = 'WATER-NSQUARED'
|
|
|
|
input = options.rootdir + 'apps/water-nsquared/input.p' + str(options.numcpus)
|
|
|
|
|
|
|
|
class Water_spatial(LiveProcess):
|
|
|
|
executable = options.rootdir + 'apps/water-spatial/WATER-SPATIAL'
|
|
|
|
cmd = 'WATER-SPATIAL'
|
|
|
|
input = options.rootdir + 'apps/water-spatial/input.p' + str(options.numcpus)
|
|
|
|
|
|
|
|
|
|
|
|
# --------------------
|
|
|
|
# Base L1 Cache Definition
|
|
|
|
# ====================
|
|
|
|
|
|
|
|
class L1(BaseCache):
|
|
|
|
latency = options.l1latency
|
|
|
|
mshrs = 12
|
|
|
|
tgts_per_mshr = 8
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Base L2 Cache Definition
|
|
|
|
# ----------------------
|
|
|
|
|
|
|
|
class L2(BaseCache):
|
|
|
|
latency = options.l2latency
|
|
|
|
mshrs = 92
|
|
|
|
tgts_per_mshr = 16
|
|
|
|
write_buffers = 8
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Define the clusters with their cpus
|
|
|
|
# ----------------------
|
|
|
|
class Cluster:
|
|
|
|
pass
|
|
|
|
|
|
|
|
cpusPerCluster = options.numcpus/options.numclusters
|
|
|
|
|
|
|
|
busFrequency = Frequency(options.frequency)
|
|
|
|
busFrequency *= cpusPerCluster
|
|
|
|
|
|
|
|
all_cpus = []
|
|
|
|
all_l1s = []
|
|
|
|
all_l1buses = []
|
|
|
|
if options.timing:
|
|
|
|
clusters = [ Cluster() for i in xrange(options.numclusters)]
|
|
|
|
for j in xrange(options.numclusters):
|
|
|
|
clusters[j].id = j
|
|
|
|
for cluster in clusters:
|
2015-03-02 10:00:47 +01:00
|
|
|
cluster.clusterbus = L2XBar(clock=busFrequency)
|
2006-11-13 22:09:47 +01:00
|
|
|
all_l1buses += [cluster.clusterbus]
|
|
|
|
cluster.cpus = [TimingSimpleCPU(cpu_id = i + cluster.id,
|
|
|
|
clock=options.frequency)
|
|
|
|
for i in xrange(cpusPerCluster)]
|
|
|
|
all_cpus += cluster.cpus
|
|
|
|
cluster.l1 = L1(size=options.l1size, assoc = 4)
|
|
|
|
all_l1s += [cluster.l1]
|
|
|
|
elif options.detailed:
|
|
|
|
clusters = [ Cluster() for i in xrange(options.numclusters)]
|
|
|
|
for j in xrange(options.numclusters):
|
|
|
|
clusters[j].id = j
|
|
|
|
for cluster in clusters:
|
2015-03-02 10:00:47 +01:00
|
|
|
cluster.clusterbus = L2XBar(clock=busFrequency)
|
2006-11-13 22:09:47 +01:00
|
|
|
all_l1buses += [cluster.clusterbus]
|
|
|
|
cluster.cpus = [DerivO3CPU(cpu_id = i + cluster.id,
|
|
|
|
clock=options.frequency)
|
|
|
|
for i in xrange(cpusPerCluster)]
|
|
|
|
all_cpus += cluster.cpus
|
|
|
|
cluster.l1 = L1(size=options.l1size, assoc = 4)
|
|
|
|
all_l1s += [cluster.l1]
|
|
|
|
else:
|
|
|
|
clusters = [ Cluster() for i in xrange(options.numclusters)]
|
|
|
|
for j in xrange(options.numclusters):
|
|
|
|
clusters[j].id = j
|
|
|
|
for cluster in clusters:
|
2015-03-02 10:00:47 +01:00
|
|
|
cluster.clusterbus = L2XBar(clock=busFrequency)
|
2006-11-13 22:09:47 +01:00
|
|
|
all_l1buses += [cluster.clusterbus]
|
|
|
|
cluster.cpus = [AtomicSimpleCPU(cpu_id = i + cluster.id,
|
|
|
|
clock=options.frequency)
|
|
|
|
for i in xrange(cpusPerCluster)]
|
|
|
|
all_cpus += cluster.cpus
|
|
|
|
cluster.l1 = L1(size=options.l1size, assoc = 4)
|
|
|
|
all_l1s += [cluster.l1]
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Create a system, and add system wide objects
|
|
|
|
# ----------------------
|
2012-04-06 19:46:31 +02:00
|
|
|
system = System(cpu = all_cpus, l1_ = all_l1s, l1bus_ = all_l1buses,
|
Bus: Split the bus into a non-coherent and coherent bus
This patch introduces a class hierarchy of buses, a non-coherent one,
and a coherent one, splitting the existing bus functionality. By doing
so it also enables further specialisation of the two types of buses.
A non-coherent bus connects a number of non-snooping masters and
slaves, and routes the request and response packets based on the
address. The request packets issued by the master connected to a
non-coherent bus could still snoop in caches attached to a coherent
bus, as is the case with the I/O bus and memory bus in most system
configurations. No snoops will, however, reach any master on the
non-coherent bus itself. The non-coherent bus can be used as a
template for modelling PCI, PCIe, and non-coherent AMBA and OCP buses,
and is typically used for the I/O buses.
A coherent bus connects a number of (potentially) snooping masters and
slaves, and routes the request and response packets based on the
address, and also forwards all requests to the snoopers and deals with
the snoop responses. The coherent bus can be used as a template for
modelling QPI, HyperTransport, ACE and coherent OCP buses, and is
typically used for the L1-to-L2 buses and as the main system
interconnect.
The configuration scripts are updated to use a NoncoherentBus for all
peripheral and I/O buses.
A bit of minor tidying up has also been done.
--HG--
rename : src/mem/bus.cc => src/mem/coherent_bus.cc
rename : src/mem/bus.hh => src/mem/coherent_bus.hh
rename : src/mem/bus.cc => src/mem/noncoherent_bus.cc
rename : src/mem/bus.hh => src/mem/noncoherent_bus.hh
2012-05-31 19:30:04 +02:00
|
|
|
physmem = SimpleMemory(),
|
2015-03-02 10:00:47 +01:00
|
|
|
membus = SystemXBar(clock = busFrequency))
|
2013-06-27 11:49:49 +02:00
|
|
|
system.clock = '1GHz'
|
2006-11-13 22:09:47 +01:00
|
|
|
|
2015-03-02 10:00:47 +01:00
|
|
|
system.toL2bus = L2XBar(clock = busFrequency)
|
2006-11-13 22:09:47 +01:00
|
|
|
system.l2 = L2(size = options.l2size, assoc = 8)
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Connect the L2 cache and memory together
|
|
|
|
# ----------------------
|
|
|
|
|
2012-02-14 20:15:30 +01:00
|
|
|
system.physmem.port = system.membus.master
|
|
|
|
system.l2.cpu_side = system.toL2bus.slave
|
|
|
|
system.l2.mem_side = system.membus.master
|
2006-11-13 22:09:47 +01:00
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Connect the L2 cache and clusters together
|
|
|
|
# ----------------------
|
|
|
|
for cluster in clusters:
|
2012-02-14 20:15:30 +01:00
|
|
|
cluster.l1.cpu_side = cluster.clusterbus.master
|
|
|
|
cluster.l1.mem_side = system.toL2bus.slave
|
2006-11-13 22:09:47 +01:00
|
|
|
for cpu in cluster.cpus:
|
2012-02-14 20:15:30 +01:00
|
|
|
cpu.icache_port = cluster.clusterbus.slave
|
|
|
|
cpu.dcache_port = cluster.clusterbus.slave
|
2006-11-13 22:09:47 +01:00
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Define the root
|
|
|
|
# ----------------------
|
|
|
|
|
2012-01-28 16:24:34 +01:00
|
|
|
root = Root(full_system = False, system = system)
|
2006-11-13 22:09:47 +01:00
|
|
|
|
|
|
|
# --------------------
|
|
|
|
# Pick the correct Splash2 Benchmarks
|
|
|
|
# ====================
|
|
|
|
if options.benchmark == 'Cholesky':
|
|
|
|
root.workload = Cholesky()
|
|
|
|
elif options.benchmark == 'FFT':
|
|
|
|
root.workload = FFT()
|
|
|
|
elif options.benchmark == 'LUContig':
|
|
|
|
root.workload = LU_contig()
|
|
|
|
elif options.benchmark == 'LUNoncontig':
|
|
|
|
root.workload = LU_noncontig()
|
|
|
|
elif options.benchmark == 'Radix':
|
|
|
|
root.workload = Radix()
|
|
|
|
elif options.benchmark == 'Barnes':
|
|
|
|
root.workload = Barnes()
|
|
|
|
elif options.benchmark == 'FMM':
|
|
|
|
root.workload = FMM()
|
|
|
|
elif options.benchmark == 'OceanContig':
|
|
|
|
root.workload = Ocean_contig()
|
|
|
|
elif options.benchmark == 'OceanNoncontig':
|
|
|
|
root.workload = Ocean_noncontig()
|
|
|
|
elif options.benchmark == 'Raytrace':
|
|
|
|
root.workload = Raytrace()
|
|
|
|
elif options.benchmark == 'WaterNSquared':
|
|
|
|
root.workload = Water_nsquared()
|
|
|
|
elif options.benchmark == 'WaterSpatial':
|
|
|
|
root.workload = Water_spatial()
|
|
|
|
else:
|
2009-09-23 00:24:16 +02:00
|
|
|
m5.util.panic("""
|
|
|
|
The --benchmark environment variable was set to something improper.
|
|
|
|
Use Cholesky, FFT, LUContig, LUNoncontig, Radix, Barnes, FMM, OceanContig,
|
|
|
|
OceanNoncontig, Raytrace, WaterNSquared, or WaterSpatial
|
|
|
|
""")
|
2006-11-13 22:09:47 +01:00
|
|
|
|
|
|
|
# --------------------
|
|
|
|
# Assign the workload to the cpus
|
|
|
|
# ====================
|
|
|
|
|
|
|
|
for cluster in clusters:
|
|
|
|
for cpu in cluster.cpus:
|
|
|
|
cpu.workload = root.workload
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Run the simulation
|
|
|
|
# ----------------------
|
|
|
|
|
|
|
|
if options.timing or options.detailed:
|
|
|
|
root.system.mem_mode = 'timing'
|
|
|
|
|
|
|
|
# instantiate configuration
|
2010-08-17 14:06:22 +02:00
|
|
|
m5.instantiate()
|
2006-11-13 22:09:47 +01:00
|
|
|
|
|
|
|
# simulate until program terminates
|
|
|
|
if options.maxtick:
|
|
|
|
exit_event = m5.simulate(options.maxtick)
|
|
|
|
else:
|
|
|
|
exit_event = m5.simulate(m5.MaxTick)
|
|
|
|
|
|
|
|
print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
|
|
|
|
|