Deleted Added
sdiff udiff text old ( 12418:340406d827e2 ) new ( 12564:2778478ca882 )
full compact
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
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:
390 print("Using GPU kernel code file(s)", ",".join(kernel_files))
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:
494 print("incrementing idx on ", i)
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:
557 print("Switch at instruction count: %d" % cpu_list[0].max_insts_any_thread)
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)
564 print("Switched CPUS @ tick %s" % (m5.curTick()))
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:
572 print("Dumping stats...")
573 m5.stats.dump()
574 m5.switchCpus(system, switch_cpu_list)
575 print("Switched CPUS @ tick %s" % (m5.curTick()))
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
581print("Ticks:", m5.curTick())
582print('Exiting because ', exit_event.getCause())
583sys.exit(exit_event.getCode())