From 8659b9e1afa88abbee93c6b1091274e4adb80395 Mon Sep 17 00:00:00 2001 From: Vishnu Ramadas Date: Wed, 26 Apr 2023 14:34:22 -0500 Subject: [PATCH] dev-amdgpu: Update vega10_kvm.py to add checkpointing instruction The vega10_kvm.py script configures a system to run in GPUFS mode. To create a checkpoint, an m5 checkpoint instruction has to be added to the script manually. This commit automatically adds the instruction if the checkpoint-dir flag is set Change-Id: I552fae6e98f6ec33a70a5b384242e87edb0e9526 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70078 Reviewed-by: Matthew Poremba Tested-by: kokoro Reviewed-by: Matt Sinclair Maintainer: Matt Sinclair --- configs/example/gpufs/vega10_kvm.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/configs/example/gpufs/vega10_kvm.py b/configs/example/gpufs/vega10_kvm.py index 9c7e4578f2..11f9fe2f80 100644 --- a/configs/example/gpufs/vega10_kvm.py +++ b/configs/example/gpufs/vega10_kvm.py @@ -41,7 +41,7 @@ from common import GPUTLBOptions from ruby import Ruby -demo_runscript = """\ +demo_runscript_without_checkpoint = """\ export LD_LIBRARY_PATH=/opt/rocm/lib:$LD_LIBRARY_PATH export HSA_ENABLE_INTERRUPT=0 dmesg -n8 @@ -58,6 +58,24 @@ chmod +x myapp /sbin/m5 exit """ +demo_runscript_with_checkpoint = """\ +export LD_LIBRARY_PATH=/opt/rocm/lib:$LD_LIBRARY_PATH +export HSA_ENABLE_INTERRUPT=0 +dmesg -n8 +dd if=/root/roms/vega10.rom of=/dev/mem bs=1k seek=768 count=128 +if [ ! -f /lib/modules/`uname -r`/updates/dkms/amdgpu.ko ]; then + echo "ERROR: Missing DKMS package for kernel `uname -r`. Exiting gem5." + /sbin/m5 exit +fi +modprobe -v amdgpu ip_block_mask=0xff ppfeaturemask=0 dpm=0 audio=0 +echo "Running {} {}" +echo "{}" | base64 -d > myapp +chmod +x myapp +/sbin/m5 checkpoint +./myapp {} +/sbin/m5 exit +""" + def addDemoOptions(parser): parser.add_argument( @@ -79,6 +97,7 @@ if __name__ == "__m5_main__": # Parse now so we can override options args = parser.parse_args() + demo_runscript = "" # Create temp script to run application if args.app is None: @@ -97,6 +116,12 @@ if __name__ == "__m5_main__": print("Could not find applcation", args.app) sys.exit(1) + # Choose runscript Based on whether any checkpointing args are set + if args.checkpoint_dir is not None: + demo_runscript = demo_runscript_with_checkpoint + else: + demo_runscript = demo_runscript_without_checkpoint + with open(os.path.abspath(args.app), "rb") as binfile: encodedBin = base64.b64encode(binfile.read()).decode()