From 803bb39eba1d789739b73dcbeb57d5ca6416bc1f Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 12 Feb 2019 16:24:30 -0500
Subject: [PATCH] P4 to Git Change 1742993 by jujiang@JJ-OCL-w8 on 2019/02/12
15:51:01
SWDEV-169154 - Implement OpenCL extension function to set stable pstate on ORCA stack
-Add StablePstate feature in Orca stack
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#603 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#186 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.h#65 edit
---
rocclr/runtime/device/gpu/gpudevice.cpp | 6 ++++++
rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp | 12 ++++++++++++
rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h | 2 ++
3 files changed, 20 insertions(+)
diff --git a/rocclr/runtime/device/gpu/gpudevice.cpp b/rocclr/runtime/device/gpu/gpudevice.cpp
index 2df6f5058f..aa8ed5147d 100644
--- a/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -2233,6 +2233,12 @@ cl_int Device::hwDebugManagerInit(amd::Context* context, uintptr_t messageStorag
bool Device::SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeInput, cl_set_device_clock_mode_output_amd* pSetClockModeOutput) {
bool result = true;
+ static const bool bValidate = true;
+ PerformAdapterInitialization(bValidate);
+ GSLClockModeInfo clockModeInfo = {};
+ clockModeInfo.clockmode = static_cast(setClockModeInput.clock_mode);
+ result = gslSetClockMode(&clockModeInfo);
+ CloseInitializedAdapter(bValidate);
return result;
}
diff --git a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
index 8d9021981b..24cb4c6ea4 100644
--- a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
+++ b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
@@ -1623,3 +1623,15 @@ CALGSLDevice::fillSamplerHwState(bool unnorm, uint32 min, uint32 mag, uint32 add
m_textureSampler->getSamplerSrd(m_cs, hwState, hwStateSize);
}
+bool
+CALGSLDevice::gslSetClockMode(GSLClockModeInfo * clockModeInfo)
+{
+ bool result = false;
+ const void* requestClockInfo = reinterpret_cast(clockModeInfo);
+ uint32 uReturn = m_adp->requestClockModeInfo((void*)requestClockInfo);
+ if(uReturn == GSL_SETCLOCK_SUCCESS || uReturn == GSL_SETCLOCK_QUERY_ONLY)
+ {
+ result = true;
+ }
+ return result;
+}
\ No newline at end of file
diff --git a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h
index 6e44ad5daa..627a140d1d 100644
--- a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h
+++ b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h
@@ -6,6 +6,7 @@
#include "gsl_types.h"
#include "gsl_config.h"
#include "thread/monitor.hpp"
+#include "gsl_types_internal.h"
#ifdef ATI_OS_LINUX
typedef unsigned int IDirect3DDevice9;
@@ -140,6 +141,7 @@ public:
gslEngineID getFirstAvailableComputeEngineID() const { return static_cast(
m_adp->findFirstAvailableComputeEngineID()); }
+ virtual bool gslSetClockMode(GSLClockModeInfo * clockModeInfo);
protected:
//
/// channel order enumerants