apu_se.py (12418:340406d827e2) | apu_se.py (12564:2778478ca882) |
---|---|
1# 2# Copyright (c) 2015 Advanced Micro Devices, Inc. 3# All rights reserved. 4# 5# For use for simulation and test purposes only 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions are met: --- 19 unchanged lines hidden (view full) --- 28# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31# POSSIBILITY OF SUCH DAMAGE. 32# 33# Author: Sooraj Puthoor 34# 35 | 1# 2# Copyright (c) 2015 Advanced Micro Devices, Inc. 3# All rights reserved. 4# 5# For use for simulation and test purposes only 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions are met: --- 19 unchanged lines hidden (view full) --- 28# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31# POSSIBILITY OF SUCH DAMAGE. 32# 33# Author: Sooraj Puthoor 34# 35 |
36from __future__ import print_function 37 |
|
36import optparse, os, re 37import math 38import glob 39import inspect 40 41import m5 42from m5.objects import * 43from m5.util import addToPath --- 336 unchanged lines hidden (view full) --- 380 kernel_files = [find_file(benchmark_path, f) 381 for f in options.kernel_files.split(':')] 382else: 383 # if kernel_files is not set, see if there's a unique .asm file 384 # in the same directory as the executable 385 kernel_path = os.path.dirname(executable) 386 kernel_files = glob.glob(os.path.join(kernel_path, '*.asm')) 387 if kernel_files: | 38import optparse, os, re 39import math 40import glob 41import inspect 42 43import m5 44from m5.objects import * 45from m5.util import addToPath --- 336 unchanged lines hidden (view full) --- 382 kernel_files = [find_file(benchmark_path, f) 383 for f in options.kernel_files.split(':')] 384else: 385 # if kernel_files is not set, see if there's a unique .asm file 386 # in the same directory as the executable 387 kernel_path = os.path.dirname(executable) 388 kernel_files = glob.glob(os.path.join(kernel_path, '*.asm')) 389 if kernel_files: |
388 print "Using GPU kernel code file(s)", ",".join(kernel_files) | 390 print("Using GPU kernel code file(s)", ",".join(kernel_files)) |
389 else: 390 fatal("Can't locate kernel code (.asm) in " + kernel_path) 391 392# OpenCL driver 393driver = ClDriver(filename="hsa", codefile=kernel_files) 394for cpu in cpu_list: 395 cpu.createThreads() 396 cpu.workload = Process(executable = executable, --- 87 unchanged lines hidden (view full) --- 484 # in one GPU issue cycle. Hence wavefront_size mem ports. 485 for j in xrange(wavefront_size): 486 system.cpu[shader_idx].CUs[i].memory_port[j] = \ 487 system.ruby._cpu_ports[gpu_port_idx].slave[j] 488 gpu_port_idx += 1 489 490for i in xrange(n_cu): 491 if i > 0 and not i % options.cu_per_sqc: | 391 else: 392 fatal("Can't locate kernel code (.asm) in " + kernel_path) 393 394# OpenCL driver 395driver = ClDriver(filename="hsa", codefile=kernel_files) 396for cpu in cpu_list: 397 cpu.createThreads() 398 cpu.workload = Process(executable = executable, --- 87 unchanged lines hidden (view full) --- 486 # in one GPU issue cycle. Hence wavefront_size mem ports. 487 for j in xrange(wavefront_size): 488 system.cpu[shader_idx].CUs[i].memory_port[j] = \ 489 system.ruby._cpu_ports[gpu_port_idx].slave[j] 490 gpu_port_idx += 1 491 492for i in xrange(n_cu): 493 if i > 0 and not i % options.cu_per_sqc: |
492 print "incrementing idx on ", i | 494 print("incrementing idx on ", i) |
493 gpu_port_idx += 1 494 system.cpu[shader_idx].CUs[i].sqc_port = \ 495 system.ruby._cpu_ports[gpu_port_idx].slave 496gpu_port_idx = gpu_port_idx + 1 497 498# attach CP ports to Ruby 499for i in xrange(options.num_cp): 500 system.cpu[cp_idx].createInterruptController() --- 46 unchanged lines hidden (view full) --- 547 548checkpoint_dir = None 549m5.instantiate(checkpoint_dir) 550 551# Map workload to this address space 552host_cpu.workload[0].map(0x10000000, 0x200000000, 4096) 553 554if options.fast_forward: | 495 gpu_port_idx += 1 496 system.cpu[shader_idx].CUs[i].sqc_port = \ 497 system.ruby._cpu_ports[gpu_port_idx].slave 498gpu_port_idx = gpu_port_idx + 1 499 500# attach CP ports to Ruby 501for i in xrange(options.num_cp): 502 system.cpu[cp_idx].createInterruptController() --- 46 unchanged lines hidden (view full) --- 549 550checkpoint_dir = None 551m5.instantiate(checkpoint_dir) 552 553# Map workload to this address space 554host_cpu.workload[0].map(0x10000000, 0x200000000, 4096) 555 556if options.fast_forward: |
555 print "Switch at instruction count: %d" % \ 556 cpu_list[0].max_insts_any_thread | 557 print("Switch at instruction count: %d" % cpu_list[0].max_insts_any_thread) |
557 558exit_event = m5.simulate(maxtick) 559 560if options.fast_forward: 561 if exit_event.getCause() == "a thread reached the max instruction count": 562 m5.switchCpus(system, switch_cpu_list) | 558 559exit_event = m5.simulate(maxtick) 560 561if options.fast_forward: 562 if exit_event.getCause() == "a thread reached the max instruction count": 563 m5.switchCpus(system, switch_cpu_list) |
563 print "Switched CPUS @ tick %s" % (m5.curTick()) | 564 print("Switched CPUS @ tick %s" % (m5.curTick())) |
564 m5.stats.reset() 565 exit_event = m5.simulate(maxtick - m5.curTick()) 566elif options.fast_forward_pseudo_op: 567 while exit_event.getCause() == "switchcpu": 568 # If we are switching *to* kvm, then the current stats are meaningful 569 # Note that we don't do any warmup by default 570 if type(switch_cpu_list[0][0]) == FutureCpuClass: | 565 m5.stats.reset() 566 exit_event = m5.simulate(maxtick - m5.curTick()) 567elif options.fast_forward_pseudo_op: 568 while exit_event.getCause() == "switchcpu": 569 # If we are switching *to* kvm, then the current stats are meaningful 570 # Note that we don't do any warmup by default 571 if type(switch_cpu_list[0][0]) == FutureCpuClass: |
571 print "Dumping stats..." | 572 print("Dumping stats...") |
572 m5.stats.dump() 573 m5.switchCpus(system, switch_cpu_list) | 573 m5.stats.dump() 574 m5.switchCpus(system, switch_cpu_list) |
574 print "Switched CPUS @ tick %s" % (m5.curTick()) | 575 print("Switched CPUS @ tick %s" % (m5.curTick())) |
575 m5.stats.reset() 576 # This lets us switch back and forth without keeping a counter 577 switch_cpu_list = [(x[1], x[0]) for x in switch_cpu_list] 578 exit_event = m5.simulate(maxtick - m5.curTick()) 579 | 576 m5.stats.reset() 577 # This lets us switch back and forth without keeping a counter 578 switch_cpu_list = [(x[1], x[0]) for x in switch_cpu_list] 579 exit_event = m5.simulate(maxtick - m5.curTick()) 580 |
580print "Ticks:", m5.curTick() 581print 'Exiting because ', exit_event.getCause() | 581print("Ticks:", m5.curTick()) 582print('Exiting because ', exit_event.getCause()) |
582sys.exit(exit_event.getCode()) | 583sys.exit(exit_event.getCode()) |