[gem5-dev] [S] Change in gem5/gem5[develop]: gpu-compute,configs: Make sim exits conditional

2023-07-07 Thread Matthew Poremba (Gerrit) via gem5-dev
Matthew Poremba has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/72098?usp=email )


Change subject: gpu-compute,configs: Make sim exits conditional
..

gpu-compute,configs: Make sim exits conditional

The unconditional exit event when a kernel completes that was added in
c644eae2ddd34cf449a9c4476730bd29703c4dd7 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 
Maintainer: Matt Sinclair 
Maintainer: Jason Lowe-Power 
Reviewed-by: Matt Sinclair 
Tested-by: kokoro 
---
M configs/example/gpufs/system/system.py
M src/gpu-compute/GPU.py
M src/gpu-compute/dispatcher.cc
M src/gpu-compute/dispatcher.hh
4 files changed, 13 insertions(+), 3 deletions(-)

Approvals:
  Matt Sinclair: Looks good to me, approved; Looks good to me, approved
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/configs/example/gpufs/system/system.py  
b/configs/example/gpufs/system/system.py

index 40e0016..19df310 100644
--- a/configs/example/gpufs/system/system.py
+++ b/configs/example/gpufs/system/system.py
@@ -115,7 +115,8 @@
 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
diff --git a/src/gpu-compute/GPU.py b/src/gpu-compute/GPU.py
index c5449cc..c64a6b7 100644
--- a/src/gpu-compute/GPU.py
+++ b/src/gpu-compute/GPU.py
@@ -328,6 +328,10 @@
 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"
diff --git a/src/gpu-compute/dispatcher.cc b/src/gpu-compute/dispatcher.cc
index b19bccc..7b36bce 100644
--- a/src/gpu-compute/dispatcher.cc
+++ b/src/gpu-compute/dispatcher.cc
@@ -51,7 +51,8 @@
 : 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);
 }
@@ -332,7 +333,9 @@
 curTick(), kern_id);
 DPRINTF(GPUKernelInfo, "Completed kernel %d\n", kern_id);

-exitSimLoop("GPU Kernel Completed");
+if (kernelExitEvents) {
+exitSimLoop("GPU Kernel Completed");
+}
 }

 if (!tickEvent.scheduled()) {
diff --git a/src/gpu-compute/dispatcher.hh b/src/gpu-compute/dispatcher.hh
index 7699cef..eafa080 100644
--- a/src/gpu-compute/dispatcher.hh
+++ b/src/gpu-compute/dispatcher.hh
@@ -92,6 +92,8 @@
 std::queue 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

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


Gerrit-MessageType: merged
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I1d2c082291fdbcf27390913ffdffb963ec8080dd
Gerrit-Change-Number: 72098
Gerrit-PatchSet: 2
Gerrit-Owner: Matthew Poremba 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Matt Sinclair 
Gerrit-Reviewer: Matthew Poremba 
Gerrit-Reviewer: kokoro 
Gerrit-CC: Bobby Bruce 
Gerrit-CC: kokoro 
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org


[gem5-dev] [S] Change in gem5/gem5[develop]: gpu-compute,configs: Make sim exits conditional

2023-07-06 Thread Matthew Poremba (Gerrit) via gem5-dev
Matthew Poremba has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/72098?usp=email )



Change subject: gpu-compute,configs: Make sim exits conditional
..

gpu-compute,configs: Make sim exits conditional

The unconditional exit event when a kernel completes that was added in
c644eae2ddd34cf449a9c4476730bd29703c4dd7 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
---
M configs/example/gpufs/system/system.py
M src/gpu-compute/GPU.py
M src/gpu-compute/dispatcher.cc
M src/gpu-compute/dispatcher.hh
4 files changed, 13 insertions(+), 3 deletions(-)



diff --git a/configs/example/gpufs/system/system.py  
b/configs/example/gpufs/system/system.py

index 40e0016..19df310 100644
--- a/configs/example/gpufs/system/system.py
+++ b/configs/example/gpufs/system/system.py
@@ -115,7 +115,8 @@
 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
diff --git a/src/gpu-compute/GPU.py b/src/gpu-compute/GPU.py
index c5449cc..c64a6b7 100644
--- a/src/gpu-compute/GPU.py
+++ b/src/gpu-compute/GPU.py
@@ -328,6 +328,10 @@
 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"
diff --git a/src/gpu-compute/dispatcher.cc b/src/gpu-compute/dispatcher.cc
index b19bccc..7b36bce 100644
--- a/src/gpu-compute/dispatcher.cc
+++ b/src/gpu-compute/dispatcher.cc
@@ -51,7 +51,8 @@
 : 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);
 }
@@ -332,7 +333,9 @@
 curTick(), kern_id);
 DPRINTF(GPUKernelInfo, "Completed kernel %d\n", kern_id);

-exitSimLoop("GPU Kernel Completed");
+if (kernelExitEvents) {
+exitSimLoop("GPU Kernel Completed");
+}
 }

 if (!tickEvent.scheduled()) {
diff --git a/src/gpu-compute/dispatcher.hh b/src/gpu-compute/dispatcher.hh
index 7699cef..eafa080 100644
--- a/src/gpu-compute/dispatcher.hh
+++ b/src/gpu-compute/dispatcher.hh
@@ -92,6 +92,8 @@
 std::queue 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

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


Gerrit-MessageType: newchange
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I1d2c082291fdbcf27390913ffdffb963ec8080dd
Gerrit-Change-Number: 72098
Gerrit-PatchSet: 1
Gerrit-Owner: Matthew Poremba 
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org