P4 to Git Change 1103193 by wchau@wchau_WINDOWS7_OCL on 2014/12/05 22:31:28

ECR #399840 - OpenCL Runtime HW Debug support development - APIs

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#40 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_debugger_amd.cpp#1 add
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_debugger_amd.h#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#173 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#235 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hwdebug.hpp#1 add
Этот коммит содержится в:
foreman
2014-12-05 22:36:08 -05:00
родитель a1202e54be
Коммит 801fcec2fe
3 изменённых файлов: 212 добавлений и 2 удалений
+1 -1
Просмотреть файл
@@ -208,7 +208,7 @@ Device::tearDown()
}
Device::Device(Device* parent)
: settings_(NULL), online_(true), blitProgram_(NULL), parent_(parent)
: settings_(NULL), online_(true), blitProgram_(NULL), hwDebugMgr_(NULL), parent_(parent)
{
memset(&info_, '\0', sizeof(info_));
if (parent_ != NULL) {
+17 -1
Просмотреть файл
@@ -17,6 +17,7 @@
#include "appprofile.hpp"
#include "acl.h"
#include "hwdebug.hpp"
#include <cstdio>
#include <cstring>
@@ -61,6 +62,8 @@ class SvmCopyMemoryCommand;
class SvmFillMemoryCommand;
class SvmMapMemoryCommand;
class SvmUnmapMemoryCommand;
class HwDebugManager;
class RunHwDbgCommand;
class Device;
struct KernelParameterDescriptor;
struct Coord3D;
@@ -571,6 +574,9 @@ struct Info : public amd::EmbeddedObject
//! The maximum size of global scope variables
size_t maxGlobalVariableSize_;
size_t globalVariablePreferredTotalSize_;
//! Enable HW Debug support
cl_bool enableHwDebug_;
};
//! Device settings
@@ -986,7 +992,7 @@ public:
//! Destroy this binary image.
virtual ~Program();
//! Destory all the kernels
//! Destroy all the kernels
void clear();
//! Return the compiler options passed to build this program
@@ -1407,6 +1413,9 @@ public:
virtual void submitSvmFillMemory(amd::SvmFillMemoryCommand& cmd) = 0;
virtual void submitSvmMapMemory(amd::SvmMapMemoryCommand& cmd) = 0;
virtual void submitSvmUnmapMemory(amd::SvmUnmapMemoryCommand& cmd) = 0;
#if 0 // exclude this until more HW DEBUG codes are submitted
virtual void submitHwDbgCommand(amd::RunHwDbgCommand& cmd) = 0;
#endif
//! Get the blit manager object
device::BlitManager& blitMgr() const { return *blitMgr_; }
@@ -1683,6 +1692,12 @@ public:
//! Returns app profile
static const AppProfile* appProfile() {return &appProfile_;}
//! Register a hardware debugger manager
HwDebugManager* hwDebugMgr() const { return hwDebugMgr_; }
//! Initialize the Hardware Debug Manager
virtual cl_int hwDebugManagerInit(amd::Context *context, uintptr_t messageStorage) { return CL_SUCCESS; }
protected:
//! Enable the specified extension
char* getExtensionString();
@@ -1692,6 +1707,7 @@ protected:
bool online_; //!< The device in online
BlitProgram* blitProgram_; //!< Blit program info
static AppProfile appProfile_; //!< application profile
HwDebugManager* hwDebugMgr_; //!< Hardware Debug manager
private:
bool IsHsaCapableDevice();
+194
Просмотреть файл
@@ -0,0 +1,194 @@
/* ========================================================================
Copyright (c) 2014 Advanced Micro Devices, Inc. All rights reserved.
========================================================================*/
#ifndef HWDEBUG_H_
#define HWDEBUG_H_
#include "amdocl/cl_debugger_amd.h"
#define TBA_START_OFFSET 256
/**
*******************************************************************************
* @brief Debug information required by the AMD debugger
* This might have to be moved to a private header. We could provide
* these services as a seperate dll.
* @details The information is populated by the function oclGetDebugInfo
*******************************************************************************
*/
struct PacketAmdInfo
{
uint32_t trapReservedVgprIndex; //!< reserved VGPR index, -1 when they are not valid
uint32_t scratchBufferWaveOffset; //!< scratch buffer wave offset, -1 when no scratch buffer
void *pointerToIsaBuffer; //!< pointer to the buffer containing ISA
size_t sizeOfIsaBuffer; //!< size of the ISA buffer
uint32_t numberOfVgprs; //!< number of VGPRs used by the kernel
uint32_t numberOfSgprs; //!< number of SGPRs used by the kernel
size_t sizeOfStaticGroupMemory; //!< Static local memory used by the kernel
};
//! Cache mask for invalidation
struct HwDbgGpuCacheMask
{
union {
struct {
uint32_t sqICache : 1; //!< Instruction cache
uint32_t sqKCache : 1; //!< Data cache
uint32_t tcL1 : 1; //!< tcL1 cache
uint32_t tcL2 : 1; //!< tcL2 cache
uint32_t reserved : 28;
};
uint32_t ui32All;
};
};
/**
* Opaque pointer to trap event
*/
typedef uint64_t DebugEvent; //! opaque pointer to trap event
namespace amd {
/*! \class HwDebugManager
*
* \brief The device interface class for the hardware debug manager
*/
class HwDebugManager
{
public:
//! Constructor for the Hardware Debug Manager
HwDebugManager() : isRegistered_(false), useHwDebug_(false) {}
//! Destructor for Hardware Debug Manager
~HwDebugManager() {};
//! Setup the call back function pointer
virtual void setCallBackFunctions(cl_PreDispatchCallBackFunctionAMD preDispatchFn,
cl_PostDispatchCallBackFunctionAMD postDispatchFn) = 0;
//! Setup the call back argument pointers
virtual void setCallBackArguments(void *preDispatchArgs, void *postDispatchArgs) = 0;
//! Flush cache
virtual cl_int flushCache(uint32_t mask) = 0;
//! Set exception policy
virtual cl_int setExceptionPolicy(void *policy) = 0;
//! Get exception policy
virtual cl_int getExceptionPolicy(void *policy) const = 0;
//! Set the kernel execution mode
virtual cl_int setKernelExecutionMode(void *mode) = 0;
//! Get the kernel execution mode
virtual cl_int getKernelExecutionMode(void *mode) const = 0;
//! Create the debug event
virtual DebugEvent createDebugEvent(const bool autoReset) = 0;
//! Wait for the debug event
virtual cl_int waitDebugEvent(DebugEvent pEvent, uint32_t timeOut) const = 0;
//! Destroy the debug event
virtual cl_int destroyDebugEvent(DebugEvent pEvent) = 0;
//! Register the debugger
virtual cl_int registerDebugger(amd::Context *context, uintptr_t pMessageStorage) = 0;
//! Call KMD to register the debugger
virtual cl_int registerDebuggerOnQueue(device::VirtualDevice *vDevice) = 0;
//! Unregister the debugger
virtual cl_int unregisterDebugger() = 0;
//! Setup the pointer to the aclBinary within the debug manager
virtual void setAclBinary(void *aclBinary) = 0;
//! Send the wavefront control cmmand
virtual cl_int wavefrontControl(uint32_t waveAction,
uint32_t waveMode,
uint32_t trapId,
void * waveAddr) const = 0;
//! Set address watching point
virtual cl_int setAddressWatch(uint32_t numWatchPoints,
void ** watchAddress,
uint64_t * watchMask,
uint64_t * watchMode,
DebugEvent * event) = 0;
//! Get the packet information for dispatch
virtual cl_int getPacketAmdInfo(const void * aqlCodeInfo,
void * packetInfo) const = 0;
//! Get dispatch debug info
virtual cl_int getDispatchDebugInfo(void * debugInfo) const = 0;
//! Map the AQL code for host access
virtual cl_int mapKernelCode(uint64_t *aqlCode, uint32_t *aqlCodeSize) const = 0;
//! Map the scratch ring for host access
virtual cl_int mapScratchRing(uint64_t *scratchRingAddr, uint32_t *scratchRingSize) const = 0;
//! Set global memory values
virtual cl_int setGlobalMemory(void * memObj,
uint32_t offset,
void * srcPtr,
uint32_t size) = 0;
//! Set kernel parameter memory object list
virtual cl_int setKernelParamMemList(void ** paramMem, uint32_t numParams) = 0;
//! Get kernel parameter memory object
virtual uint64_t getKernelParamMem(uint32_t paramIdx) const = 0;
//! Set the kernel code address and its size
virtual void setKernelCodeInfo(address aqlCodeAddr, uint32_t aqlCodeSize) = 0;
//! Get the scratch ring
virtual void setScratchRing(address scratchRingAddr, uint32_t scratchRingSize) = 0;
//! Retrieve the pre-dispatch callback function
virtual cl_PreDispatchCallBackFunctionAMD getPreDispatchCallBackFunction() const = 0;
//! Retrieve the post-dispatch callback function
virtual void * getPreDispatchCallBackArguments() const = 0;
//! Retrieve the pre-dispatch callback function arguments
virtual cl_PostDispatchCallBackFunctionAMD getPostDispatchCallBackFunction() const = 0;
//! Retrieve the post-dispatch callback function arguments
virtual void * getPostDispatchCallBackArguments() const = 0;
//! Set the register flag
void setRegisterFlag(bool regFlag) { isRegistered_ = regFlag; }
//! Set the use of HW DEBUG flag
void setUseHwDebugFlag(bool flag) { useHwDebug_ = flag; }
//! Return the register flag
bool isRegistered() const { return isRegistered_; }
//! Return the use of HW DEBUG flag
bool useHwDebug() const { return useHwDebug_; }
protected:
bool isRegistered_; //! flag to indicate the debugger has been registered
bool useHwDebug_; //! flag to indicate the HW DEBUG is using
};
/**@}*/
/**
* @}
*/
} // namespace amd
#endif // HWDEBUG_H_