Matthew Poremba has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/57534 )

 (

14 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
 )Change subject: configs: Add vega10 KVM script
......................................................................

configs: Add vega10 KVM script

Change-Id: Iaec03d49c1c9c24c1bb62e5ae01284b38d572380
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57534
Reviewed-by: Matt Sinclair <mattdsincl...@gmail.com>
Maintainer: Matt Sinclair <mattdsincl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
A configs/example/gpufs/vega10_kvm.py
1 file changed, 139 insertions(+), 0 deletions(-)

Approvals:
  Matt Sinclair: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/configs/example/gpufs/vega10_kvm.py b/configs/example/gpufs/vega10_kvm.py
new file mode 100644
index 0000000..593f6e1
--- /dev/null
+++ b/configs/example/gpufs/vega10_kvm.py
@@ -0,0 +1,126 @@
+# Copyright (c) 2022 Advanced Micro Devices, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import m5
+import runfs
+import base64
+import tempfile
+import argparse
+import sys
+import os
+
+from amd import AmdGPUOptions
+from common import Options
+from common import GPUTLBOptions
+from ruby import Ruby
+#from VegaConfigs import *
+
+#from m5.objects import *
+
+
+demo_runscript = '''\
+export LD_LIBRARY_PATH=/opt/rocm/lib:$LD_LIBRARY_PATH
+export HSA_ENABLE_SDMA=0
+dmesg -n8
+dd if=/root/roms/vega10.rom of=/dev/mem bs=1k seek=768 count=128
+modprobe -v amdgpu ip_block_mask=0xff ppfeaturemask=0 dpm=0 audio=0
+echo "Running {} {}"
+echo "{}" | base64 -d > myapp
+chmod +x myapp
+echo ./myapp {}
+/sbin/m5 exit
+'''
+
+def addDemoOptions(parser):
+    parser.add_argument("-a", "--app", default=None,
+                        help="GPU application to run")
+    parser.add_argument("-o", "--opts", default="",
+                        help="GPU application arguments")
+
+if __name__ == "__m5_main__":
+    parser = argparse.ArgumentParser()
+    runfs.addRunFSOptions(parser)
+    Options.addCommonOptions(parser)
+    AmdGPUOptions.addAmdGPUOptions(parser)
+    Ruby.define_options(parser)
+    GPUTLBOptions.tlb_options(parser)
+    #parseVegaOptions(parser)
+    addDemoOptions(parser)
+
+    # Parse now so we can override options
+    args = parser.parse_args()
+
+    # Create temp script to run application
+    if args.app is None:
+        print("No application given. Use %s -a <app>" % sys.argv[0])
+        sys.exit(1)
+    elif args.kernel is None:
+ print("No kernel path given. Use %s --kernel <vmlinux>" % sys.argv[0])
+        sys.exit(1)
+    elif args.disk_image is None:
+ print("No disk path given. Use %s --disk-image <linux>" % sys.argv[0])
+        sys.exit(1)
+    elif args.gpu_mmio_trace is None:
+        print("No MMIO trace path. Use %s --gpu-mmio-trace <path>"
+                % sys.argv[0])
+        sys.exit(1)
+    elif not os.path.isfile(args.app):
+        print("Could not find applcation", args.app)
+        sys.exit(1)
+
+    with open(os.path.abspath(args.app), 'rb') as binfile:
+        encodedBin = base64.b64encode(binfile.read()).decode()
+
+    _, tempRunscript = tempfile.mkstemp()
+    with open(tempRunscript, 'w') as b64file:
+ runscriptStr = demo_runscript.format(args.app, args.opts, encodedBin,
+                                             args.opts)
+        b64file.write(runscriptStr)
+
+    if args.second_disk == None:
+        args.second_disk = args.disk_image
+
+    # Defaults for Vega10
+    args.ruby = True
+    args.cpu_type = 'X86KvmCPU'
+    args.num_cpus = 1
+    args.mem_size = '3GB'
+    args.dgpu = True
+    args.dgpu_mem_size = '16GB'
+    args.dgpu_start = '0GB'
+    args.checkpoint_restore = 0
+    args.disjoint = True
+    args.timing_gpu = True
+    args.script = tempRunscript
+    args.dgpu_xor_low_bit = 0
+
+    print(args.disk_image)
+
+    # Run gem5
+    runfs.runGpuFSSystem(args)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/57534
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Iaec03d49c1c9c24c1bb62e5ae01284b38d572380
Gerrit-Change-Number: 57534
Gerrit-PatchSet: 20
Gerrit-Owner: Matthew Poremba <matthew.pore...@amd.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Matt Sinclair <mattdsincl...@gmail.com>
Gerrit-Reviewer: Matthew Poremba <matthew.pore...@amd.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Jason Lowe-Power <power...@gmail.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to