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 <matthew.poremba@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
This commit is contained in:
Vishnu Ramadas
2023-04-26 14:34:22 -05:00
committed by VISHNU RAMADAS
parent 916bcbb4c4
commit 8659b9e1af

View File

@@ -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()