changeset aa846ec8cd8d in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=aa846ec8cd8d
description:
gpu-compute: Adding ioctl for HW context size
Adding runtime support for determining the memory required by a SIMD
engine
when executing a particular wavefront.
diffstat:
src/gpu-compute/cl_driver.cc | 7 +++++++
src/gpu-compute/dispatcher.cc | 6 ++++++
src/gpu-compute/dispatcher.hh | 3 +++
src/gpu-compute/hsa_kernel_info.hh | 1 +
src/gpu-compute/wavefront.cc | 14 ++++++++++++--
src/gpu-compute/wavefront.hh | 6 ++++++
6 files changed, 35 insertions(+), 2 deletions(-)
diffs (99 lines):
diff -r 2e8d4bd8108d -r aa846ec8cd8d src/gpu-compute/cl_driver.cc
--- a/src/gpu-compute/cl_driver.cc Fri Sep 16 12:26:52 2016 -0400
+++ b/src/gpu-compute/cl_driver.cc Fri Sep 16 12:27:56 2016 -0400
@@ -242,6 +242,13 @@
buf.copyOut(tc->getMemProxy());
}
break;
+ case HSA_GET_HW_STATIC_CONTEXT_SIZE:
+ {
+ BufferArg buf(buf_addr, sizeof(uint32_t));
+ *((uint32_t*)buf.bufferPtr()) = dispatcher->getStaticContextSize();
+ buf.copyOut(tc->getMemProxy());
+ }
+ break;
default:
fatal("ClDriver: bad ioctl %d\n", req);
diff -r 2e8d4bd8108d -r aa846ec8cd8d src/gpu-compute/dispatcher.cc
--- a/src/gpu-compute/dispatcher.cc Fri Sep 16 12:26:52 2016 -0400
+++ b/src/gpu-compute/dispatcher.cc Fri Sep 16 12:27:56 2016 -0400
@@ -398,3 +398,9 @@
{
shader->funcargs_size = funcargs_size;
}
+
+uint32_t
+GPUDispatcher::getStaticContextSize() const
+{
+ return shader->cuList[0]->wfList[0][0]->getStaticContextSize();
+}
diff -r 2e8d4bd8108d -r aa846ec8cd8d src/gpu-compute/dispatcher.hh
--- a/src/gpu-compute/dispatcher.hh Fri Sep 16 12:26:52 2016 -0400
+++ b/src/gpu-compute/dispatcher.hh Fri Sep 16 12:27:56 2016 -0400
@@ -159,6 +159,9 @@
int getNumCUs();
int wfSize() const;
void setFuncargsSize(int funcargs_size);
+
+ /** Returns the size of the static hardware context of a wavefront */
+ uint32_t getStaticContextSize() const;
};
#endif // __GPU_DISPATCHER_HH__
diff -r 2e8d4bd8108d -r aa846ec8cd8d src/gpu-compute/hsa_kernel_info.hh
--- a/src/gpu-compute/hsa_kernel_info.hh Fri Sep 16 12:26:52 2016 -0400
+++ b/src/gpu-compute/hsa_kernel_info.hh Fri Sep 16 12:27:56 2016 -0400
@@ -48,6 +48,7 @@
static const int HSA_GET_READONLY_DATA = 0x4805;
static const int HSA_GET_CU_CNT = 0x4806;
static const int HSA_GET_VSZ = 0x4807;
+static const int HSA_GET_HW_STATIC_CONTEXT_SIZE = 0x4808;
// Return value (via buffer ptr) for HSA_GET_SIZES
struct HsaDriverSizes
diff -r 2e8d4bd8108d -r aa846ec8cd8d src/gpu-compute/wavefront.cc
--- a/src/gpu-compute/wavefront.cc Fri Sep 16 12:26:52 2016 -0400
+++ b/src/gpu-compute/wavefront.cc Fri Sep 16 12:27:56 2016 -0400
@@ -155,9 +155,9 @@
}
void
-Wavefront::start(uint64_t _wfDynId,uint64_t _base_ptr)
+Wavefront::start(uint64_t _wf_dyn_id,uint64_t _base_ptr)
{
- wfDynId = _wfDynId;
+ wfDynId = _wf_dyn_id;
basePtr = _base_ptr;
status = S_RUNNING;
}
@@ -931,3 +931,13 @@
{
reconvergenceStack.top()->pc = new_pc;
}
+
+uint32_t
+Wavefront::getStaticContextSize() const
+{
+ return barCnt.size() * sizeof(int) + sizeof(dynWaveId) + sizeof(maxBarCnt)
+
+ sizeof(oldBarrierCnt) + sizeof(barrierCnt) + sizeof(wgId) +
+ sizeof(computeUnit->cu_id) + sizeof(barrierId) + sizeof(initMask) +
+ sizeof(privBase) + sizeof(spillBase) + sizeof(ldsChunk) +
+ computeUnit->wfSize() * sizeof(ReconvergenceStackEntry);
+}
diff -r 2e8d4bd8108d -r aa846ec8cd8d src/gpu-compute/wavefront.hh
--- a/src/gpu-compute/wavefront.hh Fri Sep 16 12:26:52 2016 -0400
+++ b/src/gpu-compute/wavefront.hh Fri Sep 16 12:27:56 2016 -0400
@@ -354,6 +354,12 @@
void discardFetch();
+ /**
+ * Returns the size of the static hardware context of a particular
wavefront
+ * This should be updated everytime the context is changed
+ */
+ uint32_t getStaticContextSize() const;
+
private:
/**
* Stack containing Control Flow Graph nodes (i.e., kernel instructions)
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev