misc: merge branch 'release-staging-v19.0.0.0' into develop
[gem5.git] / configs / ruby / GPU_VIPER.py
1 # Copyright (c) 2011-2015 Advanced Micro Devices, Inc.
2 # All rights reserved.
3 #
4 # For use for simulation and test purposes only
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8 #
9 # 1. Redistributions of source code must retain the above copyright notice,
10 # this list of conditions and the following disclaimer.
11 #
12 # 2. Redistributions in binary form must reproduce the above copyright notice,
13 # this list of conditions and the following disclaimer in the documentation
14 # and/or other materials provided with the distribution.
15 #
16 # 3. Neither the name of the copyright holder nor the names of its
17 # contributors may be used to endorse or promote products derived from this
18 # software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 # POSSIBILITY OF SUCH DAMAGE.
31
32 import math
33 import m5
34 from m5.objects import *
35 from m5.defines import buildEnv
36 from m5.util import addToPath
37 from Ruby import create_topology
38 from Ruby import send_evicts
39
40 addToPath('../')
41
42 from topologies.Cluster import Cluster
43 from topologies.Crossbar import Crossbar
44
45 class CntrlBase:
46 _seqs = 0
47 @classmethod
48 def seqCount(cls):
49 # Use SeqCount not class since we need global count
50 CntrlBase._seqs += 1
51 return CntrlBase._seqs - 1
52
53 _cntrls = 0
54 @classmethod
55 def cntrlCount(cls):
56 # Use CntlCount not class since we need global count
57 CntrlBase._cntrls += 1
58 return CntrlBase._cntrls - 1
59
60 _version = 0
61 @classmethod
62 def versionCount(cls):
63 cls._version += 1 # Use count for this particular type
64 return cls._version - 1
65
66 class L1Cache(RubyCache):
67 resourceStalls = False
68 dataArrayBanks = 2
69 tagArrayBanks = 2
70 dataAccessLatency = 1
71 tagAccessLatency = 1
72 def create(self, size, assoc, options):
73 self.size = MemorySize(size)
74 self.assoc = assoc
75 self.replacement_policy = TreePLRURP()
76
77 class L2Cache(RubyCache):
78 resourceStalls = False
79 assoc = 16
80 dataArrayBanks = 16
81 tagArrayBanks = 16
82 def create(self, size, assoc, options):
83 self.size = MemorySize(size)
84 self.assoc = assoc
85 self.replacement_policy = TreePLRURP()
86
87 class CPCntrl(CorePair_Controller, CntrlBase):
88
89 def create(self, options, ruby_system, system):
90 self.version = self.versionCount()
91
92 self.L1Icache = L1Cache()
93 self.L1Icache.create(options.l1i_size, options.l1i_assoc, options)
94 self.L1D0cache = L1Cache()
95 self.L1D0cache.create(options.l1d_size, options.l1d_assoc, options)
96 self.L1D1cache = L1Cache()
97 self.L1D1cache.create(options.l1d_size, options.l1d_assoc, options)
98 self.L2cache = L2Cache()
99 self.L2cache.create(options.l2_size, options.l2_assoc, options)
100
101 self.sequencer = RubySequencer()
102 self.sequencer.version = self.seqCount()
103 self.sequencer.icache = self.L1Icache
104 self.sequencer.dcache = self.L1D0cache
105 self.sequencer.ruby_system = ruby_system
106 self.sequencer.coreid = 0
107 self.sequencer.is_cpu_sequencer = True
108
109 self.sequencer1 = RubySequencer()
110 self.sequencer1.version = self.seqCount()
111 self.sequencer1.icache = self.L1Icache
112 self.sequencer1.dcache = self.L1D1cache
113 self.sequencer1.ruby_system = ruby_system
114 self.sequencer1.coreid = 1
115 self.sequencer1.is_cpu_sequencer = True
116
117 self.issue_latency = options.cpu_to_dir_latency
118 self.send_evictions = send_evicts(options)
119
120 self.ruby_system = ruby_system
121
122 if options.recycle_latency:
123 self.recycle_latency = options.recycle_latency
124
125 class TCPCache(RubyCache):
126 size = "16kB"
127 assoc = 16
128 dataArrayBanks = 16 #number of data banks
129 tagArrayBanks = 16 #number of tag banks
130 dataAccessLatency = 4
131 tagAccessLatency = 1
132 def create(self, options):
133 self.size = MemorySize(options.tcp_size)
134 self.assoc = options.tcp_assoc
135 self.resourceStalls = options.no_tcc_resource_stalls
136 self.replacement_policy = TreePLRURP()
137
138 class TCPCntrl(TCP_Controller, CntrlBase):
139
140 def create(self, options, ruby_system, system):
141 self.version = self.versionCount()
142
143 self.L1cache = TCPCache(tagAccessLatency = options.TCP_latency,
144 dataAccessLatency = options.TCP_latency)
145 self.L1cache.resourceStalls = options.no_resource_stalls
146 self.L1cache.create(options)
147 self.issue_latency = 1
148
149 self.coalescer = VIPERCoalescer()
150 self.coalescer.version = self.seqCount()
151 self.coalescer.icache = self.L1cache
152 self.coalescer.dcache = self.L1cache
153 self.coalescer.ruby_system = ruby_system
154 self.coalescer.support_inst_reqs = False
155 self.coalescer.is_cpu_sequencer = False
156
157 self.sequencer = RubySequencer()
158 self.sequencer.version = self.seqCount()
159 self.sequencer.icache = self.L1cache
160 self.sequencer.dcache = self.L1cache
161 self.sequencer.ruby_system = ruby_system
162 self.sequencer.is_cpu_sequencer = True
163
164 self.use_seq_not_coal = False
165
166 self.ruby_system = ruby_system
167
168 if options.recycle_latency:
169 self.recycle_latency = options.recycle_latency
170
171 def createCP(self, options, ruby_system, system):
172 self.version = self.versionCount()
173
174 self.L1cache = TCPCache(tagAccessLatency = options.TCP_latency,
175 dataAccessLatency = options.TCP_latency)
176 self.L1cache.resourceStalls = options.no_resource_stalls
177 self.L1cache.create(options)
178 self.issue_latency = 1
179
180 self.coalescer = VIPERCoalescer()
181 self.coalescer.version = self.seqCount()
182 self.coalescer.icache = self.L1cache
183 self.coalescer.dcache = self.L1cache
184 self.coalescer.ruby_system = ruby_system
185 self.coalescer.support_inst_reqs = False
186 self.coalescer.is_cpu_sequencer = False
187
188 self.sequencer = RubySequencer()
189 self.sequencer.version = self.seqCount()
190 self.sequencer.icache = self.L1cache
191 self.sequencer.dcache = self.L1cache
192 self.sequencer.ruby_system = ruby_system
193 self.sequencer.is_cpu_sequencer = True
194
195 self.use_seq_not_coal = True
196
197 self.ruby_system = ruby_system
198
199 if options.recycle_latency:
200 self.recycle_latency = options.recycle_latency
201
202 class SQCCache(RubyCache):
203 dataArrayBanks = 8
204 tagArrayBanks = 8
205 dataAccessLatency = 1
206 tagAccessLatency = 1
207
208 def create(self, options):
209 self.size = MemorySize(options.sqc_size)
210 self.assoc = options.sqc_assoc
211 self.replacement_policy = TreePLRURP()
212
213 class SQCCntrl(SQC_Controller, CntrlBase):
214
215 def create(self, options, ruby_system, system):
216 self.version = self.versionCount()
217
218 self.L1cache = SQCCache()
219 self.L1cache.create(options)
220 self.L1cache.resourceStalls = options.no_resource_stalls
221
222 self.sequencer = RubySequencer()
223
224 self.sequencer.version = self.seqCount()
225 self.sequencer.icache = self.L1cache
226 self.sequencer.dcache = self.L1cache
227 self.sequencer.ruby_system = ruby_system
228 self.sequencer.support_data_reqs = False
229 self.sequencer.is_cpu_sequencer = False
230
231 self.ruby_system = ruby_system
232
233 if options.recycle_latency:
234 self.recycle_latency = options.recycle_latency
235
236 class TCC(RubyCache):
237 size = MemorySize("256kB")
238 assoc = 16
239 dataAccessLatency = 8
240 tagAccessLatency = 2
241 resourceStalls = True
242 def create(self, options):
243 self.assoc = options.tcc_assoc
244 if hasattr(options, 'bw_scalor') and options.bw_scalor > 0:
245 s = options.num_compute_units
246 tcc_size = s * 128
247 tcc_size = str(tcc_size)+'kB'
248 self.size = MemorySize(tcc_size)
249 self.dataArrayBanks = 64
250 self.tagArrayBanks = 64
251 else:
252 self.size = MemorySize(options.tcc_size)
253 self.dataArrayBanks = 256 / options.num_tccs #number of data banks
254 self.tagArrayBanks = 256 / options.num_tccs #number of tag banks
255 self.size.value = self.size.value / options.num_tccs
256 if ((self.size.value / long(self.assoc)) < 128):
257 self.size.value = long(128 * self.assoc)
258 self.start_index_bit = math.log(options.cacheline_size, 2) + \
259 math.log(options.num_tccs, 2)
260 self.replacement_policy = TreePLRURP()
261
262
263 class TCCCntrl(TCC_Controller, CntrlBase):
264 def create(self, options, ruby_system, system):
265 self.version = self.versionCount()
266 self.L2cache = TCC()
267 self.L2cache.create(options)
268 self.L2cache.resourceStalls = options.no_tcc_resource_stalls
269
270 self.ruby_system = ruby_system
271
272 if options.recycle_latency:
273 self.recycle_latency = options.recycle_latency
274
275 class L3Cache(RubyCache):
276 dataArrayBanks = 16
277 tagArrayBanks = 16
278
279 def create(self, options, ruby_system, system):
280 self.size = MemorySize(options.l3_size)
281 self.size.value /= options.num_dirs
282 self.assoc = options.l3_assoc
283 self.dataArrayBanks /= options.num_dirs
284 self.tagArrayBanks /= options.num_dirs
285 self.dataArrayBanks /= options.num_dirs
286 self.tagArrayBanks /= options.num_dirs
287 self.dataAccessLatency = options.l3_data_latency
288 self.tagAccessLatency = options.l3_tag_latency
289 self.resourceStalls = False
290 self.replacement_policy = TreePLRURP()
291
292 class L3Cntrl(L3Cache_Controller, CntrlBase):
293 def create(self, options, ruby_system, system):
294 self.version = self.versionCount()
295 self.L3cache = L3Cache()
296 self.L3cache.create(options, ruby_system, system)
297
298 self.l3_response_latency = max(self.L3cache.dataAccessLatency, self.L3cache.tagAccessLatency)
299 self.ruby_system = ruby_system
300
301 if options.recycle_latency:
302 self.recycle_latency = options.recycle_latency
303
304 def connectWireBuffers(self, req_to_dir, resp_to_dir, l3_unblock_to_dir,
305 req_to_l3, probe_to_l3, resp_to_l3):
306 self.reqToDir = req_to_dir
307 self.respToDir = resp_to_dir
308 self.l3UnblockToDir = l3_unblock_to_dir
309 self.reqToL3 = req_to_l3
310 self.probeToL3 = probe_to_l3
311 self.respToL3 = resp_to_l3
312
313 class DirMem(RubyDirectoryMemory, CntrlBase):
314 def create(self, options, ruby_system, system):
315 self.version = self.versionCount()
316
317 phys_mem_size = AddrRange(options.mem_size).size()
318 mem_module_size = phys_mem_size / options.num_dirs
319 dir_size = MemorySize('0B')
320 dir_size.value = mem_module_size
321 self.size = dir_size
322
323 class DirCntrl(Directory_Controller, CntrlBase):
324 def create(self, options, ruby_system, system):
325 self.version = self.versionCount()
326
327 self.response_latency = 30
328
329 self.directory = DirMem()
330 self.directory.create(options, ruby_system, system)
331
332 self.L3CacheMemory = L3Cache()
333 self.L3CacheMemory.create(options, ruby_system, system)
334
335 self.l3_hit_latency = max(self.L3CacheMemory.dataAccessLatency,
336 self.L3CacheMemory.tagAccessLatency)
337
338 self.number_of_TBEs = options.num_tbes
339
340 self.ruby_system = ruby_system
341
342 if options.recycle_latency:
343 self.recycle_latency = options.recycle_latency
344
345 def connectWireBuffers(self, req_to_dir, resp_to_dir, l3_unblock_to_dir,
346 req_to_l3, probe_to_l3, resp_to_l3):
347 self.reqToDir = req_to_dir
348 self.respToDir = resp_to_dir
349 self.l3UnblockToDir = l3_unblock_to_dir
350 self.reqToL3 = req_to_l3
351 self.probeToL3 = probe_to_l3
352 self.respToL3 = resp_to_l3
353
354 def define_options(parser):
355 parser.add_option("--num-subcaches", type = "int", default = 4)
356 parser.add_option("--l3-data-latency", type = "int", default = 20)
357 parser.add_option("--l3-tag-latency", type = "int", default = 15)
358 parser.add_option("--cpu-to-dir-latency", type = "int", default = 120)
359 parser.add_option("--gpu-to-dir-latency", type = "int", default = 120)
360 parser.add_option("--no-resource-stalls", action = "store_false",
361 default = True)
362 parser.add_option("--no-tcc-resource-stalls", action = "store_false",
363 default = True)
364 parser.add_option("--use-L3-on-WT", action = "store_true", default = False)
365 parser.add_option("--num-tbes", type = "int", default = 256)
366 parser.add_option("--l2-latency", type = "int", default = 50) # load to use
367 parser.add_option("--num-tccs", type = "int", default = 1,
368 help = "number of TCC banks in the GPU")
369 parser.add_option("--sqc-size", type = 'string', default = '32kB',
370 help = "SQC cache size")
371 parser.add_option("--sqc-assoc", type = 'int', default = 8,
372 help = "SQC cache assoc")
373 parser.add_option("--WB_L1", action = "store_true", default = False,
374 help = "writeback L1")
375 parser.add_option("--WB_L2", action = "store_true", default = False,
376 help = "writeback L2")
377 parser.add_option("--TCP_latency", type = "int", default = 4,
378 help = "TCP latency")
379 parser.add_option("--TCC_latency", type = "int", default = 16,
380 help = "TCC latency")
381 parser.add_option("--tcc-size", type = 'string', default = '256kB',
382 help = "agregate tcc size")
383 parser.add_option("--tcc-assoc", type = 'int', default = 16,
384 help = "tcc assoc")
385 parser.add_option("--tcp-size", type = 'string', default = '16kB',
386 help = "tcp size")
387 parser.add_option("--tcp-assoc", type = 'int', default = 16,
388 help = "tcp assoc")
389 parser.add_option("--noL1", action = "store_true", default = False,
390 help = "bypassL1")
391
392 def create_system(options, full_system, system, dma_devices, bootmem,
393 ruby_system):
394 if buildEnv['PROTOCOL'] != 'GPU_VIPER':
395 panic("This script requires the GPU_VIPER protocol to be built.")
396
397 cpu_sequencers = []
398
399 #
400 # The ruby network creation expects the list of nodes in the system to be
401 # consistent with the NetDest list. Therefore the l1 controller nodes
402 # must be listed before the directory nodes and directory nodes before
403 # dma nodes, etc.
404 #
405 cp_cntrl_nodes = []
406 tcp_cntrl_nodes = []
407 sqc_cntrl_nodes = []
408 tcc_cntrl_nodes = []
409 dir_cntrl_nodes = []
410 l3_cntrl_nodes = []
411
412 #
413 # Must create the individual controllers before the network to ensure the
414 # controller constructors are called before the network constructor
415 #
416
417 # For an odd number of CPUs, still create the right number of controllers
418 TCC_bits = int(math.log(options.num_tccs, 2))
419
420 # This is the base crossbar that connects the L3s, Dirs, and cpu/gpu
421 # Clusters
422 crossbar_bw = None
423 mainCluster = None
424 if hasattr(options, 'bw_scalor') and options.bw_scalor > 0:
425 #Assuming a 2GHz clock
426 crossbar_bw = 16 * options.num_compute_units * options.bw_scalor
427 mainCluster = Cluster(intBW=crossbar_bw)
428 else:
429 mainCluster = Cluster(intBW=8) # 16 GB/s
430 for i in range(options.num_dirs):
431
432 dir_cntrl = DirCntrl(noTCCdir = True, TCC_select_num_bits = TCC_bits)
433 dir_cntrl.create(options, ruby_system, system)
434 dir_cntrl.number_of_TBEs = options.num_tbes
435 dir_cntrl.useL3OnWT = options.use_L3_on_WT
436 # the number_of_TBEs is inclusive of TBEs below
437
438 # Connect the Directory controller to the ruby network
439 dir_cntrl.requestFromCores = MessageBuffer(ordered = True)
440 dir_cntrl.requestFromCores.slave = ruby_system.network.master
441
442 dir_cntrl.responseFromCores = MessageBuffer()
443 dir_cntrl.responseFromCores.slave = ruby_system.network.master
444
445 dir_cntrl.unblockFromCores = MessageBuffer()
446 dir_cntrl.unblockFromCores.slave = ruby_system.network.master
447
448 dir_cntrl.probeToCore = MessageBuffer()
449 dir_cntrl.probeToCore.master = ruby_system.network.slave
450
451 dir_cntrl.responseToCore = MessageBuffer()
452 dir_cntrl.responseToCore.master = ruby_system.network.slave
453
454 dir_cntrl.triggerQueue = MessageBuffer(ordered = True)
455 dir_cntrl.L3triggerQueue = MessageBuffer(ordered = True)
456 dir_cntrl.responseFromMemory = MessageBuffer()
457
458 exec("ruby_system.dir_cntrl%d = dir_cntrl" % i)
459 dir_cntrl_nodes.append(dir_cntrl)
460
461 mainCluster.add(dir_cntrl)
462
463 cpuCluster = None
464 if hasattr(options, 'bw_scalor') and options.bw_scalor > 0:
465 cpuCluster = Cluster(extBW = crossbar_bw, intBW = crossbar_bw)
466 else:
467 cpuCluster = Cluster(extBW = 8, intBW = 8) # 16 GB/s
468 for i in range((options.num_cpus + 1) // 2):
469
470 cp_cntrl = CPCntrl()
471 cp_cntrl.create(options, ruby_system, system)
472
473 exec("ruby_system.cp_cntrl%d = cp_cntrl" % i)
474 #
475 # Add controllers and sequencers to the appropriate lists
476 #
477 cpu_sequencers.extend([cp_cntrl.sequencer, cp_cntrl.sequencer1])
478
479 # Connect the CP controllers and the network
480 cp_cntrl.requestFromCore = MessageBuffer()
481 cp_cntrl.requestFromCore.master = ruby_system.network.slave
482
483 cp_cntrl.responseFromCore = MessageBuffer()
484 cp_cntrl.responseFromCore.master = ruby_system.network.slave
485
486 cp_cntrl.unblockFromCore = MessageBuffer()
487 cp_cntrl.unblockFromCore.master = ruby_system.network.slave
488
489 cp_cntrl.probeToCore = MessageBuffer()
490 cp_cntrl.probeToCore.slave = ruby_system.network.master
491
492 cp_cntrl.responseToCore = MessageBuffer()
493 cp_cntrl.responseToCore.slave = ruby_system.network.master
494
495 cp_cntrl.mandatoryQueue = MessageBuffer()
496 cp_cntrl.triggerQueue = MessageBuffer(ordered = True)
497
498 cpuCluster.add(cp_cntrl)
499
500 # Register CPUs and caches for each CorePair and directory (SE mode only)
501 if not full_system:
502 for i in xrange((options.num_cpus + 1) // 2):
503 FileSystemConfig.register_cpu(physical_package_id = 0,
504 core_siblings = \
505 xrange(options.num_cpus),
506 core_id = i*2,
507 thread_siblings = [])
508
509 FileSystemConfig.register_cpu(physical_package_id = 0,
510 core_siblings = \
511 xrange(options.num_cpus),
512 core_id = i*2+1,
513 thread_siblings = [])
514
515 FileSystemConfig.register_cache(level = 0,
516 idu_type = 'Instruction',
517 size = options.l1i_size,
518 line_size = options.cacheline_size,
519 assoc = options.l1i_assoc,
520 cpus = [i*2, i*2+1])
521
522 FileSystemConfig.register_cache(level = 0,
523 idu_type = 'Data',
524 size = options.l1d_size,
525 line_size = options.cacheline_size,
526 assoc = options.l1d_assoc,
527 cpus = [i*2])
528
529 FileSystemConfig.register_cache(level = 0,
530 idu_type = 'Data',
531 size = options.l1d_size,
532 line_size = options.cacheline_size,
533 assoc = options.l1d_assoc,
534 cpus = [i*2+1])
535
536 FileSystemConfig.register_cache(level = 1,
537 idu_type = 'Unified',
538 size = options.l2_size,
539 line_size = options.cacheline_size,
540 assoc = options.l2_assoc,
541 cpus = [i*2, i*2+1])
542
543 for i in range(options.num_dirs):
544 FileSystemConfig.register_cache(level = 2,
545 idu_type = 'Unified',
546 size = options.l3_size,
547 line_size = options.cacheline_size,
548 assoc = options.l3_assoc,
549 cpus = [n for n in
550 xrange(options.num_cpus)])
551
552 gpuCluster = None
553 if hasattr(options, 'bw_scalor') and options.bw_scalor > 0:
554 gpuCluster = Cluster(extBW = crossbar_bw, intBW = crossbar_bw)
555 else:
556 gpuCluster = Cluster(extBW = 8, intBW = 8) # 16 GB/s
557 for i in range(options.num_compute_units):
558
559 tcp_cntrl = TCPCntrl(TCC_select_num_bits = TCC_bits,
560 issue_latency = 1,
561 number_of_TBEs = 2560)
562 # TBEs set to max outstanding requests
563 tcp_cntrl.create(options, ruby_system, system)
564 tcp_cntrl.WB = options.WB_L1
565 tcp_cntrl.disableL1 = options.noL1
566 tcp_cntrl.L1cache.tagAccessLatency = options.TCP_latency
567 tcp_cntrl.L1cache.dataAccessLatency = options.TCP_latency
568
569 exec("ruby_system.tcp_cntrl%d = tcp_cntrl" % i)
570 #
571 # Add controllers and sequencers to the appropriate lists
572 #
573 cpu_sequencers.append(tcp_cntrl.coalescer)
574 tcp_cntrl_nodes.append(tcp_cntrl)
575
576 # Connect the TCP controller to the ruby network
577 tcp_cntrl.requestFromTCP = MessageBuffer(ordered = True)
578 tcp_cntrl.requestFromTCP.master = ruby_system.network.slave
579
580 tcp_cntrl.responseFromTCP = MessageBuffer(ordered = True)
581 tcp_cntrl.responseFromTCP.master = ruby_system.network.slave
582
583 tcp_cntrl.unblockFromCore = MessageBuffer()
584 tcp_cntrl.unblockFromCore.master = ruby_system.network.slave
585
586 tcp_cntrl.probeToTCP = MessageBuffer(ordered = True)
587 tcp_cntrl.probeToTCP.slave = ruby_system.network.master
588
589 tcp_cntrl.responseToTCP = MessageBuffer(ordered = True)
590 tcp_cntrl.responseToTCP.slave = ruby_system.network.master
591
592 tcp_cntrl.mandatoryQueue = MessageBuffer()
593
594 gpuCluster.add(tcp_cntrl)
595
596 for i in range(options.num_sqc):
597
598 sqc_cntrl = SQCCntrl(TCC_select_num_bits = TCC_bits)
599 sqc_cntrl.create(options, ruby_system, system)
600
601 exec("ruby_system.sqc_cntrl%d = sqc_cntrl" % i)
602 #
603 # Add controllers and sequencers to the appropriate lists
604 #
605 cpu_sequencers.append(sqc_cntrl.sequencer)
606
607 # Connect the SQC controller to the ruby network
608 sqc_cntrl.requestFromSQC = MessageBuffer(ordered = True)
609 sqc_cntrl.requestFromSQC.master = ruby_system.network.slave
610
611 sqc_cntrl.probeToSQC = MessageBuffer(ordered = True)
612 sqc_cntrl.probeToSQC.slave = ruby_system.network.master
613
614 sqc_cntrl.responseToSQC = MessageBuffer(ordered = True)
615 sqc_cntrl.responseToSQC.slave = ruby_system.network.master
616
617 sqc_cntrl.mandatoryQueue = MessageBuffer()
618
619 # SQC also in GPU cluster
620 gpuCluster.add(sqc_cntrl)
621
622 for i in range(options.num_cp):
623
624 tcp_ID = options.num_compute_units + i
625 sqc_ID = options.num_sqc + i
626
627 tcp_cntrl = TCPCntrl(TCC_select_num_bits = TCC_bits,
628 issue_latency = 1,
629 number_of_TBEs = 2560)
630 # TBEs set to max outstanding requests
631 tcp_cntrl.createCP(options, ruby_system, system)
632 tcp_cntrl.WB = options.WB_L1
633 tcp_cntrl.disableL1 = options.noL1
634 tcp_cntrl.L1cache.tagAccessLatency = options.TCP_latency
635 tcp_cntrl.L1cache.dataAccessLatency = options.TCP_latency
636
637 exec("ruby_system.tcp_cntrl%d = tcp_cntrl" % tcp_ID)
638 #
639 # Add controllers and sequencers to the appropriate lists
640 #
641 cpu_sequencers.append(tcp_cntrl.sequencer)
642 tcp_cntrl_nodes.append(tcp_cntrl)
643
644 # Connect the CP (TCP) controllers to the ruby network
645 tcp_cntrl.requestFromTCP = MessageBuffer(ordered = True)
646 tcp_cntrl.requestFromTCP.master = ruby_system.network.slave
647
648 tcp_cntrl.responseFromTCP = MessageBuffer(ordered = True)
649 tcp_cntrl.responseFromTCP.master = ruby_system.network.slave
650
651 tcp_cntrl.unblockFromCore = MessageBuffer(ordered = True)
652 tcp_cntrl.unblockFromCore.master = ruby_system.network.slave
653
654 tcp_cntrl.probeToTCP = MessageBuffer(ordered = True)
655 tcp_cntrl.probeToTCP.slave = ruby_system.network.master
656
657 tcp_cntrl.responseToTCP = MessageBuffer(ordered = True)
658 tcp_cntrl.responseToTCP.slave = ruby_system.network.master
659
660 tcp_cntrl.mandatoryQueue = MessageBuffer()
661
662 gpuCluster.add(tcp_cntrl)
663
664 sqc_cntrl = SQCCntrl(TCC_select_num_bits = TCC_bits)
665 sqc_cntrl.create(options, ruby_system, system)
666
667 exec("ruby_system.sqc_cntrl%d = sqc_cntrl" % sqc_ID)
668 #
669 # Add controllers and sequencers to the appropriate lists
670 #
671 cpu_sequencers.append(sqc_cntrl.sequencer)
672
673 # SQC also in GPU cluster
674 gpuCluster.add(sqc_cntrl)
675
676 for i in range(options.num_tccs):
677
678 tcc_cntrl = TCCCntrl(l2_response_latency = options.TCC_latency)
679 tcc_cntrl.create(options, ruby_system, system)
680 tcc_cntrl.l2_request_latency = options.gpu_to_dir_latency
681 tcc_cntrl.l2_response_latency = options.TCC_latency
682 tcc_cntrl_nodes.append(tcc_cntrl)
683 tcc_cntrl.WB = options.WB_L2
684 tcc_cntrl.number_of_TBEs = 2560 * options.num_compute_units
685 # the number_of_TBEs is inclusive of TBEs below
686
687 # Connect the TCC controllers to the ruby network
688 tcc_cntrl.requestFromTCP = MessageBuffer(ordered = True)
689 tcc_cntrl.requestFromTCP.slave = ruby_system.network.master
690
691 tcc_cntrl.responseToCore = MessageBuffer(ordered = True)
692 tcc_cntrl.responseToCore.master = ruby_system.network.slave
693
694 tcc_cntrl.probeFromNB = MessageBuffer()
695 tcc_cntrl.probeFromNB.slave = ruby_system.network.master
696
697 tcc_cntrl.responseFromNB = MessageBuffer()
698 tcc_cntrl.responseFromNB.slave = ruby_system.network.master
699
700 tcc_cntrl.requestToNB = MessageBuffer(ordered = True)
701 tcc_cntrl.requestToNB.master = ruby_system.network.slave
702
703 tcc_cntrl.responseToNB = MessageBuffer()
704 tcc_cntrl.responseToNB.master = ruby_system.network.slave
705
706 tcc_cntrl.unblockToNB = MessageBuffer()
707 tcc_cntrl.unblockToNB.master = ruby_system.network.slave
708
709 tcc_cntrl.triggerQueue = MessageBuffer(ordered = True)
710
711 exec("ruby_system.tcc_cntrl%d = tcc_cntrl" % i)
712
713 # connect all of the wire buffers between L3 and dirs up
714 # TCC cntrls added to the GPU cluster
715 gpuCluster.add(tcc_cntrl)
716
717 # Assuming no DMA devices
718 assert(len(dma_devices) == 0)
719
720 # Add cpu/gpu clusters to main cluster
721 mainCluster.add(cpuCluster)
722 mainCluster.add(gpuCluster)
723
724 ruby_system.network.number_of_virtual_networks = 10
725
726 return (cpu_sequencers, dir_cntrl_nodes, mainCluster)