summaryrefslogtreecommitdiff
path: root/src/gpu-compute/gpu_exec_context.cc
diff options
context:
space:
mode:
authorTony Gutierrez <anthony.gutierrez@amd.com>2016-10-26 22:47:38 -0400
committerTony Gutierrez <anthony.gutierrez@amd.com>2016-10-26 22:47:38 -0400
commitd327cdba078e0956596513b518731e9ec730723f (patch)
tree0ad01f9fa3061d6846c019bd075103f55ad74689 /src/gpu-compute/gpu_exec_context.cc
parent98d8a7051d8caa9b5aebebe5bf16f9d731c34c0e (diff)
downloadgem5-d327cdba078e0956596513b518731e9ec730723f.tar.xz
gpu-compute: add gpu_isa.hh to switch hdrs, add GPUISA to WF
the GPUISA class is meant to encapsulate any ISA-specific behavior - special register accesses, isa-specific WF/kernel state, etc. - in a generic enough way so that it may be used in ISA-agnostic code. gpu-compute: use the GPUISA object to advance the PC the GPU model treats the PC as a pointer to individual instruction objects - which are store in a contiguous array - and not a byte address to be fetched from the real memory system. this is ok for HSAIL because all instructions are considered by the model to be the same size. in machine ISA, however, instructions may be 32b or 64b, and branches are calculated by advancing the PC by the number of words (4 byte chunks) it needs to advance in the real instruction stream. because of this there is a mismatch between the PC we use to index into the instruction array, and the actual byte address PC the ISA expects. here we move the PC advance calculation to the ISA so that differences in the instrucion sizes may be accounted for in generic way.
Diffstat (limited to 'src/gpu-compute/gpu_exec_context.cc')
-rw-r--r--src/gpu-compute/gpu_exec_context.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gpu-compute/gpu_exec_context.cc b/src/gpu-compute/gpu_exec_context.cc
index 4af69c41e..ca694187c 100644
--- a/src/gpu-compute/gpu_exec_context.cc
+++ b/src/gpu-compute/gpu_exec_context.cc
@@ -34,9 +34,10 @@
*/
#include "gpu-compute/gpu_exec_context.hh"
+#include "gpu-compute/wavefront.hh"
GPUExecContext::GPUExecContext(ComputeUnit *_cu, Wavefront *_wf)
- : cu(_cu), wf(_wf)
+ : cu(_cu), wf(_wf), gpuISA(_wf->gpuISA())
{
}
@@ -51,3 +52,15 @@ GPUExecContext::wavefront()
{
return wf;
}
+
+TheGpuISA::MiscReg
+GPUExecContext::readMiscReg(int opIdx) const
+{
+ return gpuISA.readMiscReg(opIdx);
+}
+
+void
+GPUExecContext::writeMiscReg(int opIdx, TheGpuISA::MiscReg operandVal)
+{
+ gpuISA.writeMiscReg(opIdx, operandVal);
+}