647aba6ed2
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
133 líneas
4.3 KiB
C++
133 líneas
4.3 KiB
C++
/*******************************************************************************
|
|
*
|
|
* Copyright (c) 2014 Advanced Micro Devices, Inc. (unpublished)
|
|
*
|
|
* All rights reserved. This notice is intended as a precaution against
|
|
* inadvertent publication and does not imply publication or any waiver
|
|
* of confidentiality. The year included in the foregoing notice is the
|
|
* year of creation of the work.
|
|
*
|
|
******************************************************************************/
|
|
#ifndef HWDBG_DEBUGMANAGER_H__
|
|
#define HWDBG_DEBUGMANAGER_H__
|
|
|
|
#include "gpuvirtual.hpp"
|
|
#include "gpudebugger.hpp"
|
|
|
|
namespace gpu {
|
|
|
|
class GpuDebugManager;
|
|
class Device;
|
|
class Memory;
|
|
|
|
|
|
/*! \brief Debug Manager Class
|
|
*
|
|
* The debug manager class is used to pass all the trap info to the
|
|
* kernel dispatch and then the kernel execution can use such trap information
|
|
* for kernel execution. This class contains the trap handler and shader event
|
|
* objects. The trap handler is setup by users and passed to the kernel dispatch.
|
|
* The shader event is to receive interrupts from the GPU and then users can
|
|
* perform various operations.
|
|
*
|
|
* This class also provides the interface for setting up the pre-dispatch
|
|
* callback functions used by the profiler and debugger. It also provides
|
|
* a way to retrieve various debug information for the kernel execution.
|
|
*
|
|
*/
|
|
class GpuDebugManager : public amd::HwDebugManager {
|
|
public:
|
|
|
|
//! Constructor of the debug manager class
|
|
GpuDebugManager(amd::Device* device);
|
|
|
|
//! Destructor of the debug manager class
|
|
~GpuDebugManager();
|
|
|
|
//! Get the single instance of the GpuDebugManager class
|
|
static GpuDebugManager* getDefaultInstance();
|
|
|
|
//! Destroy the GpuDebugManager class object
|
|
static void destroyInstances();
|
|
|
|
//! Flush cache
|
|
void flushCache(uint32_t mask);
|
|
|
|
//! Create the debug event
|
|
DebugEvent createDebugEvent(const bool autoReset);
|
|
|
|
//! Wait for the debug event
|
|
cl_int waitDebugEvent(DebugEvent pEvent, uint32_t timeOut) const;
|
|
|
|
//! Destroy the debug event
|
|
void destroyDebugEvent(DebugEvent* pEvent);
|
|
|
|
//! Register the debugger
|
|
cl_int registerDebugger(amd::Context*context, uintptr_t messageStorage);
|
|
|
|
//! Register the debugger with KMD after command queue has been created
|
|
cl_int registerDebuggerOnQueue(device::VirtualDevice* vDevice);
|
|
|
|
//! Unregister the debugger
|
|
void unregisterDebugger();
|
|
|
|
//! Send the wavefront control cmmand
|
|
void wavefrontControl(uint32_t waveAction,
|
|
uint32_t waveMode,
|
|
uint32_t trapId,
|
|
void* waveAddr) const;
|
|
|
|
//! Set address watching point
|
|
void setAddressWatch(uint32_t numWatchPoints,
|
|
void** watchAddress,
|
|
uint64_t* watchMask,
|
|
uint64_t* watchMode,
|
|
DebugEvent* pEvent);
|
|
|
|
//! Get the packet information for dispatch
|
|
void getPacketAmdInfo(const void* aqlCodeInfo, void* packetInfo) const;
|
|
|
|
//! Set global memory values
|
|
void setGlobalMemory(amd::Memory* memObj, uint32_t offset, void* srcPtr, uint32_t size);
|
|
|
|
//! Execute the post-dispatch callback function
|
|
void executePostDispatchCallBack();
|
|
|
|
//! Execute the pre-dispatch callback function
|
|
void executePreDispatchCallBack(void* aqlPacket,
|
|
void* toolInfo);
|
|
|
|
private:
|
|
|
|
//! Setup trap handler info for kernel execution
|
|
void setupTrapInformation(DebugToolInfo* toolInfo);
|
|
|
|
|
|
protected:
|
|
|
|
const VirtualGPU* vGpu() const { return vGpu_; }
|
|
|
|
private:
|
|
|
|
const gpu::Device* device() const {
|
|
return reinterpret_cast<const gpu::Device *>(device_); }
|
|
|
|
VirtualGPU* vGpu_; //!< the virtual GPU
|
|
|
|
uintptr_t debugMessages_; //!< Pointer to a SHARED_DEBUG_MESSAGES pass to the KMD
|
|
|
|
HwDbgAddressWatch* addressWatch_; //!< Address watch data
|
|
size_t addressWatchSize_; //!< Size of address watch data
|
|
|
|
//! Arguments used by the callback function
|
|
void* oclEventHandle_; //!< event handler
|
|
const hsa_kernel_dispatch_packet_t* aqlPacket_; //!< AQL packet
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace gpu
|
|
|
|
#endif // HWDBG_DEBUGMANAGER_H__
|