P4 to Git Change 1110409 by wchau@wchau_WINDOWS7_OCL on 2015/01/09 15:46:34
ECR #399840 - re-checkin of CL1109955 with the fix of OpenCL sanity check timeout (hw debug flag initialization)
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_debugger_amd.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_debugger_amd.h#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#174 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#238 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudebugger.hpp#3 add
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudebugmanager.cpp#3 add
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudebugmanager.hpp#3 add
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#490 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#137 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#275 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#106 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#200 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuscsi.cpp#30 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#297 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#346 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.hpp#124 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp#69 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.h#42 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hwdebug.cpp#3 add
... //depot/stg/opencl/drivers/opencl/runtime/device/hwdebug.hpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#223 edit
[ROCm/clr commit: 647aba6ed2]
This commit is contained in:
@@ -5,42 +5,67 @@
|
||||
#ifndef HWDEBUG_H_
|
||||
#define HWDEBUG_H_
|
||||
|
||||
#include "device.hpp"
|
||||
#include "amdocl/cl_debugger_amd.h"
|
||||
|
||||
#define TBA_START_OFFSET 256
|
||||
static const int TbaStartOffset = 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
|
||||
*******************************************************************************
|
||||
static const int RtTrapBufferWaveSize = 64;
|
||||
static const int RtTrapBufferSeNum = 4;
|
||||
static const int RtTrapBufferShNum = 2;
|
||||
static const int RtTrapBufferCuNum = 16;
|
||||
static const int RtTrapBufferSimdNum = 4;
|
||||
static const int RtTrapBufferWaveNum = 16;
|
||||
static const int RtTrapBufferTotalWaveNum =
|
||||
((RtTrapBufferSeNum) * \
|
||||
(RtTrapBufferShNum) * \
|
||||
(RtTrapBufferCuNum) * \
|
||||
(RtTrapBufferSimdNum) * \
|
||||
(RtTrapBufferWaveNum));
|
||||
|
||||
|
||||
/*! \brief Debug trap handler location in the runtime trap buffer
|
||||
*
|
||||
* This enumeration is used to indicate the location where the debug
|
||||
* trap handler and debug trap buffer are set in the device trap buffer.
|
||||
*/
|
||||
struct PacketAmdInfo
|
||||
enum DebugTrapLocation
|
||||
{
|
||||
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
|
||||
kDebugTrapHandlerLocation = 0, //! Debug Trap handler location, this location must be 0
|
||||
kDebugTrapBufferLocation = 1, //! Debug Trap buffer location, this location must be 1
|
||||
kDebugTrapLocationMax = 2
|
||||
};
|
||||
|
||||
//! Cache mask for invalidation
|
||||
struct HwDbgGpuCacheMask
|
||||
|
||||
/*! \brief This structure is for the debug info in each kernel dispatch.
|
||||
*
|
||||
* Contains the memory descriptor information of the scratch memory and the global
|
||||
* memory
|
||||
*/
|
||||
struct DispatchDebugInfo
|
||||
{
|
||||
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;
|
||||
};
|
||||
uint32_t scratchMemoryDescriptor_[4]; //! Scratch memory descriptor
|
||||
uint32_t globalMemoryDescriptor_[4]; //! Global memory descriptor
|
||||
};
|
||||
|
||||
/*! \brief Trap handler descriptor
|
||||
*
|
||||
* The trap handler descriptor contains the details of a given trap handler.
|
||||
*/
|
||||
struct TrapHandlerInfo {
|
||||
amd::Memory* trapHandler_; //!< Device memory for the trap handler
|
||||
amd::Memory* trapBuffer_; //!< Device memory for the trap buffer
|
||||
};
|
||||
|
||||
/*! \brief Structure of the runtime trap handler buffer, which includes the following
|
||||
* information: information of the runtime trap handler and buffer, information of
|
||||
* the level-2 trap handlers and buffers.
|
||||
*/
|
||||
struct RuntimeTrapInfo {
|
||||
TrapHandlerInfo trap_; //!< Structure of the address of all trap handlers
|
||||
uint32_t dispatchId_; //!< Dispatch ID that signals the shader event
|
||||
uint32_t vgpr_backup_[RtTrapBufferTotalWaveNum][RtTrapBufferWaveSize];
|
||||
//!< Buffer to backup the VGPR used by the runtime trap handler
|
||||
};
|
||||
|
||||
|
||||
@@ -48,10 +73,16 @@ struct HwDbgGpuCacheMask
|
||||
/**
|
||||
* Opaque pointer to trap event
|
||||
*/
|
||||
typedef uint64_t DebugEvent; //! opaque pointer to trap event
|
||||
typedef uintptr_t DebugEvent;
|
||||
|
||||
namespace amd {
|
||||
|
||||
|
||||
class Context;
|
||||
class Device;
|
||||
class HostQueue;
|
||||
|
||||
|
||||
/*! \class HwDebugManager
|
||||
*
|
||||
* \brief The device interface class for the hardware debug manager
|
||||
@@ -61,32 +92,73 @@ class HwDebugManager
|
||||
public:
|
||||
|
||||
//! Constructor for the Hardware Debug Manager
|
||||
HwDebugManager() : isRegistered_(false), useHwDebug_(false) {}
|
||||
HwDebugManager(amd::Device* device);
|
||||
|
||||
//! Destructor for Hardware Debug Manager
|
||||
~HwDebugManager() {};
|
||||
virtual ~HwDebugManager();
|
||||
|
||||
//! Setup the call back function pointer
|
||||
virtual void setCallBackFunctions(cl_PreDispatchCallBackFunctionAMD preDispatchFn,
|
||||
cl_PostDispatchCallBackFunctionAMD postDispatchFn) = 0;
|
||||
void setCallBackFunctions(cl_PreDispatchCallBackFunctionAMD preDispatchFn,
|
||||
cl_PostDispatchCallBackFunctionAMD postDispatchFn);
|
||||
|
||||
//! Setup the call back argument pointers
|
||||
virtual void setCallBackArguments(void *preDispatchArgs, void *postDispatchArgs) = 0;
|
||||
void setCallBackArguments(void* preDispatchArgs, void* postDispatchArgs);
|
||||
|
||||
//! Flush cache
|
||||
virtual cl_int flushCache(uint32_t mask) = 0;
|
||||
//! Get dispatch debug info
|
||||
void getDispatchDebugInfo(void* debugInfo) const;
|
||||
|
||||
//! Set the kernel code address and its size
|
||||
void setKernelCodeInfo(address aqlCodeAddr, uint32_t aqlCodeSize);
|
||||
|
||||
//! Get the scratch ring
|
||||
void setScratchRing(address scratchRingAddr, uint32_t scratchRingSize);
|
||||
|
||||
//! Map the shader (AQL code) for host access
|
||||
void mapKernelCode(uint64_t* aqlCodeAddr, uint32_t* aqlCodeSize) const;
|
||||
|
||||
//! Map the scratch ring for host access
|
||||
void mapScratchRing(uint64_t* scratchRingAddr, uint32_t* scratchRingSize) const;
|
||||
|
||||
//! Retrieve the pre-dispatch callback function
|
||||
cl_PreDispatchCallBackFunctionAMD preDispatchCallBackFunc() const
|
||||
{ return preDispatchCallBackFunc_; }
|
||||
|
||||
//! Retrieve the post-dispatch callback function
|
||||
cl_PostDispatchCallBackFunctionAMD postDispatchCallBackFunc() const
|
||||
{ return postDispatchCallBackFunc_; }
|
||||
|
||||
//! Retrieve the pre-dispatch callback function arguments
|
||||
void* preDispatchCallBackArgs() const { return preDispatchCallBackArgs_; }
|
||||
|
||||
//! Retrieve the post-dispatch callback function arguments
|
||||
void* postDispatchCallBackArgs() const { return postDispatchCallBackArgs_; }
|
||||
|
||||
//! Set exception policy
|
||||
virtual cl_int setExceptionPolicy(void *policy) = 0;
|
||||
void setExceptionPolicy(void* policy);
|
||||
|
||||
//! Get exception policy
|
||||
virtual cl_int getExceptionPolicy(void *policy) const = 0;
|
||||
void getExceptionPolicy(void* policy) const;
|
||||
|
||||
//! Set the kernel execution mode
|
||||
virtual cl_int setKernelExecutionMode(void *mode) = 0;
|
||||
void setKernelExecutionMode(void* mode);
|
||||
|
||||
//! Get the kernel execution mode
|
||||
virtual cl_int getKernelExecutionMode(void *mode) const = 0;
|
||||
void getKernelExecutionMode(void* mode) const;
|
||||
|
||||
//! Setup the pointer to the aclBinary within the debug manager
|
||||
void setAclBinary(void* aclBinary);
|
||||
|
||||
//! Allocate storage to keep the memory pointers of the kernel parameters
|
||||
void allocParamMemList(uint32_t numParams);
|
||||
|
||||
//! Assign the kernel parameter memory
|
||||
void assignKernelParamMem(uint32_t paramIdx, amd::Memory* mem);
|
||||
|
||||
//! Get kernel parameter memory object
|
||||
cl_mem getKernelParamMem(uint32_t paramIdx) const;
|
||||
|
||||
//! Flush cache
|
||||
virtual void flushCache(uint32_t mask) = 0;
|
||||
|
||||
//! Create the debug event
|
||||
virtual DebugEvent createDebugEvent(const bool autoReset) = 0;
|
||||
@@ -95,95 +167,99 @@ public:
|
||||
virtual cl_int waitDebugEvent(DebugEvent pEvent, uint32_t timeOut) const = 0;
|
||||
|
||||
//! Destroy the debug event
|
||||
virtual cl_int destroyDebugEvent(DebugEvent pEvent) = 0;
|
||||
virtual void destroyDebugEvent(DebugEvent* pEvent) = 0;
|
||||
|
||||
//! Register the debugger
|
||||
virtual cl_int registerDebugger(amd::Context *context, uintptr_t pMessageStorage) = 0;
|
||||
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;
|
||||
virtual cl_int registerDebuggerOnQueue(device::VirtualDevice* vDevice) = 0;
|
||||
|
||||
//! Unregister the debugger
|
||||
virtual cl_int unregisterDebugger() = 0;
|
||||
virtual void 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,
|
||||
virtual void wavefrontControl(uint32_t waveAction,
|
||||
uint32_t waveMode,
|
||||
uint32_t trapId,
|
||||
void * waveAddr) const = 0;
|
||||
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;
|
||||
virtual void 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;
|
||||
virtual void getPacketAmdInfo(const void* aqlCodeInfo,
|
||||
void* packetInfo) const = 0;
|
||||
|
||||
//! Set global memory values
|
||||
virtual cl_int setGlobalMemory(void * memObj,
|
||||
uint32_t offset,
|
||||
void * srcPtr,
|
||||
uint32_t size) = 0;
|
||||
virtual void setGlobalMemory(amd::Memory* 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;
|
||||
//! Execute the post-dispatch callback function
|
||||
virtual void executePostDispatchCallBack() = 0;
|
||||
|
||||
//! Get kernel parameter memory object
|
||||
virtual uint64_t getKernelParamMem(uint32_t paramIdx) const = 0;
|
||||
//! Execute the pre-dispatch callback function
|
||||
virtual void executePreDispatchCallBack(void* aqlPacket,
|
||||
void* toolInfo) = 0;
|
||||
|
||||
//! Set the kernel code address and its size
|
||||
virtual void setKernelCodeInfo(address aqlCodeAddr, uint32_t aqlCodeSize) = 0;
|
||||
//! Return the use of HW DEBUG flag
|
||||
bool isMsgBufferReady() const { return dbgMsgBufferReady_; }
|
||||
|
||||
//! Get the scratch ring
|
||||
virtual void setScratchRing(address scratchRingAddr, uint32_t scratchRingSize) = 0;
|
||||
protected:
|
||||
//! Return the context
|
||||
const amd::Context* context() const { return context_; }
|
||||
|
||||
//! 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; }
|
||||
//! Get the debug device
|
||||
const amd::Device* device() const { return device_; }
|
||||
|
||||
//! Return the register flag
|
||||
bool isRegistered() const { return isRegistered_; }
|
||||
|
||||
//! Return the use of HW DEBUG flag
|
||||
bool useHwDebug() const { return useHwDebug_; }
|
||||
|
||||
//! Return the device trap handler information
|
||||
const uint64_t* deviceTrapInfo() const { return deviceTrapInfo_; }
|
||||
|
||||
protected:
|
||||
bool isRegistered_; //! flag to indicate the debugger has been registered
|
||||
bool useHwDebug_; //! flag to indicate the HW DEBUG is using
|
||||
|
||||
const amd::Context* context_; ///< context that used to create host queue for the debugger
|
||||
amd::Device* device_; ///< Device to run the debugger
|
||||
|
||||
cl_PreDispatchCallBackFunctionAMD preDispatchCallBackFunc_; //!< pre-dispatch callback function
|
||||
cl_PostDispatchCallBackFunctionAMD postDispatchCallBackFunc_; //!< post-dispatch callback function
|
||||
void* preDispatchCallBackArgs_; //!< pre-dispatch callback function arguments
|
||||
void* postDispatchCallBackArgs_; //!< post-dispatch callback function arguments
|
||||
|
||||
DispatchDebugInfo debugInfo_; //!< Debug setting/information for kernel dispatch
|
||||
uint64_t deviceTrapInfo_[kDebugTrapLocationMax]; //!< Device trap buffer, to store various trap handlers on the device
|
||||
|
||||
amd::Memory** paramMemory_; //!< list of memory pointers for kernel parameters
|
||||
uint32_t numParams_; //!< number of kernel parameters
|
||||
|
||||
void* aclBinary_; //!< ACL binary
|
||||
|
||||
address aqlCodeAddr_; //!< The mapped AQL code to allow host access
|
||||
uint32_t aqlCodeSize_; //!< The size of the AQL code info
|
||||
|
||||
address scratchRingAddr_; //!< The mapped address of the scratch buffer
|
||||
uint32_t scratchRingSize_; //!< The size of the scratch ring
|
||||
|
||||
bool isRegistered_; //! flag to indicate the debugger has been registered
|
||||
bool dbgMsgBufferReady_; //! flag to indicate the HW DEBUG is using
|
||||
|
||||
cl_dbg_exception_policy_amd excpPolicy_; //!< exception policy
|
||||
cl_dbg_kernel_exec_mode_amd execMode_; //!< kernel execution mode
|
||||
RuntimeTrapInfo rtTrapHandlerInfo_; //!< Runtime trap information
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user