X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=configs%2Fruby%2FMESI_Three_Level.py;h=91ccb58963409224e60365fa2b4888cc515d0532;hb=refs%2Fheads%2Fdevelop-power;hp=7c80e48ad4560cfa252974ac363a7ff837b9f300;hpb=68af229490fc811aebddf68b3e2e09e63a5fa475;p=gem5.git diff --git a/configs/ruby/MESI_Three_Level.py b/configs/ruby/MESI_Three_Level.py index 7c80e48ad..91ccb5896 100644 --- a/configs/ruby/MESI_Three_Level.py +++ b/configs/ruby/MESI_Three_Level.py @@ -1,6 +1,7 @@ # Copyright (c) 2006-2007 The Regents of The University of Michigan # Copyright (c) 2009,2015 Advanced Micro Devices, Inc. # Copyright (c) 2013 Mark D. Hill and David A. Wood +# Copyright (c) 2020 ARM Limited # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,16 +26,14 @@ # 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: Brad Beckmann -# Nilay Vaish import math import m5 from m5.objects import * from m5.defines import buildEnv -from Ruby import create_topology, create_directories -from Ruby import send_evicts +from .Ruby import create_topology, create_directories +from .Ruby import send_evicts +from common import FileSystemConfig # # Declare caches used by the protocol @@ -47,6 +46,15 @@ def define_options(parser): parser.add_option("--num-clusters", type = "int", default = 1, help = "number of clusters in a design in which there are shared\ caches private to clusters") + parser.add_option("--l0i_size", type="string", default="4096B") + parser.add_option("--l0d_size", type="string", default="4096B") + parser.add_option("--l0i_assoc", type="int", default=1) + parser.add_option("--l0d_assoc", type="int", default=1) + parser.add_option("--l0_transitions_per_cycle", type="int", default=32) + parser.add_option("--l1_transitions_per_cycle", type="int", default=32) + parser.add_option("--l2_transitions_per_cycle", type="int", default=4) + parser.add_option("--enable-prefetch", action="store_true", default=False,\ + help="Enable Ruby hardware prefetcher") return def create_system(options, full_system, system, dma_ports, bootmem, @@ -83,18 +91,22 @@ def create_system(options, full_system, system, dma_ports, bootmem, # Must create the individual controllers before the network to ensure the # controller constructors are called before the network constructor # - for i in xrange(options.num_clusters): - for j in xrange(num_cpus_per_cluster): + for i in range(options.num_clusters): + for j in range(num_cpus_per_cluster): # # First create the Ruby objects associated with this cpu # - l0i_cache = L0Cache(size = '4096B', assoc = 1, is_icache = True, + l0i_cache = L0Cache(size = options.l0i_size, + assoc = options.l0i_assoc, + is_icache = True, start_index_bit = block_size_bits, - replacement_policy = LRUReplacementPolicy()) + replacement_policy = LRURP()) - l0d_cache = L0Cache(size = '4096B', assoc = 1, is_icache = False, + l0d_cache = L0Cache(size = options.l0d_size, + assoc = options.l0d_assoc, + is_icache = False, start_index_bit = block_size_bits, - replacement_policy = LRUReplacementPolicy()) + replacement_policy = LRURP()) # the ruby random tester reuses num_cpus to specify the # number of cpu ports connected to the tester object, which @@ -108,13 +120,27 @@ def create_system(options, full_system, system, dma_ports, bootmem, else: clk_domain = system.cpu[i].clk_domain + # Ruby prefetcher + prefetcher = RubyPrefetcher( + num_streams=16, + unit_filter = 256, + nonunit_filter = 256, + train_misses = 5, + num_startup_pfs = 4, + cross_page = True + ) + l0_cntrl = L0Cache_Controller( - version = i * num_cpus_per_cluster + j, Icache = l0i_cache, - Dcache = l0d_cache, send_evictions = send_evicts(options), - clk_domain = clk_domain, ruby_system = ruby_system) + version = i * num_cpus_per_cluster + j, + Icache = l0i_cache, Dcache = l0d_cache, + transitions_per_cycle = options.l0_transitions_per_cycle, + prefetcher = prefetcher, + enable_prefetch = options.enable_prefetch, + send_evictions = send_evicts(options), + clk_domain = clk_domain, + ruby_system = ruby_system) cpu_seq = RubySequencer(version = i * num_cpus_per_cluster + j, - icache = l0i_cache, clk_domain = clk_domain, dcache = l0d_cache, ruby_system = ruby_system) @@ -129,7 +155,9 @@ def create_system(options, full_system, system, dma_ports, bootmem, l1_cntrl = L1Cache_Controller( version = i * num_cpus_per_cluster + j, cache = l1_cache, l2_select_num_bits = l2_bits, - cluster_id = i, ruby_system = ruby_system) + cluster_id = i, + transitions_per_cycle = options.l1_transitions_per_cycle, + ruby_system = ruby_system) exec("ruby_system.l0_cntrl%d = l0_cntrl" % ( i * num_cpus_per_cluster + j)) @@ -144,6 +172,7 @@ def create_system(options, full_system, system, dma_ports, bootmem, l1_cntrl_nodes.append(l1_cntrl) # Connect the L0 and L1 controllers + l0_cntrl.prefetchQueue = MessageBuffer() l0_cntrl.mandatoryQueue = MessageBuffer() l0_cntrl.bufferToL1 = MessageBuffer(ordered = True) l1_cntrl.bufferFromL0 = l0_cntrl.bufferToL1 @@ -164,7 +193,7 @@ def create_system(options, full_system, system, dma_ports, bootmem, l1_cntrl.responseFromL2.slave = ruby_system.network.master - for j in xrange(num_l2caches_per_cluster): + for j in range(num_l2caches_per_cluster): l2_cache = L2Cache(size = options.l2_size, assoc = options.l2_assoc, start_index_bit = l2_index_start) @@ -172,7 +201,8 @@ def create_system(options, full_system, system, dma_ports, bootmem, l2_cntrl = L2Cache_Controller( version = i * num_l2caches_per_cluster + j, L2cache = l2_cache, cluster_id = i, - transitions_per_cycle = options.ports, + transitions_per_cycle =\ + options.l2_transitions_per_cycle, ruby_system = ruby_system) exec("ruby_system.l2_cntrl%d = l2_cntrl" @@ -201,7 +231,7 @@ def create_system(options, full_system, system, dma_ports, bootmem, clk_domain = ruby_system.clk_domain, clk_divider = 3) mem_dir_cntrl_nodes, rom_dir_cntrl_node = create_directories( - options, system.mem_ranges, bootmem, ruby_system, system) + options, bootmem, ruby_system, system) dir_cntrl_nodes = mem_dir_cntrl_nodes[:] if rom_dir_cntrl_node is not None: dir_cntrl_nodes.append(rom_dir_cntrl_node) @@ -213,6 +243,7 @@ def create_system(options, full_system, system, dma_ports, bootmem, dir_cntrl.responseToDir.slave = ruby_system.network.master dir_cntrl.responseFromDir = MessageBuffer() dir_cntrl.responseFromDir.master = ruby_system.network.slave + dir_cntrl.requestToMemory = MessageBuffer() dir_cntrl.responseFromMemory = MessageBuffer() for i, dma_port in enumerate(dma_ports): @@ -260,6 +291,45 @@ def create_system(options, full_system, system, dma_ports, bootmem, io_controller.requestToDir.master = ruby_system.network.slave all_cntrls = all_cntrls + [io_controller] + # Register configuration with filesystem + else: + for i in range(options.num_clusters): + for j in range(num_cpus_per_cluster): + FileSystemConfig.register_cpu(physical_package_id = 0, + core_siblings = range(options.num_cpus), + core_id = i*num_cpus_per_cluster+j, + thread_siblings = []) + + FileSystemConfig.register_cache(level = 0, + idu_type = 'Instruction', + size = options.l0i_size, + line_size =\ + options.cacheline_size, + assoc = 1, + cpus = [i*num_cpus_per_cluster+j]) + FileSystemConfig.register_cache(level = 0, + idu_type = 'Data', + size = options.l0d_size, + line_size =\ + options.cacheline_size, + assoc = 1, + cpus = [i*num_cpus_per_cluster+j]) + + FileSystemConfig.register_cache(level = 1, + idu_type = 'Unified', + size = options.l1d_size, + line_size = options.cacheline_size, + assoc = options.l1d_assoc, + cpus = [i*num_cpus_per_cluster+j]) + + FileSystemConfig.register_cache(level = 2, + idu_type = 'Unified', + size = str(MemorySize(options.l2_size) * \ + num_l2caches_per_cluster)+'B', + line_size = options.cacheline_size, + assoc = options.l2_assoc, + cpus = [n for n in range(i*num_cpus_per_cluster, \ + (i+1)*num_cpus_per_cluster)]) ruby_system.network.number_of_virtual_networks = 3 topology = create_topology(all_cntrls, options)