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 TccDirCache(RubyCache
):
69 resourceStalls
= False
70 def create(self
, options
):
71 self
.size
= MemorySize(options
.tcc_size
)
72 self
.size
.value
+= (options
.num_compute_units
*
73 (MemorySize(options
.tcp_size
).value
) *
74 options
.tcc_dir_factor
) / long(options
.num_tccs
)
75 self
.start_index_bit
= math
.log(options
.cacheline_size
, 2) + \
76 math
.log(options
.num_tccs
, 2)
77 self
.replacement_policy
= TreePLRURP()
79 class L1DCache(RubyCache
):
80 resourceStalls
= False
81 def create(self
, options
):
82 self
.size
= MemorySize(options
.l1d_size
)
83 self
.assoc
= options
.l1d_assoc
84 self
.replacement_policy
= TreePLRURP()
86 class L1ICache(RubyCache
):
87 resourceStalls
= False
88 def create(self
, options
):
89 self
.size
= MemorySize(options
.l1i_size
)
90 self
.assoc
= options
.l1i_assoc
91 self
.replacement_policy
= TreePLRURP()
93 class L2Cache(RubyCache
):
94 resourceStalls
= False
95 def create(self
, options
):
96 self
.size
= MemorySize(options
.l2_size
)
97 self
.assoc
= options
.l2_assoc
98 self
.replacement_policy
= TreePLRURP()
101 class CPCntrl(CorePair_Controller
, CntrlBase
):
103 def create(self
, options
, ruby_system
, system
):
104 self
.version
= self
.versionCount()
106 self
.L1Icache
= L1ICache()
107 self
.L1Icache
.create(options
)
108 self
.L1D0cache
= L1DCache()
109 self
.L1D0cache
.create(options
)
110 self
.L1D1cache
= L1DCache()
111 self
.L1D1cache
.create(options
)
112 self
.L2cache
= L2Cache()
113 self
.L2cache
.create(options
)
115 self
.sequencer
= RubySequencer()
116 self
.sequencer
.version
= self
.seqCount()
117 self
.sequencer
.icache
= self
.L1Icache
118 self
.sequencer
.dcache
= self
.L1D0cache
119 self
.sequencer
.ruby_system
= ruby_system
120 self
.sequencer
.coreid
= 0
121 self
.sequencer
.is_cpu_sequencer
= True
123 self
.sequencer1
= RubySequencer()
124 self
.sequencer1
.version
= self
.seqCount()
125 self
.sequencer1
.icache
= self
.L1Icache
126 self
.sequencer1
.dcache
= self
.L1D1cache
127 self
.sequencer1
.ruby_system
= ruby_system
128 self
.sequencer1
.coreid
= 1
129 self
.sequencer1
.is_cpu_sequencer
= True
131 # Defines icache/dcache hit latency
132 self
.mandatory_queue_latency
= 2
134 self
.issue_latency
= options
.cpu_to_dir_latency
135 self
.send_evictions
= send_evicts(options
)
137 self
.ruby_system
= ruby_system
139 if options
.recycle_latency
:
140 self
.recycle_latency
= options
.recycle_latency
142 class TCPCache(RubyCache
):
146 dataAccessLatency
= 4
148 def create(self
, options
):
149 self
.size
= MemorySize(options
.tcp_size
)
150 self
.replacement_policy
= TreePLRURP()
152 class TCPCntrl(TCP_Controller
, CntrlBase
):
154 def create(self
, options
, ruby_system
, system
):
155 self
.version
= self
.versionCount()
157 self
.L1cache
= TCPCache(tagAccessLatency
= options
.TCP_latency
)
158 self
.L1cache
.resourceStalls
= options
.no_resource_stalls
159 self
.L1cache
.create(options
)
161 self
.coalescer
= RubyGPUCoalescer()
162 self
.coalescer
.version
= self
.seqCount()
163 self
.coalescer
.icache
= self
.L1cache
164 self
.coalescer
.dcache
= self
.L1cache
165 self
.coalescer
.ruby_system
= ruby_system
166 self
.coalescer
.support_inst_reqs
= False
167 self
.coalescer
.is_cpu_sequencer
= False
168 self
.coalescer
.max_outstanding_requests
= options
.simds_per_cu
* \
169 options
.wfs_per_simd
* \
172 self
.sequencer
= RubySequencer()
173 self
.sequencer
.version
= self
.seqCount()
174 self
.sequencer
.icache
= self
.L1cache
175 self
.sequencer
.dcache
= self
.L1cache
176 self
.sequencer
.ruby_system
= ruby_system
177 self
.sequencer
.is_cpu_sequencer
= True
179 self
.use_seq_not_coal
= False
181 self
.ruby_system
= ruby_system
183 if options
.recycle_latency
:
184 self
.recycle_latency
= options
.recycle_latency
186 def createCP(self
, options
, ruby_system
, system
):
187 self
.version
= self
.versionCount()
189 self
.L1cache
= TCPCache(tagAccessLatency
= options
.TCP_latency
)
190 self
.L1cache
.resourceStalls
= options
.no_resource_stalls
191 self
.L1cache
.create(options
)
193 self
.coalescer
= RubyGPUCoalescer()
194 self
.coalescer
.version
= self
.seqCount()
195 self
.coalescer
.icache
= self
.L1cache
196 self
.coalescer
.dcache
= self
.L1cache
197 self
.coalescer
.ruby_system
= ruby_system
198 self
.coalescer
.support_inst_reqs
= False
199 self
.coalescer
.is_cpu_sequencer
= False
201 self
.sequencer
= RubySequencer()
202 self
.sequencer
.version
= self
.seqCount()
203 self
.sequencer
.icache
= self
.L1cache
204 self
.sequencer
.dcache
= self
.L1cache
205 self
.sequencer
.ruby_system
= ruby_system
206 self
.sequencer
.is_cpu_sequencer
= True
208 self
.use_seq_not_coal
= True
210 self
.ruby_system
= ruby_system
212 if options
.recycle_latency
:
213 self
.recycle_latency
= options
.recycle_latency
215 class SQCCache(RubyCache
):
220 dataAccessLatency
= 4
222 def create(self
, options
):
223 self
.replacement_policy
= TreePLRURP()
225 class SQCCntrl(SQC_Controller
, CntrlBase
):
227 def create(self
, options
, ruby_system
, system
):
228 self
.version
= self
.versionCount()
230 self
.L1cache
= SQCCache()
231 self
.L1cache
.create(options
)
232 self
.L1cache
.resourceStalls
= options
.no_resource_stalls
234 self
.sequencer
= RubySequencer()
236 self
.sequencer
.version
= self
.seqCount()
237 self
.sequencer
.icache
= self
.L1cache
238 self
.sequencer
.dcache
= self
.L1cache
239 self
.sequencer
.ruby_system
= ruby_system
240 self
.sequencer
.support_data_reqs
= False
241 self
.sequencer
.is_cpu_sequencer
= False
243 self
.ruby_system
= ruby_system
245 if options
.recycle_latency
:
246 self
.recycle_latency
= options
.recycle_latency
248 def createCP(self
, options
, ruby_system
, system
):
249 self
.version
= self
.versionCount()
251 self
.L1cache
= SQCCache()
252 self
.L1cache
.create(options
)
253 self
.L1cache
.resourceStalls
= options
.no_resource_stalls
255 self
.sequencer
= RubySequencer()
257 self
.sequencer
.version
= self
.seqCount()
258 self
.sequencer
.icache
= self
.L1cache
259 self
.sequencer
.dcache
= self
.L1cache
260 self
.sequencer
.ruby_system
= ruby_system
261 self
.sequencer
.support_data_reqs
= False
263 self
.ruby_system
= ruby_system
265 if options
.recycle_latency
:
266 self
.recycle_latency
= options
.recycle_latency
269 class TCC(RubyCache
):
271 dataAccessLatency
= 8
273 resourceStalls
= True
274 def create(self
, options
):
275 self
.size
= MemorySize(options
.tcc_size
)
276 self
.size
= self
.size
/ options
.num_tccs
277 self
.dataArrayBanks
= 256 / options
.num_tccs
#number of data banks
278 self
.tagArrayBanks
= 256 / options
.num_tccs
#number of tag banks
279 if ((self
.size
.value
/ long(self
.assoc
)) < 128):
280 self
.size
.value
= long(128 * self
.assoc
)
281 self
.start_index_bit
= math
.log(options
.cacheline_size
, 2) + \
282 math
.log(options
.num_tccs
, 2)
283 self
.replacement_policy
= TreePLRURP()
285 class TCCCntrl(TCC_Controller
, CntrlBase
):
286 def create(self
, options
, ruby_system
, system
):
287 self
.version
= self
.versionCount()
289 self
.L2cache
.create(options
)
290 self
.l2_response_latency
= options
.TCC_latency
292 self
.number_of_TBEs
= 2048
294 self
.ruby_system
= ruby_system
296 if options
.recycle_latency
:
297 self
.recycle_latency
= options
.recycle_latency
299 def connectWireBuffers(self
, req_to_tccdir
, resp_to_tccdir
,
300 tcc_unblock_to_tccdir
, req_to_tcc
,
301 probe_to_tcc
, resp_to_tcc
):
302 self
.w_reqToTCCDir
= req_to_tccdir
303 self
.w_respToTCCDir
= resp_to_tccdir
304 self
.w_TCCUnblockToTCCDir
= tcc_unblock_to_tccdir
305 self
.w_reqToTCC
= req_to_tcc
306 self
.w_probeToTCC
= probe_to_tcc
307 self
.w_respToTCC
= resp_to_tcc
309 class TCCDirCntrl(TCCdir_Controller
, CntrlBase
):
310 def create(self
, options
, ruby_system
, system
):
311 self
.version
= self
.versionCount()
313 self
.directory
= TccDirCache()
314 self
.directory
.create(options
)
316 self
.number_of_TBEs
= 1024
318 self
.ruby_system
= ruby_system
320 if options
.recycle_latency
:
321 self
.recycle_latency
= options
.recycle_latency
323 def connectWireBuffers(self
, req_to_tccdir
, resp_to_tccdir
,
324 tcc_unblock_to_tccdir
, req_to_tcc
,
325 probe_to_tcc
, resp_to_tcc
):
326 self
.w_reqToTCCDir
= req_to_tccdir
327 self
.w_respToTCCDir
= resp_to_tccdir
328 self
.w_TCCUnblockToTCCDir
= tcc_unblock_to_tccdir
329 self
.w_reqToTCC
= req_to_tcc
330 self
.w_probeToTCC
= probe_to_tcc
331 self
.w_respToTCC
= resp_to_tcc
333 class L3Cache(RubyCache
):
338 def create(self
, options
, ruby_system
, system
):
339 self
.size
= MemorySize(options
.l3_size
)
340 self
.size
.value
/= options
.num_dirs
341 self
.dataArrayBanks
/= options
.num_dirs
342 self
.tagArrayBanks
/= options
.num_dirs
343 self
.dataArrayBanks
/= options
.num_dirs
344 self
.tagArrayBanks
/= options
.num_dirs
345 self
.dataAccessLatency
= options
.l3_data_latency
346 self
.tagAccessLatency
= options
.l3_tag_latency
347 self
.resourceStalls
= options
.no_resource_stalls
348 self
.replacement_policy
= TreePLRURP()
350 class L3Cntrl(L3Cache_Controller
, CntrlBase
):
351 def create(self
, options
, ruby_system
, system
):
352 self
.version
= self
.versionCount()
353 self
.L3cache
= L3Cache()
354 self
.L3cache
.create(options
, ruby_system
, system
)
356 self
.l3_response_latency
= max(self
.L3cache
.dataAccessLatency
,
357 self
.L3cache
.tagAccessLatency
)
358 self
.ruby_system
= ruby_system
360 if options
.recycle_latency
:
361 self
.recycle_latency
= options
.recycle_latency
363 def connectWireBuffers(self
, req_to_dir
, resp_to_dir
, l3_unblock_to_dir
,
364 req_to_l3
, probe_to_l3
, resp_to_l3
):
365 self
.reqToDir
= req_to_dir
366 self
.respToDir
= resp_to_dir
367 self
.l3UnblockToDir
= l3_unblock_to_dir
368 self
.reqToL3
= req_to_l3
369 self
.probeToL3
= probe_to_l3
370 self
.respToL3
= resp_to_l3
372 class DirCntrl(Directory_Controller
, CntrlBase
):
373 def create(self
, options
, dir_ranges
, ruby_system
, system
):
374 self
.version
= self
.versionCount()
376 self
.response_latency
= 30
378 self
.addr_ranges
= dir_ranges
379 self
.directory
= RubyDirectoryMemory()
381 self
.L3CacheMemory
= L3Cache()
382 self
.L3CacheMemory
.create(options
, ruby_system
, system
)
384 self
.l3_hit_latency
= max(self
.L3CacheMemory
.dataAccessLatency
,
385 self
.L3CacheMemory
.tagAccessLatency
)
387 self
.number_of_TBEs
= options
.num_tbes
389 self
.ruby_system
= ruby_system
391 if options
.recycle_latency
:
392 self
.recycle_latency
= options
.recycle_latency
394 def connectWireBuffers(self
, req_to_dir
, resp_to_dir
, l3_unblock_to_dir
,
395 req_to_l3
, probe_to_l3
, resp_to_l3
):
396 self
.reqToDir
= req_to_dir
397 self
.respToDir
= resp_to_dir
398 self
.l3UnblockToDir
= l3_unblock_to_dir
399 self
.reqToL3
= req_to_l3
400 self
.probeToL3
= probe_to_l3
401 self
.respToL3
= resp_to_l3
405 def define_options(parser
):
406 parser
.add_option("--num-subcaches", type="int", default
=4)
407 parser
.add_option("--l3-data-latency", type="int", default
=20)
408 parser
.add_option("--l3-tag-latency", type="int", default
=15)
409 parser
.add_option("--cpu-to-dir-latency", type="int", default
=15)
410 parser
.add_option("--gpu-to-dir-latency", type="int", default
=160)
411 parser
.add_option("--no-resource-stalls", action
="store_false",
413 parser
.add_option("--num-tbes", type="int", default
=256)
414 parser
.add_option("--l2-latency", type="int", default
=50) # load to use
415 parser
.add_option("--num-tccs", type="int", default
=1,
416 help="number of TCC directories and banks in the GPU")
417 parser
.add_option("--TCP_latency", type="int", default
=4,
419 parser
.add_option("--TCC_latency", type="int", default
=16,
421 parser
.add_option("--tcc-size", type='string', default
='256kB',
422 help="agregate tcc size")
423 parser
.add_option("--tcp-size", type='string', default
='16kB',
425 parser
.add_option("--tcc-dir-factor", type='int', default
=4,
426 help="TCCdir size = factor *(TCPs + TCC)")
428 def create_system(options
, full_system
, system
, dma_devices
, bootmem
,
430 if buildEnv
['PROTOCOL'] != 'GPU_RfO':
431 panic("This script requires the GPU_RfO protocol to be built.")
436 # The ruby network creation expects the list of nodes in the system to be
437 # consistent with the NetDest list. Therefore the l1 controller nodes
438 # must be listed before the directory nodes and directory nodes before
445 tccdir_cntrl_nodes
= []
450 # Must create the individual controllers before the network to ensure the
451 # controller constructors are called before the network constructor
454 TCC_bits
= int(math
.log(options
.num_tccs
, 2))
456 # This is the base crossbar that connects the L3s, Dirs, and cpu/gpu
458 mainCluster
= Cluster(extBW
= 512, intBW
= 512) # 1 TB/s
460 if options
.numa_high_bit
:
461 numa_bit
= options
.numa_high_bit
463 # if the numa_bit is not specified, set the directory bits as the
464 # lowest bits above the block offset bits, and the numa_bit as the
465 # highest of those directory bits
466 dir_bits
= int(math
.log(options
.num_dirs
, 2))
467 block_size_bits
= int(math
.log(options
.cacheline_size
, 2))
468 numa_bit
= block_size_bits
+ dir_bits
- 1
470 for i
in range(options
.num_dirs
):
472 for r
in system
.mem_ranges
:
473 addr_range
= m5
.objects
.AddrRange(r
.start
, size
= r
.size(),
474 intlvHighBit
= numa_bit
,
475 intlvBits
= dir_bits
,
477 dir_ranges
.append(addr_range
)
479 dir_cntrl
= DirCntrl(TCC_select_num_bits
= TCC_bits
)
480 dir_cntrl
.create(options
, dir_ranges
, ruby_system
, system
)
481 dir_cntrl
.number_of_TBEs
= 2560 * options
.num_compute_units
482 #Enough TBEs for all TCP TBEs
484 # Connect the Directory controller to the ruby network
485 dir_cntrl
.requestFromCores
= MessageBuffer(ordered
= True)
486 dir_cntrl
.requestFromCores
.slave
= ruby_system
.network
.master
488 dir_cntrl
.responseFromCores
= MessageBuffer()
489 dir_cntrl
.responseFromCores
.slave
= ruby_system
.network
.master
491 dir_cntrl
.unblockFromCores
= MessageBuffer()
492 dir_cntrl
.unblockFromCores
.slave
= ruby_system
.network
.master
494 dir_cntrl
.probeToCore
= MessageBuffer()
495 dir_cntrl
.probeToCore
.master
= ruby_system
.network
.slave
497 dir_cntrl
.responseToCore
= MessageBuffer()
498 dir_cntrl
.responseToCore
.master
= ruby_system
.network
.slave
500 dir_cntrl
.triggerQueue
= MessageBuffer(ordered
= True)
501 dir_cntrl
.L3triggerQueue
= MessageBuffer(ordered
= True)
502 dir_cntrl
.responseFromMemory
= MessageBuffer()
504 exec("system.dir_cntrl%d = dir_cntrl" % i
)
505 dir_cntrl_nodes
.append(dir_cntrl
)
507 mainCluster
.add(dir_cntrl
)
509 # For an odd number of CPUs, still create the right number of controllers
510 cpuCluster
= Cluster(extBW
= 512, intBW
= 512) # 1 TB/s
511 for i
in range((options
.num_cpus
+ 1) // 2):
514 cp_cntrl
.create(options
, ruby_system
, system
)
516 exec("system.cp_cntrl%d = cp_cntrl" % i
)
518 # Add controllers and sequencers to the appropriate lists
520 cpu_sequencers
.extend([cp_cntrl
.sequencer
, cp_cntrl
.sequencer1
])
522 # Connect the CP controllers and the network
523 cp_cntrl
.requestFromCore
= MessageBuffer()
524 cp_cntrl
.requestFromCore
.master
= ruby_system
.network
.slave
526 cp_cntrl
.responseFromCore
= MessageBuffer()
527 cp_cntrl
.responseFromCore
.master
= ruby_system
.network
.slave
529 cp_cntrl
.unblockFromCore
= MessageBuffer()
530 cp_cntrl
.unblockFromCore
.master
= ruby_system
.network
.slave
532 cp_cntrl
.probeToCore
= MessageBuffer()
533 cp_cntrl
.probeToCore
.slave
= ruby_system
.network
.master
535 cp_cntrl
.responseToCore
= MessageBuffer()
536 cp_cntrl
.responseToCore
.slave
= ruby_system
.network
.master
538 cp_cntrl
.mandatoryQueue
= MessageBuffer()
539 cp_cntrl
.triggerQueue
= MessageBuffer(ordered
= True)
541 cpuCluster
.add(cp_cntrl
)
543 gpuCluster
= Cluster(extBW
= 512, intBW
= 512) # 1 TB/s
545 for i
in range(options
.num_compute_units
):
547 tcp_cntrl
= TCPCntrl(TCC_select_num_bits
= TCC_bits
,
548 number_of_TBEs
= 2560) # max outstanding requests
549 tcp_cntrl
.create(options
, ruby_system
, system
)
551 exec("system.tcp_cntrl%d = tcp_cntrl" % i
)
553 # Add controllers and sequencers to the appropriate lists
555 cpu_sequencers
.append(tcp_cntrl
.coalescer
)
556 tcp_cntrl_nodes
.append(tcp_cntrl
)
558 # Connect the TCP controller to the ruby network
559 tcp_cntrl
.requestFromTCP
= MessageBuffer(ordered
= True)
560 tcp_cntrl
.requestFromTCP
.master
= ruby_system
.network
.slave
562 tcp_cntrl
.responseFromTCP
= MessageBuffer(ordered
= True)
563 tcp_cntrl
.responseFromTCP
.master
= ruby_system
.network
.slave
565 tcp_cntrl
.unblockFromCore
= MessageBuffer(ordered
= True)
566 tcp_cntrl
.unblockFromCore
.master
= ruby_system
.network
.slave
568 tcp_cntrl
.probeToTCP
= MessageBuffer(ordered
= True)
569 tcp_cntrl
.probeToTCP
.slave
= ruby_system
.network
.master
571 tcp_cntrl
.responseToTCP
= MessageBuffer(ordered
= True)
572 tcp_cntrl
.responseToTCP
.slave
= ruby_system
.network
.master
574 tcp_cntrl
.mandatoryQueue
= MessageBuffer()
576 gpuCluster
.add(tcp_cntrl
)
578 for i
in range(options
.num_sqc
):
580 sqc_cntrl
= SQCCntrl(TCC_select_num_bits
= TCC_bits
)
581 sqc_cntrl
.create(options
, ruby_system
, system
)
583 exec("system.sqc_cntrl%d = sqc_cntrl" % i
)
585 # Add controllers and sequencers to the appropriate lists
587 cpu_sequencers
.append(sqc_cntrl
.sequencer
)
589 # Connect the SQC controller to the ruby network
590 sqc_cntrl
.requestFromSQC
= MessageBuffer(ordered
= True)
591 sqc_cntrl
.requestFromSQC
.master
= ruby_system
.network
.slave
593 sqc_cntrl
.responseFromSQC
= MessageBuffer(ordered
= True)
594 sqc_cntrl
.responseFromSQC
.master
= ruby_system
.network
.slave
596 sqc_cntrl
.unblockFromCore
= MessageBuffer(ordered
= True)
597 sqc_cntrl
.unblockFromCore
.master
= ruby_system
.network
.slave
599 sqc_cntrl
.probeToSQC
= MessageBuffer(ordered
= True)
600 sqc_cntrl
.probeToSQC
.slave
= ruby_system
.network
.master
602 sqc_cntrl
.responseToSQC
= MessageBuffer(ordered
= True)
603 sqc_cntrl
.responseToSQC
.slave
= ruby_system
.network
.master
605 sqc_cntrl
.mandatoryQueue
= MessageBuffer()
607 # SQC also in GPU cluster
608 gpuCluster
.add(sqc_cntrl
)
610 for i
in range(options
.num_cp
):
612 tcp_cntrl
= TCPCntrl(TCC_select_num_bits
= TCC_bits
,
613 number_of_TBEs
= 2560) # max outstanding requests
614 tcp_cntrl
.createCP(options
, ruby_system
, system
)
616 exec("system.tcp_cntrl%d = tcp_cntrl" % (options
.num_compute_units
+ i
))
618 # Add controllers and sequencers to the appropriate lists
620 cpu_sequencers
.append(tcp_cntrl
.sequencer
)
621 tcp_cntrl_nodes
.append(tcp_cntrl
)
623 # Connect the TCP controller to the ruby network
624 tcp_cntrl
.requestFromTCP
= MessageBuffer(ordered
= True)
625 tcp_cntrl
.requestFromTCP
.master
= ruby_system
.network
.slave
627 tcp_cntrl
.responseFromTCP
= MessageBuffer(ordered
= True)
628 tcp_cntrl
.responseFromTCP
.master
= ruby_system
.network
.slave
630 tcp_cntrl
.unblockFromCore
= MessageBuffer(ordered
= True)
631 tcp_cntrl
.unblockFromCore
.master
= ruby_system
.network
.slave
633 tcp_cntrl
.probeToTCP
= MessageBuffer(ordered
= True)
634 tcp_cntrl
.probeToTCP
.slave
= ruby_system
.network
.master
636 tcp_cntrl
.responseToTCP
= MessageBuffer(ordered
= True)
637 tcp_cntrl
.responseToTCP
.slave
= ruby_system
.network
.master
639 tcp_cntrl
.mandatoryQueue
= MessageBuffer()
641 gpuCluster
.add(tcp_cntrl
)
643 sqc_cntrl
= SQCCntrl(TCC_select_num_bits
= TCC_bits
)
644 sqc_cntrl
.createCP(options
, ruby_system
, system
)
646 exec("system.sqc_cntrl%d = sqc_cntrl" % (options
.num_compute_units
+ i
))
648 # Add controllers and sequencers to the appropriate lists
650 cpu_sequencers
.append(sqc_cntrl
.sequencer
)
652 # Connect the SQC controller to the ruby network
653 sqc_cntrl
.requestFromSQC
= MessageBuffer(ordered
= True)
654 sqc_cntrl
.requestFromSQC
.master
= ruby_system
.network
.slave
656 sqc_cntrl
.responseFromSQC
= MessageBuffer(ordered
= True)
657 sqc_cntrl
.responseFromSQC
.master
= ruby_system
.network
.slave
659 sqc_cntrl
.unblockFromCore
= MessageBuffer(ordered
= True)
660 sqc_cntrl
.unblockFromCore
.master
= ruby_system
.network
.slave
662 sqc_cntrl
.probeToSQC
= MessageBuffer(ordered
= True)
663 sqc_cntrl
.probeToSQC
.slave
= ruby_system
.network
.master
665 sqc_cntrl
.responseToSQC
= MessageBuffer(ordered
= True)
666 sqc_cntrl
.responseToSQC
.slave
= ruby_system
.network
.master
668 sqc_cntrl
.mandatoryQueue
= MessageBuffer()
670 # SQC also in GPU cluster
671 gpuCluster
.add(sqc_cntrl
)
673 for i
in range(options
.num_tccs
):
675 tcc_cntrl
= TCCCntrl(TCC_select_num_bits
= TCC_bits
,
676 number_of_TBEs
= options
.num_compute_units
* 2560)
677 #Enough TBEs for all TCP TBEs
678 tcc_cntrl
.create(options
, ruby_system
, system
)
679 tcc_cntrl_nodes
.append(tcc_cntrl
)
681 tccdir_cntrl
= TCCDirCntrl(TCC_select_num_bits
= TCC_bits
,
682 number_of_TBEs
= options
.num_compute_units
* 2560)
683 #Enough TBEs for all TCP TBEs
684 tccdir_cntrl
.create(options
, ruby_system
, system
)
685 tccdir_cntrl_nodes
.append(tccdir_cntrl
)
687 exec("system.tcc_cntrl%d = tcc_cntrl" % i
)
688 exec("system.tccdir_cntrl%d = tccdir_cntrl" % i
)
690 # connect all of the wire buffers between L3 and dirs up
691 req_to_tccdir
= RubyWireBuffer()
692 resp_to_tccdir
= RubyWireBuffer()
693 tcc_unblock_to_tccdir
= RubyWireBuffer()
694 req_to_tcc
= RubyWireBuffer()
695 probe_to_tcc
= RubyWireBuffer()
696 resp_to_tcc
= RubyWireBuffer()
698 tcc_cntrl
.connectWireBuffers(req_to_tccdir
, resp_to_tccdir
,
699 tcc_unblock_to_tccdir
, req_to_tcc
,
700 probe_to_tcc
, resp_to_tcc
)
701 tccdir_cntrl
.connectWireBuffers(req_to_tccdir
, resp_to_tccdir
,
702 tcc_unblock_to_tccdir
, req_to_tcc
,
703 probe_to_tcc
, resp_to_tcc
)
705 # Connect the TCC controller to the ruby network
706 tcc_cntrl
.responseFromTCC
= MessageBuffer(ordered
= True)
707 tcc_cntrl
.responseFromTCC
.master
= ruby_system
.network
.slave
709 tcc_cntrl
.responseToTCC
= MessageBuffer(ordered
= True)
710 tcc_cntrl
.responseToTCC
.slave
= ruby_system
.network
.master
712 # Connect the TCC Dir controller to the ruby network
713 tccdir_cntrl
.requestFromTCP
= MessageBuffer(ordered
= True)
714 tccdir_cntrl
.requestFromTCP
.slave
= ruby_system
.network
.master
716 tccdir_cntrl
.responseFromTCP
= MessageBuffer(ordered
= True)
717 tccdir_cntrl
.responseFromTCP
.slave
= ruby_system
.network
.master
719 tccdir_cntrl
.unblockFromTCP
= MessageBuffer(ordered
= True)
720 tccdir_cntrl
.unblockFromTCP
.slave
= ruby_system
.network
.master
722 tccdir_cntrl
.probeToCore
= MessageBuffer(ordered
= True)
723 tccdir_cntrl
.probeToCore
.master
= ruby_system
.network
.slave
725 tccdir_cntrl
.responseToCore
= MessageBuffer(ordered
= True)
726 tccdir_cntrl
.responseToCore
.master
= ruby_system
.network
.slave
728 tccdir_cntrl
.probeFromNB
= MessageBuffer()
729 tccdir_cntrl
.probeFromNB
.slave
= ruby_system
.network
.master
731 tccdir_cntrl
.responseFromNB
= MessageBuffer()
732 tccdir_cntrl
.responseFromNB
.slave
= ruby_system
.network
.master
734 tccdir_cntrl
.requestToNB
= MessageBuffer()
735 tccdir_cntrl
.requestToNB
.master
= ruby_system
.network
.slave
737 tccdir_cntrl
.responseToNB
= MessageBuffer()
738 tccdir_cntrl
.responseToNB
.master
= ruby_system
.network
.slave
740 tccdir_cntrl
.unblockToNB
= MessageBuffer()
741 tccdir_cntrl
.unblockToNB
.master
= ruby_system
.network
.slave
743 tccdir_cntrl
.triggerQueue
= MessageBuffer(ordered
= True)
745 # TCC cntrls added to the GPU cluster
746 gpuCluster
.add(tcc_cntrl
)
747 gpuCluster
.add(tccdir_cntrl
)
749 # Assuming no DMA devices
750 assert(len(dma_devices
) == 0)
752 # Add cpu/gpu clusters to main cluster
753 mainCluster
.add(cpuCluster
)
754 mainCluster
.add(gpuCluster
)
756 ruby_system
.network
.number_of_virtual_networks
= 10
758 return (cpu_sequencers
, dir_cntrl_nodes
, mainCluster
)