Brandon Potter has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/12121 )

Change subject: configs: faux-filesystem fix w/ ruby in se mode
......................................................................

configs: faux-filesystem fix w/ ruby in se mode

These changes are needed so that the config scripts
can report cache hierarchy information to the faux
filesystem.

This is useful for the ROCm runtime when it reads
psuedofiles from the host filesytem from "/proc".

Change-Id: Iad3e6c088d47c9b93979f584de748367eae8259b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/12121
Reviewed-by: Brandon Potter <[email protected]>
Maintainer: Brandon Potter <[email protected]>
Tested-by: kokoro <[email protected]>
---
M configs/common/FileSystemConfig.py
M configs/ruby/GPU_VIPER.py
M configs/ruby/MESI_Three_Level.py
M configs/ruby/MOESI_AMD_Base.py
M configs/ruby/MOESI_CMP_directory.py
M configs/ruby/MOESI_CMP_token.py
M configs/ruby/MOESI_hammer.py
M configs/ruby/Ruby.py
M configs/topologies/BaseTopology.py
M configs/topologies/Cluster.py
M configs/topologies/MeshDirCorners_XY.py
M configs/topologies/Mesh_XY.py
12 files changed, 239 insertions(+), 4 deletions(-)

Approvals:
  Brandon Potter: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/configs/common/FileSystemConfig.py b/configs/common/FileSystemConfig.py
index 561cfe6..8a6da52 100644
--- a/configs/common/FileSystemConfig.py
+++ b/configs/common/FileSystemConfig.py
@@ -61,7 +61,7 @@
     mkdir(procdir)

     for i in xrange(options.num_cpus):
-        one_cpu = 'processor       : 0\n'                         + \
+        one_cpu = 'processor       : %d\n' % (i)                  + \
                   'vendor_id       : Generic\n'                   + \
                   'cpu family      : 0\n'                         + \
                   'model           : 0\n'                         + \
diff --git a/configs/ruby/GPU_VIPER.py b/configs/ruby/GPU_VIPER.py
index 94dcbef..e8e7815 100644
--- a/configs/ruby/GPU_VIPER.py
+++ b/configs/ruby/GPU_VIPER.py
@@ -499,6 +499,59 @@

         cpuCluster.add(cp_cntrl)

