P4 to Git Change 1123271 by wchau@wchau_WINDOWS7_OCL on 2015/02/18 16:59:12

ECR #399840 - OpenCL Runtime HW Debug support development - add install_trap API to avoid the expose of runtime trap handler to the DBE.

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#41 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_debugger_amd.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_debugger_amd.h#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudebugmanager.cpp#6 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hwdebug.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hwdebug.hpp#5 edit
This commit is contained in:
foreman
2015-02-18 17:22:47 -05:00
parent 7e8cc31338
commit 11b7e95416
3 changed files with 84 additions and 4 deletions
+3 -2
View File
@@ -419,7 +419,7 @@ RUNTIME_ENTRY(cl_int, clGetContextInfo, (
}
return CL_SUCCESS;
}
case CL_CONTEXT_ADAPTER_D3D9EX_KHR: {
case CL_CONTEXT_ADAPTER_D3D9EX_KHR: {
if (param_value != NULL && param_value_size < sizeof(void*)) {
return CL_INVALID_VALUE;
}
@@ -534,7 +534,7 @@ clGetExtensionFunctionAddress(const char* func_name)
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireD3D10ObjectsKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseD3D10ObjectsKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireDX9MediaSurfacesKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseDX9MediaSurfacesKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseDX9MediaSurfacesKHR);
#endif //_WIN32
#if cl_amd_open_video
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueRunVideoProgramAMD);
@@ -590,6 +590,7 @@ clGetExtensionFunctionAddress(const char* func_name)
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnmapScratchRingAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetKernelParamMemAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetGlobalMemoryAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgInstallTrapAMD);
#endif //_WIN32
break;
case 'I':
@@ -911,6 +911,46 @@ RUNTIME_ENTRY(cl_int, clHwDbgSetGlobalMemoryAMD, (
RUNTIME_EXIT
/*! \brief Install the trap handler of a given type
*
* \param device specifies the device to be used
*
* \param trapType is the type of trap handler
*
* \param trapHandler is the pointer of trap handler (TBA)
*
* \param trapBuffer is the pointer of trap handler buffer (TMA)
*
* \return One of the following values:
* - CL_SUCCESS if the event occurs before the timeout
* - CL_INVALID_DEVICE if the device is not valid
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
RUNTIME_ENTRY(cl_int, clHwDbgInstallTrapAMD, (
cl_device_id device,
cl_dbg_trap_type_amd trapType,
cl_mem trapHandler,
cl_mem trapBuffer))
{
if (!is_valid(device)) {
return CL_INVALID_DEVICE;
}
amd::HwDebugManager * debugManager = as_amd(device)->hwDebugMgr();
if (NULL == debugManager) {
return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD;
}
amd::Memory* pTrapHandler = as_amd(trapHandler);
amd::Memory* pTrapBuffer = as_amd(trapBuffer);
debugManager->installTrap(trapType, pTrapHandler, pTrapBuffer);
return CL_SUCCESS;
}
RUNTIME_EXIT
/*! @}
* @}
*/
+41 -2
View File
@@ -114,6 +114,16 @@ extern "C" {
typedef uintptr_t cl_dbg_event_amd; //! debug event
/*! \brief Trap Handler Type
*
* The trap handler for each support type.
*/
enum cl_dbg_trap_type_amd
{
CL_DBG_DEBUG_TRAP = 0, //! HW debug
CL_DBG_MAX_TRAP
};
/*! \brief Wave actions used to control the wave execution on the hardware
*
* The wave action enumerations are used to specify the desired
@@ -245,7 +255,7 @@ typedef struct _cl_dispatch_debug_info_amd
*/
typedef struct _cl_aql_packet_info_amd
{
unsigned int trapReservedVgprIndex; //! VGPR index reserved for trap
cl_uint trapReservedVgprIndex; //! VGPR index reserved for trap
//! value is -1 when kernel was not compiled
//! in debug mode.
cl_uint scratchBufferWaveOffset; //! scratch buffer wave offset
@@ -285,7 +295,6 @@ typedef void * (*cl_PreDispatchCallBackFunctionAMD) ( cl_device_id device,
void *ocl_event_handle,
const void *aql_packet,
void *acl_binary,
cl_ulong *device_trap_buffer,
void *user_args);
/*! \brief Post-dispatch call back function signature
@@ -761,6 +770,36 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetGlobalMemoryAMD(
cl_uint /* size */
) CL_API_SUFFIX__VERSION_2_0;
/*! \brief Install the trap handler of a given type
*
* \param device specifies the device to be used
*
* \param trapType is the type of trap handler
*
* \param trapHandler is the pointer of trap handler (TBA)
*
* \param trapBuffer is the pointer of trap handler buffer (TMA)
*
* \param trapHandlerSize size (in bytes) of the trap handler
*
* \param trapBufferSize size (in bytes) of the trap handler buffer
*
* \return One of the following values:
* - CL_SUCCESS if the event occurs before the timeout
* - CL_INVALID_DEVICE if the device is not valid
* - CL_INVALID_VALUE if trapHandler is NULL or trapHandlerSize <= 0
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgInstallTrapAMD(
cl_device_id /* device */,
cl_dbg_trap_type_amd /* trapType */,
cl_mem /* trapHandler */,
cl_mem /* trapBuffer */
) CL_API_SUFFIX__VERSION_2_0;
#ifdef __cplusplus
} /*extern "C"*/
#endif /*__cplusplus*/