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(); }