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