1 # Copyright (c) 2011-2015 Advanced Micro Devices, Inc.
4 # For use for simulation and test purposes only
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
9 # 1. Redistributions of source code must retain the above copyright notice,
10 # this list of conditions and the following disclaimer.
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.
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.
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.
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
42 from topologies
.Cluster
import Cluster
43 from topologies
.Crossbar
import Crossbar
49 # Use SeqCount not class since we need global count
51 return CntrlBase
._seqs
- 1
56 # Use CntlCount not class since we need global count
57 CntrlBase
._cntrls
+= 1
58 return CntrlBase
._cntrls
- 1
62 def versionCount(cls
):
63 cls
._version
+= 1 # Use count for this particular type
64 return cls
._version
- 1
66 class L1Cache(RubyCache
):
67 resourceStalls
= False
72 def create(self
, size
, assoc
, options
):
73 self
.size
= MemorySize(size
)
75 self
.replacement_policy
= TreePLRURP()
77 class L2Cache(RubyCache
):
78 resourceStalls
= False
82 def create(self
, size
, assoc
, options
):
83 self
.size
= MemorySize(size
)
85 self
.replacement_policy
= TreePLRURP()
87 class CPCntrl(CorePair_Controller
, CntrlBase
):
89 def create(self
, options
, ruby_system
, system
):
90 self
.version
= self
.versionCount()
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
)
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
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
117 self
.issue_latency
= options
.cpu_to_dir_latency
118 self
.send_evictions
= send_evicts(options
)
120 self
.ruby_system
= ruby_system
122 if options
.recycle_latency
:
123 self
.recycle_latency
= options
.recycle_latency
125 class TCPCache(RubyCache
):
128 dataArrayBanks
= 16 #number of data banks
129 tagArrayBanks
= 16 #number of tag banks
130 dataAccessLatency
= 4
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()
138 class TCPCntrl(TCP_Controller
, CntrlBase
):
140 def create(self
, options
, ruby_system
, system
):
141 self
.version
= self
.versionCount()
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
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
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
164 self
.use_seq_not_coal
= False
166 self
.ruby_system
= ruby_system
168 if options
.recycle_latency
:
169 self
.recycle_latency
= options
.recycle_latency
171 def createCP(self
, options
, ruby_system
, system
):
172 self
.version
= self
.versionCount()
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
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
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
195 self
.use_seq_not_coal
= True
197 self
.ruby_system
= ruby_system
199 if options
.recycle_latency
:
200 self
.recycle_latency
= options
.recycle_latency
202 class SQCCache(RubyCache
):
205 dataAccessLatency
= 1
208 def create(self
, options
):
209 self
.size
= MemorySize(options
.sqc_size
)
210 self
.assoc
= options
.sqc_assoc
211 self
.replacement_policy
= TreePLRURP()
213 class SQCCntrl(SQC_Controller
, CntrlBase
):
215 def create(self
, options
, ruby_system
, system
):
216 self
.version
= self
.versionCount()
218 self
.L1cache
= SQCCache()
219 self
.L1cache
.create(options
)
220 self
.L1cache
.resourceStalls
= options
.no_resource_stalls
222 self
.sequencer
= RubySequencer()
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
231 self
.ruby_system
= ruby_system
233 if options
.recycle_latency
:
234 self
.recycle_latency
= options
.recycle_latency
236 class TCC(RubyCache
):
237 size
= MemorySize("256kB")
239 dataAccessLatency
= 8
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
247 tcc_size
= str(tcc_size
)+'kB'
248 self
.size
= MemorySize(tcc_size
)
249 self
.dataArrayBanks
= 64
250 self
.tagArrayBanks
= 64
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()
263 class TCCCntrl(TCC_Controller
, CntrlBase
):
264 def create(self
, options
, ruby_system
, system
):
265 self
.version
= self
.versionCount()
267 self
.L2cache
.create(options
)
268 self
.L2cache
.resourceStalls
= options
.no_tcc_resource_stalls
270 self
.ruby_system
= ruby_system
272 if options
.recycle_latency
:
273 self
.recycle_latency
= options
.recycle_latency
275 class L3Cache(RubyCache
):
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()
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
)
298 self
.l3_response_latency
= max(self
.L3cache
.dataAccessLatency
, self
.L3cache
.tagAccessLatency
)
299 self
.ruby_system
= ruby_system
301 if options
.recycle_latency
:
302 self
.recycle_latency
= options
.recycle_latency
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
313 class DirMem(RubyDirectoryMemory
, CntrlBase
):
314 def create(self
, options
, ruby_system
, system
):
315 self
.version
= self
.versionCount()
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
323 class DirCntrl(Directory_Controller
, CntrlBase
):
324 def create(self
, options
, ruby_system
, system
):
325 self
.version
= self
.versionCount()
327 self
.response_latency
= 30
329 self
.directory
= DirMem()
330 self
.directory
.create(options
, ruby_system
, system
)
332 self
.L3CacheMemory
= L3Cache()
333 self
.L3CacheMemory
.create(options
, ruby_system
, system
)
335 self
.l3_hit_latency
= max(self
.L3CacheMemory
.dataAccessLatency
,
336 self
.L3CacheMemory
.tagAccessLatency
)
338 self
.number_of_TBEs
= options
.num_tbes
340 self
.ruby_system
= ruby_system
342 if options
.recycle_latency
:
343 self
.recycle_latency
= options
.recycle_latency
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
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",
362 parser
.add_option("--no-tcc-resource-stalls", action
= "store_false",
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,
385 parser
.add_option("--tcp-size", type = 'string', default
= '16kB',
387 parser
.add_option("--tcp-assoc", type = 'int', default
= 16,
389 parser
.add_option("--noL1", action
= "store_true", default
= False,
392 def create_system(options
, full_system
, system
, dma_devices
, bootmem
,
394 if buildEnv
['PROTOCOL'] != 'GPU_VIPER':
395 panic("This script requires the GPU_VIPER protocol to be built.")
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
413 # Must create the individual controllers before the network to ensure the
414 # controller constructors are called before the network constructor
417 # For an odd number of CPUs, still create the right number of controllers
418 TCC_bits
= int(math
.log(options
.num_tccs
, 2))
420 # This is the base crossbar that connects the L3s, Dirs, and cpu/gpu
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
)
429 mainCluster
= Cluster(intBW
=8) # 16 GB/s
430 for i
in range(options
.num_dirs
):
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
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
442 dir_cntrl
.responseFromCores
= MessageBuffer()
443 dir_cntrl
.responseFromCores
.slave
= ruby_system
.network
.master
445 dir_cntrl
.unblockFromCores
= MessageBuffer()
446 dir_cntrl
.unblockFromCores
.slave
= ruby_system
.network
.master
448 dir_cntrl
.probeToCore
= MessageBuffer()
449 dir_cntrl
.probeToCore
.master
= ruby_system
.network
.slave
451 dir_cntrl
.responseToCore
= MessageBuffer()
452 dir_cntrl
.responseToCore
.master
= ruby_system
.network
.slave
454 dir_cntrl
.triggerQueue
= MessageBuffer(ordered
= True)
455 dir_cntrl
.L3triggerQueue
= MessageBuffer(ordered
= True)
456 dir_cntrl
.requestToMemory
= MessageBuffer()
457 dir_cntrl
.responseFromMemory
= MessageBuffer()
459 exec("ruby_system.dir_cntrl%d = dir_cntrl" % i
)
460 dir_cntrl_nodes
.append(dir_cntrl
)
462 mainCluster
.add(dir_cntrl
)
465 if hasattr(options
, 'bw_scalor') and options
.bw_scalor
> 0:
466 cpuCluster
= Cluster(extBW
= crossbar_bw
, intBW
= crossbar_bw
)
468 cpuCluster
= Cluster(extBW
= 8, intBW
= 8) # 16 GB/s
469 for i
in range((options
.num_cpus
+ 1) // 2):
472 cp_cntrl
.create(options
, ruby_system
, system
)
474 exec("ruby_system.cp_cntrl%d = cp_cntrl" % i
)
476 # Add controllers and sequencers to the appropriate lists
478 cpu_sequencers
.extend([cp_cntrl
.sequencer
, cp_cntrl
.sequencer1
])
480 # Connect the CP controllers and the network
481 cp_cntrl
.requestFromCore
= MessageBuffer()
482 cp_cntrl
.requestFromCore
.master
= ruby_system
.network
.slave
484 cp_cntrl
.responseFromCore
= MessageBuffer()
485 cp_cntrl
.responseFromCore
.master
= ruby_system
.network
.slave
487 cp_cntrl
.unblockFromCore
= MessageBuffer()
488 cp_cntrl
.unblockFromCore
.master
= ruby_system
.network
.slave
490 cp_cntrl
.probeToCore
= MessageBuffer()
491 cp_cntrl
.probeToCore
.slave
= ruby_system
.network
.master
493 cp_cntrl
.responseToCore
= MessageBuffer()
494 cp_cntrl
.responseToCore
.slave
= ruby_system
.network
.master
496 cp_cntrl
.mandatoryQueue
= MessageBuffer()
497 cp_cntrl
.triggerQueue
= MessageBuffer(ordered
= True)
499 cpuCluster
.add(cp_cntrl
)
501 # Register CPUs and caches for each CorePair and directory (SE mode only)
503 for i
in xrange((options
.num_cpus
+ 1) // 2):
504 FileSystemConfig
.register_cpu(physical_package_id
= 0,
506 xrange(options
.num_cpus
),
508 thread_siblings
= [])
510 FileSystemConfig
.register_cpu(physical_package_id
= 0,
512 xrange(options
.num_cpus
),
514 thread_siblings
= [])
516 FileSystemConfig
.register_cache(level
= 0,
517 idu_type
= 'Instruction',
518 size
= options
.l1i_size
,
519 line_size
= options
.cacheline_size
,
520 assoc
= options
.l1i_assoc
,
523 FileSystemConfig
.register_cache(level
= 0,
525 size
= options
.l1d_size
,
526 line_size
= options
.cacheline_size
,
527 assoc
= options
.l1d_assoc
,
530 FileSystemConfig
.register_cache(level
= 0,
532 size
= options
.l1d_size
,
533 line_size
= options
.cacheline_size
,
534 assoc
= options
.l1d_assoc
,
537 FileSystemConfig
.register_cache(level
= 1,
538 idu_type
= 'Unified',
539 size
= options
.l2_size
,
540 line_size
= options
.cacheline_size
,
541 assoc
= options
.l2_assoc
,
544 for i
in range(options
.num_dirs
):
545 FileSystemConfig
.register_cache(level
= 2,
546 idu_type
= 'Unified',
547 size
= options
.l3_size
,
548 line_size
= options
.cacheline_size
,
549 assoc
= options
.l3_assoc
,
551 xrange(options
.num_cpus
)])
554 if hasattr(options
, 'bw_scalor') and options
.bw_scalor
> 0:
555 gpuCluster
= Cluster(extBW
= crossbar_bw
, intBW
= crossbar_bw
)
557 gpuCluster
= Cluster(extBW
= 8, intBW
= 8) # 16 GB/s
558 for i
in range(options
.num_compute_units
):
560 tcp_cntrl
= TCPCntrl(TCC_select_num_bits
= TCC_bits
,
562 number_of_TBEs
= 2560)
563 # TBEs set to max outstanding requests
564 tcp_cntrl
.create(options
, ruby_system
, system
)
565 tcp_cntrl
.WB
= options
.WB_L1
566 tcp_cntrl
.disableL1
= options
.noL1
567 tcp_cntrl
.L1cache
.tagAccessLatency
= options
.TCP_latency
568 tcp_cntrl
.L1cache
.dataAccessLatency
= options
.TCP_latency
570 exec("ruby_system.tcp_cntrl%d = tcp_cntrl" % i
)
572 # Add controllers and sequencers to the appropriate lists
574 cpu_sequencers
.append(tcp_cntrl
.coalescer
)
575 tcp_cntrl_nodes
.append(tcp_cntrl
)
577 # Connect the TCP controller to the ruby network
578 tcp_cntrl
.requestFromTCP
= MessageBuffer(ordered
= True)
579 tcp_cntrl
.requestFromTCP
.master
= ruby_system
.network
.slave
581 tcp_cntrl
.responseFromTCP
= MessageBuffer(ordered
= True)
582 tcp_cntrl
.responseFromTCP
.master
= ruby_system
.network
.slave
584 tcp_cntrl
.unblockFromCore
= MessageBuffer()
585 tcp_cntrl
.unblockFromCore
.master
= ruby_system
.network
.slave
587 tcp_cntrl
.probeToTCP
= MessageBuffer(ordered
= True)
588 tcp_cntrl
.probeToTCP
.slave
= ruby_system
.network
.master
590 tcp_cntrl
.responseToTCP
= MessageBuffer(ordered
= True)
591 tcp_cntrl
.responseToTCP
.slave
= ruby_system
.network
.master
593 tcp_cntrl
.mandatoryQueue
= MessageBuffer()
595 gpuCluster
.add(tcp_cntrl
)
597 for i
in range(options
.num_sqc
):
599 sqc_cntrl
= SQCCntrl(TCC_select_num_bits
= TCC_bits
)
600 sqc_cntrl
.create(options
, ruby_system
, system
)
602 exec("ruby_system.sqc_cntrl%d = sqc_cntrl" % i
)
604 # Add controllers and sequencers to the appropriate lists
606 cpu_sequencers
.append(sqc_cntrl
.sequencer
)
608 # Connect the SQC controller to the ruby network
609 sqc_cntrl
.requestFromSQC
= MessageBuffer(ordered
= True)
610 sqc_cntrl
.requestFromSQC
.master
= ruby_system
.network
.slave
612 sqc_cntrl
.probeToSQC
= MessageBuffer(ordered
= True)
613 sqc_cntrl
.probeToSQC
.slave
= ruby_system
.network
.master
615 sqc_cntrl
.responseToSQC
= MessageBuffer(ordered
= True)
616 sqc_cntrl
.responseToSQC
.slave
= ruby_system
.network
.master
618 sqc_cntrl
.mandatoryQueue
= MessageBuffer()
620 # SQC also in GPU cluster
621 gpuCluster
.add(sqc_cntrl
)
623 for i
in range(options
.num_cp
):
625 tcp_ID
= options
.num_compute_units
+ i
626 sqc_ID
= options
.num_sqc
+ i
628 tcp_cntrl
= TCPCntrl(TCC_select_num_bits
= TCC_bits
,
630 number_of_TBEs
= 2560)
631 # TBEs set to max outstanding requests
632 tcp_cntrl
.createCP(options
, ruby_system
, system
)
633 tcp_cntrl
.WB
= options
.WB_L1
634 tcp_cntrl
.disableL1
= options
.noL1
635 tcp_cntrl
.L1cache
.tagAccessLatency
= options
.TCP_latency
636 tcp_cntrl
.L1cache
.dataAccessLatency
= options
.TCP_latency
638 exec("ruby_system.tcp_cntrl%d = tcp_cntrl" % tcp_ID
)
640 # Add controllers and sequencers to the appropriate lists
642 cpu_sequencers
.append(tcp_cntrl
.sequencer
)
643 tcp_cntrl_nodes
.append(tcp_cntrl
)
645 # Connect the CP (TCP) controllers to the ruby network
646 tcp_cntrl
.requestFromTCP
= MessageBuffer(ordered
= True)
647 tcp_cntrl
.requestFromTCP
.master
= ruby_system
.network
.slave
649 tcp_cntrl
.responseFromTCP
= MessageBuffer(ordered
= True)
650 tcp_cntrl
.responseFromTCP
.master
= ruby_system
.network
.slave
652 tcp_cntrl
.unblockFromCore
= MessageBuffer(ordered
= True)
653 tcp_cntrl
.unblockFromCore
.master
= ruby_system
.network
.slave
655 tcp_cntrl
.probeToTCP
= MessageBuffer(ordered
= True)
656 tcp_cntrl
.probeToTCP
.slave
= ruby_system
.network
.master
658 tcp_cntrl
.responseToTCP
= MessageBuffer(ordered
= True)
659 tcp_cntrl
.responseToTCP
.slave
= ruby_system
.network
.master
661 tcp_cntrl
.mandatoryQueue
= MessageBuffer()
663 gpuCluster
.add(tcp_cntrl
)
665 sqc_cntrl
= SQCCntrl(TCC_select_num_bits
= TCC_bits
)
666 sqc_cntrl
.create(options
, ruby_system
, system
)
668 exec("ruby_system.sqc_cntrl%d = sqc_cntrl" % sqc_ID
)
670 # Add controllers and sequencers to the appropriate lists
672 cpu_sequencers
.append(sqc_cntrl
.sequencer
)
674 # SQC also in GPU cluster
675 gpuCluster
.add(sqc_cntrl
)
677 for i
in range(options
.num_tccs
):
679 tcc_cntrl
= TCCCntrl(l2_response_latency
= options
.TCC_latency
)
680 tcc_cntrl
.create(options
, ruby_system
, system
)
681 tcc_cntrl
.l2_request_latency
= options
.gpu_to_dir_latency
682 tcc_cntrl
.l2_response_latency
= options
.TCC_latency
683 tcc_cntrl_nodes
.append(tcc_cntrl
)
684 tcc_cntrl
.WB
= options
.WB_L2
685 tcc_cntrl
.number_of_TBEs
= 2560 * options
.num_compute_units
686 # the number_of_TBEs is inclusive of TBEs below
688 # Connect the TCC controllers to the ruby network
689 tcc_cntrl
.requestFromTCP
= MessageBuffer(ordered
= True)
690 tcc_cntrl
.requestFromTCP
.slave
= ruby_system
.network
.master
692 tcc_cntrl
.responseToCore
= MessageBuffer(ordered
= True)
693 tcc_cntrl
.responseToCore
.master
= ruby_system
.network
.slave
695 tcc_cntrl
.probeFromNB
= MessageBuffer()
696 tcc_cntrl
.probeFromNB
.slave
= ruby_system
.network
.master
698 tcc_cntrl
.responseFromNB
= MessageBuffer()
699 tcc_cntrl
.responseFromNB
.slave
= ruby_system
.network
.master
701 tcc_cntrl
.requestToNB
= MessageBuffer(ordered
= True)
702 tcc_cntrl
.requestToNB
.master
= ruby_system
.network
.slave
704 tcc_cntrl
.responseToNB
= MessageBuffer()
705 tcc_cntrl
.responseToNB
.master
= ruby_system
.network
.slave
707 tcc_cntrl
.unblockToNB
= MessageBuffer()
708 tcc_cntrl
.unblockToNB
.master
= ruby_system
.network
.slave
710 tcc_cntrl
.triggerQueue
= MessageBuffer(ordered
= True)
712 exec("ruby_system.tcc_cntrl%d = tcc_cntrl" % i
)
714 # connect all of the wire buffers between L3 and dirs up
715 # TCC cntrls added to the GPU cluster
716 gpuCluster
.add(tcc_cntrl
)
718 # Assuming no DMA devices
719 assert(len(dma_devices
) == 0)
721 # Add cpu/gpu clusters to main cluster
722 mainCluster
.add(cpuCluster
)
723 mainCluster
.add(gpuCluster
)
725 ruby_system
.network
.number_of_virtual_networks
= 10
727 return (cpu_sequencers
, dir_cntrl_nodes
, mainCluster
)