configs,gpu-compute: Kernel dispatch-based exit events

Add two kernel dispatch-based exit events that are useful for limiting
the simulation and enabling debug flags at specific GPU kernels. Since
the KVM CPU typically used with GPUFS is not deterministic, this help
with enabling debug flags when the Tick number may vary. The exit at GPU
kernel option can also limit simulation by only simulating a few hundred
kernels, for example, and exit at a determined point.

Change-Id: I81bae92a80c25fc38c41e999aa662e1417b7a20d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/71418
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
This commit is contained in:
Matthew Poremba
2023-06-08 10:50:23 -05:00
parent 25d7badcc1
commit c644eae2dd
2 changed files with 30 additions and 0 deletions

View File

@@ -137,6 +137,20 @@ def addRunFSOptions(parser):
"MI200 (gfx90a)",
)
parser.add_argument(
"--debug-at-gpu-kernel",
type=int,
default=-1,
help="Turn on debug flags starting with this kernel",
)
parser.add_argument(
"--exit-at-gpu-kernel",
type=int,
default=-1,
help="Exit simulation after running this many kernels",
)
def runGpuFSSystem(args):
"""
@@ -184,6 +198,9 @@ def runGpuFSSystem(args):
print("Running the simulation")
sim_ticks = args.abs_max_tick
kernels_launched = 0
if args.debug_at_gpu_kernel != -1:
m5.trace.disable()
exit_event = m5.simulate(sim_ticks)
@@ -199,11 +216,21 @@ def runGpuFSSystem(args):
assert args.checkpoint_dir is not None
m5.checkpoint(args.checkpoint_dir)
break
elif "GPU Kernel Completed" in exit_event.getCause():
kernels_launched += 1
else:
print(
f"Unknown exit event: {exit_event.getCause()}. Continuing..."
)
if kernels_launched == args.debug_at_gpu_kernel:
m5.trace.enable()
if kernels_launched == args.exit_at_gpu_kernel:
print(f"Exiting @ GPU kernel {kernels_launched}")
break
exit_event = m5.simulate(sim_ticks - m5.curTick())
print(
"Exiting @ tick %i because %s" % (m5.curTick(), exit_event.getCause())
)