From 1a7008f29b56e8a54155a1c17008310b321b520c Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 2 Nov 2018 16:09:59 -0400
Subject: [PATCH] P4 to Git Change 1702079 by jujiang@JJ-OCL-w8 on 2018/11/02
16:01:11
SWDEV-155310 - Request for OpenCL extension function to set stable pstate
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#60 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_profile_amd.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_profile_amd.h#3 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#324 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#600 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#170 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#115 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.hpp#35 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#102 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#32 edit
---
rocclr/runtime/device/device.hpp | 4 ++++
rocclr/runtime/device/gpu/gpudevice.cpp | 5 +++++
rocclr/runtime/device/gpu/gpudevice.hpp | 4 ++++
rocclr/runtime/device/pal/paldevice.cpp | 10 +++++++++-
rocclr/runtime/device/pal/paldevice.hpp | 3 +++
rocclr/runtime/device/rocm/rocdevice.cpp | 4 ++++
rocclr/runtime/device/rocm/rocdevice.hpp | 4 ++++
7 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/rocclr/runtime/device/device.hpp b/rocclr/runtime/device/device.hpp
index b94f2ffd76..51e4418753 100644
--- a/rocclr/runtime/device/device.hpp
+++ b/rocclr/runtime/device/device.hpp
@@ -17,6 +17,7 @@
#include "appprofile.hpp"
#include "devprogram.hpp"
#include "devkernel.hpp"
+#include "amdocl/cl_profile_amd.h"
#if defined(WITH_LIGHTNING_COMPILER)
#include "caching/cache.hpp"
@@ -1264,6 +1265,9 @@ class Device : public RuntimeObject {
return true;
};
+ virtual bool SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeInput, cl_set_device_clock_mode_output_amd* pSetClockModeOutput) {
+ return true;
+ };
//! Returns TRUE if the device is available for computations
bool isOnline() const { return online_; }
diff --git a/rocclr/runtime/device/gpu/gpudevice.cpp b/rocclr/runtime/device/gpu/gpudevice.cpp
index aae7169115..d54ca0ba46 100644
--- a/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -2247,4 +2247,9 @@ cl_int Device::hwDebugManagerInit(amd::Context* context, uintptr_t messageStorag
return status;
}
+bool Device::SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeInput, cl_set_device_clock_mode_output_amd* pSetClockModeOutput) {
+ bool result = true;
+ return result;
+}
+
} // namespace gpu
diff --git a/rocclr/runtime/device/gpu/gpudevice.hpp b/rocclr/runtime/device/gpu/gpudevice.hpp
index 9d89880962..b1a781c998 100644
--- a/rocclr/runtime/device/gpu/gpudevice.hpp
+++ b/rocclr/runtime/device/gpu/gpudevice.hpp
@@ -111,6 +111,8 @@ class NullDevice : public amd::Device {
}
virtual void svmFree(void* ptr) const { return; }
+ virtual bool SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeInput, cl_set_device_clock_mode_output_amd* pSetClockModeOutput) { return true; }
+
protected:
bool usePal() const {
return (calTarget_ == CAL_TARGET_GREENLAND || calTarget_ == CAL_TARGET_RAVEN ||
@@ -410,6 +412,8 @@ class Device : public NullDevice, public CALGSLDevice {
virtual bool validateKernel(const amd::Kernel& kernel, //!< AMD kernel object
const device::VirtualDevice* vdev);
+ virtual bool SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeInput, cl_set_device_clock_mode_output_amd* pSetClockModeOutput);
+
//! Retrieves information about free memory on a GPU device
virtual bool globalFreeMemory(size_t* freeMemory) const;
diff --git a/rocclr/runtime/device/pal/paldevice.cpp b/rocclr/runtime/device/pal/paldevice.cpp
index 2d1c5c685f..b73a397fba 100644
--- a/rocclr/runtime/device/pal/paldevice.cpp
+++ b/rocclr/runtime/device/pal/paldevice.cpp
@@ -22,7 +22,6 @@
#include "acl.h"
#include "amdocl/cl_common.hpp"
-//#include "CL/cl_gl.h"
#ifdef _WIN32
#include
@@ -2263,4 +2262,13 @@ cl_int Device::hwDebugManagerInit(amd::Context* context, uintptr_t messageStorag
return status;
}
+bool Device::SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeInput, cl_set_device_clock_mode_output_amd* pSetClockModeOutput) {
+ bool result = false;
+ Pal::SetClockModeInput setClockMode = {};
+ Pal::DeviceClockMode palClockMode = static_cast(setClockModeInput.clock_mode);
+ setClockMode.clockMode = palClockMode;
+ result = (Pal::Result::Success == (iDev()->SetClockMode(setClockMode, reinterpret_cast(pSetClockModeOutput))))? true : false;
+ return result;
+}
+
} // namespace pal
diff --git a/rocclr/runtime/device/pal/paldevice.hpp b/rocclr/runtime/device/pal/paldevice.hpp
index f27bbd55a7..d95faa1377 100644
--- a/rocclr/runtime/device/pal/paldevice.hpp
+++ b/rocclr/runtime/device/pal/paldevice.hpp
@@ -112,6 +112,7 @@ class NullDevice : public amd::Device {
void* Alloc(const Util::AllocInfo& allocInfo) { return allocator_.Alloc(allocInfo); }
void Free(const Util::FreeInfo& freeInfo) { allocator_.Free(freeInfo); }
+ virtual bool SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeInput, cl_set_device_clock_mode_output_amd* pSetClockModeOutput) { return true; }
protected:
static Util::GenericAllocator allocator_; //!< Generic memory allocator in PAL
@@ -348,6 +349,8 @@ class Device : public NullDevice {
virtual bool validateKernel(const amd::Kernel& kernel, //!< AMD kernel object
const device::VirtualDevice* vdev);
+ virtual bool SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeInput, cl_set_device_clock_mode_output_amd* pSetClockModeOutput);
+
//! Retrieves information about free memory on a GPU device
virtual bool globalFreeMemory(size_t* freeMemory) const;
diff --git a/rocclr/runtime/device/rocm/rocdevice.cpp b/rocclr/runtime/device/rocm/rocdevice.cpp
index bcba8d3018..4a385a9400 100644
--- a/rocclr/runtime/device/rocm/rocdevice.cpp
+++ b/rocclr/runtime/device/rocm/rocdevice.cpp
@@ -1603,5 +1603,9 @@ VirtualGPU* Device::xferQueue() const {
xferQueue_->enableSyncBlit();
return xferQueue_;
}
+bool Device::SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeInput, cl_set_device_clock_mode_output_amd* pSetClockModeOutput) {
+ bool result = true;
+ return result;
+}
}
#endif // WITHOUT_HSA_BACKEND
diff --git a/rocclr/runtime/device/rocm/rocdevice.hpp b/rocclr/runtime/device/rocm/rocdevice.hpp
index 7ce56222cf..625f59bff6 100644
--- a/rocclr/runtime/device/rocm/rocdevice.hpp
+++ b/rocclr/runtime/device/rocm/rocdevice.hpp
@@ -176,6 +176,8 @@ class NullDevice : public amd::Device {
return false;
}
+ virtual bool SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeInput, cl_set_device_clock_mode_output_amd* pSetClockModeOutput) { return true; }
+
protected:
//! Initialize compiler instance and handle
static bool initCompiler(bool isOffline);
@@ -336,6 +338,8 @@ class Device : public NullDevice {
virtual void svmFree(void* ptr) const;
+ virtual bool SetClockMode(const cl_set_device_clock_mode_input_amd setClockModeInput, cl_set_device_clock_mode_output_amd* pSetClockModeOutput);
+
//! Returns transfer engine object
const device::BlitManager& xferMgr() const { return xferQueue()->blitMgr(); }