Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 42 additions & 15 deletions configs/ruby/GPU_VIPER.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import m5
from m5.defines import buildEnv
from m5.objects import *
from m5.util import addToPath
from m5.util import addToPath, warn

from .Ruby import (
create_topology,
Expand Down Expand Up @@ -98,7 +98,7 @@ class L2Cache(RubyCache):
def create(self, size, assoc, options):
self.size = MemorySize(size)
self.assoc = assoc
self.replacement_policy = TreePLRURP()
self.replacement_policy = BRRIPRP()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we update this to use the variant Jarvis integrated into the mainline where the config tells us what RP to use? Then we can just pick BRRIP from there, and it's much more extensible ...



class CPCntrl(GPU_VIPER_CorePair_Controller, CntrlBase):
Expand Down Expand Up @@ -336,18 +336,23 @@ class L3Cache(RubyCache):
dataArrayBanks = 16
tagArrayBanks = 16

def create(self, options, ruby_system, system):
def create(self, options, ruby_system, system, num_dirs=None):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of the changes here also seem unrelated to adding an L3?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. The TCC banking changes are not required for the L3. Ill prepare a pr for this

# num_dirs: number of directory controllers sharing this L3 pool.
# Defaults to options.num_dirs (CPU-side) if not specified.
if num_dirs is None:
num_dirs = options.num_dirs
self.size = MemorySize(options.l3_size)
self.size.value /= options.num_dirs
self.size.value /= num_dirs
self.assoc = options.l3_assoc
self.dataArrayBanks /= options.num_dirs
self.tagArrayBanks /= options.num_dirs
self.dataArrayBanks /= options.num_dirs
self.tagArrayBanks /= options.num_dirs
# Each directory controller owns one L3 slice. Configure the internal
# data and tag bank count of that slice independently of the number of
# directory controllers.
self.dataArrayBanks = options.l3_num_banks
self.tagArrayBanks = options.l3_num_banks
self.dataAccessLatency = options.l3_data_latency
self.tagAccessLatency = options.l3_tag_latency
self.resourceStalls = False
self.replacement_policy = TreePLRURP()
self.replacement_policy = BRRIPRP()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here -- we should use Jarvis' configurable RP code (like @Basemism you did for the ScalarCache) to make this easier to play around with.



class L3Cntrl(GPU_VIPER_L3Cache_Controller, CntrlBase):
Expand Down Expand Up @@ -382,7 +387,7 @@ def connectWireBuffers(


class DirCntrl(GPU_VIPER_Directory_Controller, CntrlBase):
def create(self, options, dir_ranges, ruby_system, system):
def create(self, options, dir_ranges, ruby_system, system, num_dirs=None):
self.version = self.versionCount()

self.response_latency = 30
Expand All @@ -393,7 +398,8 @@ def create(self, options, dir_ranges, ruby_system, system):
)

self.L3CacheMemory = L3Cache()
self.L3CacheMemory.create(options, ruby_system, system)
self.L3CacheMemory.create(options, ruby_system, system,
num_dirs=num_dirs)

self.l3_hit_latency = max(
self.L3CacheMemory.dataAccessLatency,
Expand Down Expand Up @@ -429,6 +435,12 @@ def define_options(parser):
parser.add_argument("--tcp-issue-latency", type=int, default=1)
parser.add_argument("--l3-data-latency", type=int, default=20)
parser.add_argument("--l3-tag-latency", type=int, default=15)
parser.add_argument(
"--l3-num-banks",
type=int,
default=16,
help="Number of data and tag banks in each directory L3 slice",
)
parser.add_argument("--cpu-to-dir-latency", type=int, default=120)
parser.add_argument("--gpu-to-dir-latency", type=int, default=120)
parser.add_argument(
Expand All @@ -438,6 +450,13 @@ def define_options(parser):
"--no-tcc-resource-stalls", action="store_false", default=True
)
parser.add_argument("--use-L3-on-WT", action="store_true", default=False)
parser.add_argument("--use-gpu-l3", action="store_true", default=False,
help="Enable L3 (Infinity Cache) fills for GPU "
"directory controllers")
parser.add_argument("--l3-exclusive", action="store_true", default=False,
help="Experimental non-CDNA3 victim-cache policy: "
"GPU reads consume L3 entries and fills occur "
"from lower-level evictions")
parser.add_argument("--num-tbes", type=int, default=256)
parser.add_argument("--l2-latency", type=int, default=50) # load to use
parser.add_argument(
Expand Down Expand Up @@ -560,14 +579,14 @@ def construct_dirs(options, system, ruby_system, network):
# For an odd number of CPUs, still create the right number of controllers
TCC_bits = int(math.log(options.num_tccs, 2))

dir_bits = int(math.log(options.num_dirs, 2))
block_size_bits = int(math.log(options.cacheline_size, 2))
if options.numa_high_bit:
numa_bit = options.numa_high_bit
else:
# if the numa_bit is not specified, set the directory bits as the
# lowest bits above the block offset bits, and the numa_bit as the
# highest of those directory bits
dir_bits = int(math.log(options.num_dirs, 2))
block_size_bits = int(math.log(options.cacheline_size, 2))
numa_bit = block_size_bits + dir_bits - 1

for i in range(options.num_dirs):
Expand All @@ -584,6 +603,7 @@ def construct_dirs(options, system, ruby_system, network):

dir_cntrl = DirCntrl(noTCCdir=True, TCC_select_num_bits=TCC_bits)
dir_cntrl.create(options, dir_ranges, ruby_system, system)
dir_cntrl.L3CacheMemory.start_index_bit = block_size_bits + dir_bits
dir_cntrl.number_of_TBEs = options.num_tbes
dir_cntrl.useL3OnWT = options.use_L3_on_WT
dir_cntrl.L2isWB = options.WB_L2
Expand Down Expand Up @@ -626,6 +646,9 @@ def construct_gpudirs(options, system, ruby_system, network):
dir_cntrl_nodes = []
mem_ctrls = []

if options.use_gpu_l3:
warn("GPU L3 write-back is not supported; modeling a write-through L3.")

xor_low_bit = 0

# For an odd number of CPUs, still create the right number of controllers
Expand All @@ -651,9 +674,13 @@ def construct_gpudirs(options, system, ruby_system, network):
TCC_select_num_bits=TCC_bits,
clk_domain=system.fabric_clk,
)
dir_cntrl.create(options, [addr_range], ruby_system, system)
dir_cntrl.create(options, [addr_range], ruby_system, system,
num_dirs=options.dgpu_num_dirs)
dir_cntrl.L3CacheMemory.start_index_bit = block_size_bits + dir_bits
dir_cntrl.number_of_TBEs = options.num_tbes
dir_cntrl.useL3OnWT = False
dir_cntrl.GPUonly = True
dir_cntrl.useL3OnWT = options.use_gpu_l3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Basemism do you support a WB L3 in this patch? If not, there probably needs to be a warning here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not currently, I'll prepare a warning shortly

dir_cntrl.L3Exclusive = options.l3_exclusive
dir_cntrl.L2isWB = options.WB_L2

# Connect the Directory controller to the ruby network
Expand Down
Loading