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
This commit is contained in:
@@ -0,0 +1,175 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "hwdebug.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
namespace amd {
|
||||
|
||||
class Device;
|
||||
|
||||
/*
|
||||
***************************************************************************
|
||||
* Implementation of GPU Debug Manager class
|
||||
***************************************************************************
|
||||
*/
|
||||
|
||||
//! Constructor of the debug manager class
|
||||
HwDebugManager::HwDebugManager(amd::Device* device)
|
||||
: context_(NULL)
|
||||
, device_(device)
|
||||
, preDispatchCallBackFunc_(NULL)
|
||||
, postDispatchCallBackFunc_(NULL)
|
||||
, preDispatchCallBackArgs_(NULL)
|
||||
, postDispatchCallBackArgs_(NULL)
|
||||
, paramMemory_(NULL)
|
||||
, numParams_(0)
|
||||
, aclBinary_(NULL)
|
||||
, aqlCodeAddr_(NULL)
|
||||
, aqlCodeSize_(0)
|
||||
, scratchRingAddr_(NULL)
|
||||
, scratchRingSize_(0)
|
||||
, isRegistered_(false)
|
||||
, dbgMsgBufferReady_(false)
|
||||
{
|
||||
memset(&debugInfo_, 0, sizeof(debugInfo_));
|
||||
|
||||
memset(deviceTrapInfo_, 0, sizeof(uint64_t) * kDebugTrapLocationMax);
|
||||
}
|
||||
|
||||
HwDebugManager::~HwDebugManager()
|
||||
{
|
||||
if (NULL != paramMemory_) {
|
||||
delete[] paramMemory_;
|
||||
}
|
||||
}
|
||||
|
||||
//! Setup the call back function pointer
|
||||
void
|
||||
HwDebugManager::setCallBackFunctions(cl_PreDispatchCallBackFunctionAMD preDispatchFunction,
|
||||
cl_PostDispatchCallBackFunctionAMD postDispatchFunction)
|
||||
{
|
||||
preDispatchCallBackFunc_ = preDispatchFunction;
|
||||
postDispatchCallBackFunc_ = postDispatchFunction;
|
||||
}
|
||||
|
||||
//! Setup the call back argument pointers
|
||||
void
|
||||
HwDebugManager::setCallBackArguments(void* preDispatchArgs, void* postDispatchArgs)
|
||||
{
|
||||
preDispatchCallBackArgs_ = preDispatchArgs;
|
||||
postDispatchCallBackArgs_ = postDispatchArgs;
|
||||
}
|
||||
|
||||
//! Get dispatch debug info
|
||||
void
|
||||
HwDebugManager::getDispatchDebugInfo(void* debugInfo) const
|
||||
{
|
||||
memcpy(debugInfo, (void*) &debugInfo_, sizeof(DispatchDebugInfo));
|
||||
}
|
||||
|
||||
|
||||
//! Set the kernel code address and its size
|
||||
void
|
||||
HwDebugManager::setKernelCodeInfo(address aqlCodeAddr, uint32_t aqlCodeSize)
|
||||
{
|
||||
aqlCodeAddr_ = aqlCodeAddr;
|
||||
aqlCodeSize_ = aqlCodeSize;
|
||||
}
|
||||
|
||||
//! Get the scratch ring
|
||||
void
|
||||
HwDebugManager::setScratchRing(address scratchRingAddr, uint32_t scratchRingSize)
|
||||
{
|
||||
scratchRingAddr_ = scratchRingAddr;
|
||||
scratchRingSize_ = scratchRingSize;
|
||||
}
|
||||
|
||||
//! Map the shader (AQL code) for host access
|
||||
void
|
||||
HwDebugManager::mapKernelCode(uint64_t* aqlCodeAddr, uint32_t* aqlCodeSize) const
|
||||
{
|
||||
*aqlCodeAddr = reinterpret_cast<uint64_t>(aqlCodeAddr_);
|
||||
*aqlCodeSize = aqlCodeSize_;
|
||||
}
|
||||
|
||||
//! Map the scratch ring for host access
|
||||
void
|
||||
HwDebugManager::mapScratchRing(uint64_t* scratchRingAddr, uint32_t* scratchRingSize) const
|
||||
{
|
||||
*scratchRingAddr = reinterpret_cast<uint64_t>(scratchRingAddr_);
|
||||
*scratchRingSize = scratchRingSize_;
|
||||
}
|
||||
|
||||
void
|
||||
HwDebugManager::setExceptionPolicy(void* exceptionPolicy)
|
||||
{
|
||||
memcpy(&excpPolicy_, exceptionPolicy, sizeof(cl_dbg_exception_policy_amd));
|
||||
}
|
||||
|
||||
void
|
||||
HwDebugManager::getExceptionPolicy(void* exceptionPolicy) const
|
||||
{
|
||||
memcpy(exceptionPolicy, &excpPolicy_, sizeof(cl_dbg_exception_policy_amd));
|
||||
}
|
||||
|
||||
void
|
||||
HwDebugManager::setKernelExecutionMode(void* mode)
|
||||
{
|
||||
cl_dbg_kernel_exec_mode_amd* execMode = reinterpret_cast<cl_dbg_kernel_exec_mode_amd*>(mode);
|
||||
execMode_.ui32All = execMode->ui32All;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HwDebugManager::getKernelExecutionMode(void* mode) const
|
||||
{
|
||||
cl_dbg_kernel_exec_mode_amd* execMode = reinterpret_cast<cl_dbg_kernel_exec_mode_amd*>(mode);
|
||||
execMode->ui32All = execMode_.ui32All;
|
||||
}
|
||||
|
||||
void
|
||||
HwDebugManager::setAclBinary(void* aclBinary)
|
||||
{
|
||||
aclBinary_ = aclBinary;
|
||||
}
|
||||
|
||||
void
|
||||
HwDebugManager::allocParamMemList(uint32_t numParams)
|
||||
{
|
||||
if (NULL != paramMemory_) {
|
||||
delete [] paramMemory_;
|
||||
}
|
||||
|
||||
numParams_ = numParams;
|
||||
paramMemory_ = new amd::Memory*[numParams];
|
||||
}
|
||||
|
||||
cl_mem
|
||||
HwDebugManager::getKernelParamMem(uint32_t paramIdx) const
|
||||
{
|
||||
assert((paramIdx < numParams_) && "Invalid kernel parameter index too big");
|
||||
|
||||
return as_cl(paramMemory_[paramIdx]);
|
||||
}
|
||||
|
||||
void
|
||||
HwDebugManager::assignKernelParamMem(uint32_t paramIdx, amd::Memory* mem)
|
||||
{
|
||||
assert((paramIdx < numParams_) && "Invalid kernel parameter index too big");
|
||||
|
||||
paramMemory_[paramIdx] = mem;
|
||||
}
|
||||
|
||||
} // namespace amd
|
||||
Reference in New Issue
Block a user