gpu-compute,configs: Make sim exits conditional

The unconditional exit event when a kernel completes that was added in
c644eae2dd is causing scripts that do not
ignore unknown exit events to end simulation prematurely. One such
script is the apu_se.py script used in SE mode GPU simulation. Make this
exit conditional to the parameter being set to a valid value to avoid
this problem.

Change-Id: I1d2c082291fdbcf27390913ffdffb963ec8080dd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/72098
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
(cherry picked from commit 3756af8ed9)
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/72138
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Matthew Poremba
2023-07-06 08:13:01 -07:00
committed by Bobby Bruce
parent 578eaead47
commit 387fc6964e
4 changed files with 14 additions and 2 deletions

View File

@@ -115,7 +115,8 @@ def makeGpuFSSystem(args):
numHWQueues=args.num_hw_queues,
walker=hsapp_pt_walker,
)
dispatcher = GPUDispatcher()
dispatcher_exit_events = True if args.exit_at_gpu_kernel > -1 else False
dispatcher = GPUDispatcher(kernel_exit_events=dispatcher_exit_events)
cp_pt_walker = VegaPagetableWalker()
gpu_cmd_proc = GPUCommandProcessor(
hsapp=gpu_hsapp, dispatcher=dispatcher, walker=cp_pt_walker

View File

@@ -328,6 +328,10 @@ class GPUDispatcher(SimObject):
cxx_class = "gem5::GPUDispatcher"
cxx_header = "gpu-compute/dispatcher.hh"
kernel_exit_events = Param.Bool(
False, "Enable exiting sim loop after a kernel"
)
class GPUCommandProcessor(DmaVirtDevice):
type = "GPUCommandProcessor"

View File

@@ -50,7 +50,8 @@ GPUDispatcher::GPUDispatcher(const Params &p)
: SimObject(p), shader(nullptr), gpuCmdProc(nullptr),
tickEvent([this]{ exec(); },
"GPU Dispatcher tick", false, Event::CPU_Tick_Pri),
dispatchActive(false), stats(this)
dispatchActive(false), kernelExitEvents(p.kernel_exit_events),
stats(this)
{
schedule(&tickEvent, 0);
}
@@ -330,6 +331,10 @@ GPUDispatcher::notifyWgCompl(Wavefront *wf)
DPRINTF(GPUWgLatency, "Kernel Complete ticks:%d kernel:%d\n",
curTick(), kern_id);
DPRINTF(GPUKernelInfo, "Completed kernel %d\n", kern_id);
if (kernelExitEvents) {
exitSimLoop("GPU Kernel Completed");
}
}
if (!tickEvent.scheduled()) {

View File

@@ -92,6 +92,8 @@ class GPUDispatcher : public SimObject
std::queue<int> doneIds;
// is there a kernel in execution?
bool dispatchActive;
// Enable exiting sim loop after each kernel completion
bool kernelExitEvents;
protected:
struct GPUDispatcherStats : public statistics::Group