[gem5-dev] [L] Change in gem5/gem5[develop]: stdlib: Add a prebuilt MESI_Three_Level cache

2023-06-15 Thread Hoa Nguyen (Gerrit) via gem5-dev
Hoa Nguyen has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/71598?usp=email )


Change subject: stdlib: Add a prebuilt MESI_Three_Level cache
..

stdlib: Add a prebuilt MESI_Three_Level cache

The cache is modeled after an AMD EPYC cache, but not exactly
like AMD EPYC cache.
- K cores per core complex (CCD), each core has one private split L1,
and one private L2.
- K cores in the same CCD share 1 slice of L3 cache, which is not
a victim cache.
- There can be multiple CCDs, which communicate with each other via
Cross-CCD router. The Cross-CCD rounter is also connected to
directory controllers and dma controllers.
- All links latency are set to 1.

Change-Id: Ib64248bed9155b8e48e5158ffdeebf1f2d770754
Signed-off-by: Hoa Nguyen 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/71598
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
Reviewed-by: Jason Lowe-Power 
---
M src/python/SConscript
A  
src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/__init__.py
A  
src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/core_complex.py
A  
src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/octopi.py
A  
src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/octopi_network.py
A  
src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/ruby_network_components.py

6 files changed, 717 insertions(+), 0 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/python/SConscript b/src/python/SConscript
index f98b570..ea9d3d4 100644
--- a/src/python/SConscript
+++ b/src/python/SConscript
@@ -154,6 +154,18 @@
 PySource('gem5.components.cachehierarchies.ruby.caches.mesi_three_level',
 'gem5/components/cachehierarchies/ruby/caches/mesi_three_level/'
 'l3_cache.py')
+PySource('gem5.components.cachehierarchies.ruby.caches.mesi_three_level',
+'gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/'
+'octopi.py')
+PySource('gem5.components.cachehierarchies.ruby.caches.mesi_three_level',
+'gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/'
+'core_complex.py')
+PySource('gem5.components.cachehierarchies.ruby.caches.mesi_three_level',
+'gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/'
+'octopi_network.py')
+PySource('gem5.components.cachehierarchies.ruby.caches.mesi_three_level',
+'gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/'
+'ruby_network_components.py')
 PySource('gem5.components.cachehierarchies.ruby.caches.mi_example',
 'gem5/components/cachehierarchies/ruby/caches/mi_example/__init__.py')
 PySource('gem5.components.cachehierarchies.ruby.caches.mi_example',
diff --git  
a/src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/__init__.py  
b/src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/__init__.py

new file mode 100644
index 000..b08f46b
--- /dev/null
+++  
b/src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/__init__.py

@@ -0,0 +1,25 @@
+# Copyright (c) 2022-2023 The Regents of the University of California
+# 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.
diff --git  
a/src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/core_complex.py  

[gem5-dev] [L] Change in gem5/gem5[develop]: stdlib: Add a prebuilt MESI_Three_Level cache

2023-06-13 Thread Hoa Nguyen (Gerrit) via gem5-dev
Hoa Nguyen has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/71598?usp=email )



Change subject: stdlib: Add a prebuilt MESI_Three_Level cache
..

stdlib: Add a prebuilt MESI_Three_Level cache

The cache is modeled after an AMD EPYC cache, but not exactly
like AMD EPYC cache.
- K cores per core complex (CCD), each core has one private split L1,
and one private L2.
- K cores in the same CCD share 1 slice of L3 cache, which is not
a victim cache.
- There can be multiple CCDs, which communicate with each other via
Cross-CCD router. The Cross-CCD rounter is also connected to
directory controllers and dma controllers.
- All links latency are set to 1.

Change-Id: Ib64248bed9155b8e48e5158ffdeebf1f2d770754
Signed-off-by: Hoa Nguyen 
---
M src/python/SConscript
A  
src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/Octopi.py
A  
src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/__init__.py
A  
src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/core_complex.py
A  
src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/octopi_network.py
A  
src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/ruby_network_components.py
M  
src/python/gem5/components/cachehierarchies/ruby/mesi_three_level_cache_hierarchy.py

7 files changed, 616 insertions(+), 1 deletion(-)



diff --git a/src/python/SConscript b/src/python/SConscript
index f98b570..47901fd 100644
--- a/src/python/SConscript
+++ b/src/python/SConscript
@@ -154,6 +154,18 @@
 PySource('gem5.components.cachehierarchies.ruby.caches.mesi_three_level',
 'gem5/components/cachehierarchies/ruby/caches/mesi_three_level/'
 'l3_cache.py')
+PySource('gem5.components.cachehierarchies.ruby.caches.mesi_three_level',
+'gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/'
+'Octopi.py')
+PySource('gem5.components.cachehierarchies.ruby.caches.mesi_three_level',
+'gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/'
+'core_complex.py')
+PySource('gem5.components.cachehierarchies.ruby.caches.mesi_three_level',
+'gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/'
+'octopi_network.py')
+PySource('gem5.components.cachehierarchies.ruby.caches.mesi_three_level',
+'gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/'
+'ruby_network_components.py')
 PySource('gem5.components.cachehierarchies.ruby.caches.mi_example',
 'gem5/components/cachehierarchies/ruby/caches/mi_example/__init__.py')
 PySource('gem5.components.cachehierarchies.ruby.caches.mi_example',
diff --git  
a/src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/Octopi.py  
b/src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/Octopi.py

new file mode 100644
index 000..96a68da
--- /dev/null
+++  
b/src/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/Octopi.py

@@ -0,0 +1,237 @@
+from ...abstract_ruby_cache_hierarchy import AbstractRubyCacheHierarchy
+from abstract_three_level_cache_hierarchy import (
+AbstractThreeLevelCacheHierarchy,
+)
+from ..coherence_protocol import CoherenceProtocol
+from ..isas import ISA
+from ..components.boards.abstract_board import AbstractBoard
+from ..utils.requires import requires
+
+from ..components.cachehierarchies.ruby.caches.mesi_three_level.directory  
import  
(

+Directory,
+)
+from ..components.cachehierarchies.ruby.caches.mesi_three_level.dma_controller  
import  
(

+DMAController,
+)
+
+from m5.objects import RubySystem, DMASequencer, RubyPortProxy
+
+from .core_complex import CoreComplex
+from .octopi_network import OctopiNetwork
+from .ruby_network_components import (
+RubyNetworkComponent,
+RubyRouter,
+RubyExtLink,
+RubyIntLink,
+)
+
+# CoreComplex sub-systems own the L1, L2, L3 controllers
+# OctopiCache owns the directory controllers
+# RubySystem owns the DMA Controllers
+class OctopiCache(
+AbstractRubyCacheHierarchy, AbstractThreeLevelCacheHierarchy
+):
+def __init__(
+self,
+l1i_size: str,
+l1i_assoc: int,
+l1d_size: str,
+l1d_assoc: int,
+l2_size: str,
+l2_assoc: int,
+l3_size: str,
+l3_assoc: int,
+num_core_complexes: int,
+is_fullsystem: bool,
+):
+AbstractRubyCacheHierarchy.__init__(self=self)
+AbstractThreeLevelCacheHierarchy.__init__(
+self=self,
+l1i_size=l1i_size,
+l1i_assoc=l1i_assoc,
+l1d_size=l1d_size,
+l1d_assoc=l1d_assoc,
+l2_size=l2_size,
+l2_assoc=l2_assoc,
+l3_size=l3_size,
+l3_assoc=l3_assoc,
+)
+
+self._directory_controllers = []
+