+ # Register CPUs and caches for each CorePair and directory (SE mode only)
+    if not full_system:
+        FileSystemConfig.config_filesystem(options)
+        for i in xrange((options.num_cpus + 1) // 2):
+            FileSystemConfig.register_cpu(physical_package_id = 0,
+                                          core_siblings = \
+                                            xrange(options.num_cpus),
+                                          core_id = i*2,
+                                          thread_siblings = [])
+
+            FileSystemConfig.register_cpu(physical_package_id = 0,
+                                          core_siblings = \
+                                            xrange(options.num_cpus),
+                                          core_id = i*2+1,
+                                          thread_siblings = [])
+
+            FileSystemConfig.register_cache(level = 0,
+                                            idu_type = 'Instruction',
+                                            size = options.l1i_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l1i_assoc,
+                                            cpus = [i*2, i*2+1])
+
+            FileSystemConfig.register_cache(level = 0,
+                                            idu_type = 'Data',
+                                            size = options.l1d_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l1d_assoc,
+                                            cpus = [i*2])
+
+            FileSystemConfig.register_cache(level = 0,
+                                            idu_type = 'Data',
+                                            size = options.l1d_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l1d_assoc,
+                                            cpus = [i*2+1])
+
+            FileSystemConfig.register_cache(level = 1,
+                                            idu_type = 'Unified',
+                                            size = options.l2_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l2_assoc,
+                                            cpus = [i*2, i*2+1])
+
+        for i in range(options.num_dirs):
+            FileSystemConfig.register_cache(level = 2,
+                                            idu_type = 'Unified',
+                                            size = options.l3_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l3_assoc,
+                                            cpus = [n for n in
+                                                xrange(options.num_cpus)])
+
     gpuCluster = None
     if hasattr(options, 'bw_scalor') and options.bw_scalor > 0:
       gpuCluster = Cluster(extBW = crossbar_bw, intBW = crossbar_bw)
diff --git a/configs/ruby/MESI_Three_Level.py b/configs/ruby/MESI_Three_Level.py
index 95ac342..6d6bc89 100644
--- a/configs/ruby/MESI_Three_Level.py
+++ b/configs/ruby/MESI_Three_Level.py
@@ -35,6 +35,7 @@
 from m5.defines import buildEnv
 from Ruby import create_topology, create_directories
 from Ruby import send_evicts
+import FileSystemConfig

 #
 # Declare caches used by the protocol
@@ -260,6 +261,45 @@
         io_controller.requestToDir.master = ruby_system.network.slave

         all_cntrls = all_cntrls + [io_controller]
+    # Register configuration with filesystem
+    else:
+        FileSystemConfig.config_filesystem(options)
+
+        for i in xrange(options.num_clusters):
+            for j in xrange(num_cpus_per_cluster):
+                FileSystemConfig.register_cpu(physical_package_id = 0,
+ core_siblings = xrange(options.num_cpus), + core_id = i*num_cpus_per_cluster+j,
+                                              thread_siblings = [])
+
+                FileSystemConfig.register_cache(level = 0,
+                                                idu_type = 'Instruction',
+                                                size = '4096B',
+ line_size = options.cacheline_size,
+                                                assoc = 1,
+ cpus = [i*num_cpus_per_cluster+j])
+                FileSystemConfig.register_cache(level = 0,
+                                                idu_type = 'Data',
+                                                size = '4096B',
+ 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 xrange(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)
diff --git a/configs/ruby/MOESI_AMD_Base.py b/configs/ruby/MOESI_AMD_Base.py
index aeec378..d465083 100644
--- a/configs/ruby/MOESI_AMD_Base.py
+++ b/configs/ruby/MOESI_AMD_Base.py
@@ -38,6 +38,7 @@
 from m5.util import addToPath
 from Ruby import create_topology
 from Ruby import send_evicts
+import FileSystemConfig

 addToPath('../')

@@ -326,6 +327,59 @@

         cpuCluster.add(cp_cntrl)

+ # Register CPUs and caches for each CorePair and directory (SE mode only)
+    if not full_system:
+        FileSystemConfig.config_filesystem(options)
+        for i in xrange((options.num_cpus + 1) // 2):
+            FileSystemConfig.register_cpu(physical_package_id = 0,
+                                          core_siblings =
+                                            xrange(options.num_cpus),
+                                          core_id = i*2,
+                                          thread_siblings = [])
+
+            FileSystemConfig.register_cpu(physical_package_id = 0,
+                                          core_siblings =
+                                            xrange(options.num_cpus),
+                                          core_id = i*2+1,
+                                          thread_siblings = [])
+
+            FileSystemConfig.register_cache(level = 0,
+                                            idu_type = 'Instruction',
+                                            size = options.l1i_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l1i_assoc,
+                                            cpus = [i*2, i*2+1])
+
+            FileSystemConfig.register_cache(level = 0,
+                                            idu_type = 'Data',
+                                            size = options.l1d_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l1d_assoc,
+                                            cpus = [i*2])
+
+            FileSystemConfig.register_cache(level = 0,
+                                            idu_type = 'Data',
+                                            size = options.l1d_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l1d_assoc,
+                                            cpus = [i*2+1])
+
+            FileSystemConfig.register_cache(level = 1,
+                                            idu_type = 'Unified',
+                                            size = options.l2_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l2_assoc,
+                                            cpus = [i*2, i*2+1])
+
+        for i in range(options.num_dirs):
+            FileSystemConfig.register_cache(level = 2,
+                                            idu_type = 'Unified',
+                                            size = options.l3_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l3_assoc,
+                                            cpus = [n for n in
+                                                xrange(options.num_cpus)])
+
     # Assuming no DMA devices
     assert(len(dma_devices) == 0)

diff --git a/configs/ruby/MOESI_CMP_directory.py b/configs/ruby/MOESI_CMP_directory.py
index 40cb7ce..5ce31df 100644
--- a/configs/ruby/MOESI_CMP_directory.py
+++ b/configs/ruby/MOESI_CMP_directory.py
@@ -237,7 +237,6 @@

         all_cntrls = all_cntrls + [io_controller]

-
     ruby_system.network.number_of_virtual_networks = 3
     topology = create_topology(all_cntrls, options)
     return (cpu_sequencers, mem_dir_cntrl_nodes, topology)
diff --git a/configs/ruby/MOESI_CMP_token.py b/configs/ruby/MOESI_CMP_token.py
index 817d6f9..6d100bd 100644
--- a/configs/ruby/MOESI_CMP_token.py
+++ b/configs/ruby/MOESI_CMP_token.py
@@ -265,7 +265,6 @@

         all_cntrls = all_cntrls + [io_controller]

-
     ruby_system.network.number_of_virtual_networks = 6
     topology = create_topology(all_cntrls, options)
     return (cpu_sequencers, mem_dir_cntrl_nodes, topology)
diff --git a/configs/ruby/MOESI_hammer.py b/configs/ruby/MOESI_hammer.py
index 7630886..ecac17e 100644
--- a/configs/ruby/MOESI_hammer.py
+++ b/configs/ruby/MOESI_hammer.py
@@ -33,6 +33,7 @@
 from m5.defines import buildEnv
 from Ruby import create_topology, create_directories
 from Ruby import send_evicts
+import FileSystemConfig

 #
 # Declare caches used by the protocol
@@ -255,6 +256,35 @@
         io_controller.mandatoryQueue = MessageBuffer()

         all_cntrls = all_cntrls + [io_controller]
+    # Register configuration with filesystem
+    else:
+        FileSystemConfig.config_filesystem(options)
+
+        for i in xrange(options.num_cpus):
+            FileSystemConfig.register_cpu(physical_package_id = 0,
+                                          core_siblings = [],
+                                          core_id = i,
+                                          thread_siblings = [])
+
+            FileSystemConfig.register_cache(level = 1,
+                                            idu_type = 'Instruction',
+                                            size = options.l1i_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l1i_assoc,
+                                            cpus = [i])
+            FileSystemConfig.register_cache(level = 1,
+                                            idu_type = 'Data',
+                                            size = options.l1d_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l1d_assoc,
+                                            cpus = [i])
+
+            FileSystemConfig.register_cache(level = 2,
+                                            idu_type = 'Unified',
+                                            size = options.l2_size,
+ line_size = options.cacheline_size,
+                                            assoc = options.l2_assoc,
+                                            cpus = [i])

     ruby_system.network.number_of_virtual_networks = 6
     topology = create_topology(all_cntrls, options)
diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py
index ffa5a02..369a4e3 100644
--- a/configs/ruby/Ruby.py
+++ b/configs/ruby/Ruby.py
@@ -50,6 +50,7 @@
 addToPath('../')

 from common import MemConfig
+from common import FileSystemConfig

 from topologies import *
 from network import Network
@@ -154,6 +155,9 @@
     system.ruby = RubySystem()
     ruby = system.ruby

+    # Generate pseudo filesystem
+    FileSystemConfig.config_filesystem(options)
+
     # Create the network object
     (network, IntLinkClass, ExtLinkClass, RouterClass, InterfaceClass) = \
         Network.create_network(options, ruby)
@@ -174,6 +178,11 @@
     topology.makeTopology(options, network, IntLinkClass, ExtLinkClass,
             RouterClass)

+    # Register the topology elements with faux filesystem (SE mode only)
+    if not full_system:
+        topology.registerTopology(options)
+
+
     # Initialize network based on topology
     Network.init_network(options, network, InterfaceClass)

diff --git a/configs/topologies/BaseTopology.py b/configs/topologies/BaseTopology.py
index 180d437..15c9e88 100644
--- a/configs/topologies/BaseTopology.py
+++ b/configs/topologies/BaseTopology.py
@@ -51,6 +51,15 @@
         """
         m5.util.fatal("BaseTopology should have been overridden!!")

+    def registerTopology(self, options):
+        """ Called from configs/ruby/Ruby.py
+            There is no return value. This should only be called in
+            SE mode. It is used by some topology objects to populate
+            the faux filesystem with accurate file contents.
+            No need to implement if not using FilesystemRegister
+            functionality.
+        """
+
 class SimpleTopology(BaseTopology):
     """ Provides methods needed for the topologies included in Ruby before
         topology changes.
diff --git a/configs/topologies/Cluster.py b/configs/topologies/Cluster.py
index a0e7df6..65c5686 100644
--- a/configs/topologies/Cluster.py
+++ b/configs/topologies/Cluster.py
@@ -85,7 +85,8 @@

         for node in self.nodes:
             if type(node) == Cluster:
- node.makeTopology(options, network, IntLink, ExtLink, Router)
+                node.makeTopology(options, network, IntLink,
+                                  ExtLink, Router)

                 # connect this cluster to the router
link_out = IntLink(link_id=self.num_int_links(), src_node=self.router, diff --git a/configs/topologies/MeshDirCorners_XY.py b/configs/topologies/MeshDirCorners_XY.py
index 95cb486..bdeaec1 100644
--- a/configs/topologies/MeshDirCorners_XY.py
+++ b/configs/topologies/MeshDirCorners_XY.py
@@ -32,6 +32,8 @@
 from m5.params import *
 from m5.objects import *

+from common import FileSystemConfig
+
 from .BaseTopology import SimpleTopology

 # Creates a Mesh topology with 4 directories, one at each corner.
@@ -98,6 +100,27 @@
                                     latency = link_latency))
             link_count += 1

+        # NUMA Node for each quadrant
+        # With odd columns or rows, the nodes will be unequal
+        numa_nodes = [ [], [], [], []]
+        for i in xrange(num_routers):
+            if i % num_columns < num_columns / 2  and \
+               i < num_routers / 2:
+                numa_nodes[0].append(i)
+            elif i % num_columns >= num_columns / 2  and \
+               i < num_routers / 2:
+                numa_nodes[1].append(i)
+            elif i % num_columns < num_columns / 2  and \
+               i >= num_routers / 2:
+                numa_nodes[2].append(i)
+            else:
+                numa_nodes[3].append(i)
+
+        num_numa_nodes = 0
+        for n in numa_nodes:
+            if n:
+                num_numa_nodes += 1
+
         # Connect the dir nodes to the corners.
         ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[0],
                                 int_node=routers[0],
@@ -190,3 +213,13 @@


         network.int_links = int_links
+
+    # Register nodes with filesystem
+    def registerTopology(self, options):
+        i = 0
+        for n in numa_nodes:
+            if n:
+                FileSystemConfig.register_node(n,
+                    MemorySize(options.mem_size) / num_numa_nodes, i)
+            i += 1
+
diff --git a/configs/topologies/Mesh_XY.py b/configs/topologies/Mesh_XY.py
index 79575b3..66fbd36 100644
--- a/configs/topologies/Mesh_XY.py
+++ b/configs/topologies/Mesh_XY.py
@@ -34,6 +34,8 @@
 from m5.params import *
 from m5.objects import *

+from common import FileSystemConfig
+
 from .BaseTopology import SimpleTopology

 # Creates a generic Mesh assuming an equal number of cache
@@ -174,3 +176,9 @@


         network.int_links = int_links
+
+    # Register nodes with filesystem
+    def registerTopology(self, options):
+        for i in xrange(options.num_cpus):
+            FileSystemConfig.register_node([i],
+                    MemorySize(options.mem_size) / options.num_cpus, i)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12121
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Iad3e6c088d47c9b93979f584de748367eae8259b
Gerrit-Change-Number: 12121
Gerrit-PatchSet: 25
Gerrit-Owner: Brandon Potter <[email protected]>
Gerrit-Reviewer: Brandon Potter <[email protected]>
Gerrit-Reviewer: John Alsop <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-CC: Giacomo Travaglini <[email protected]>
Gerrit-CC: Jason Lowe-Power <[email protected]>
Gerrit-CC: Nikos Nikoleris <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to