From b293e110a826e9d2dccdb8c7055223dbff0df899 Mon Sep 17 00:00:00 2001 From: foreman Date: Fri, 9 Jan 2015 15:56:52 -0500 Subject: [PATCH] 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 --- opencl/api/opencl/amdocl/cl_debugger_amd.cpp | 84 +++++++++++++++----- opencl/api/opencl/amdocl/cl_debugger_amd.h | 6 +- 2 files changed, 67 insertions(+), 23 deletions(-) diff --git a/opencl/api/opencl/amdocl/cl_debugger_amd.cpp b/opencl/api/opencl/amdocl/cl_debugger_amd.cpp index 508b494412..9781fc3ea5 100644 --- a/opencl/api/opencl/amdocl/cl_debugger_amd.cpp +++ b/opencl/api/opencl/amdocl/cl_debugger_amd.cpp @@ -107,7 +107,9 @@ RUNTIME_ENTRY(cl_int, clHwDbgFlushCacheAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->flushCache(mask.ui32All); + debugManager->flushCache(mask.ui32All); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -142,7 +144,9 @@ RUNTIME_ENTRY(cl_int, clHwDbgSetExceptionPolicyAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->setExceptionPolicy(policy); + debugManager->setExceptionPolicy(policy); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -176,7 +180,9 @@ RUNTIME_ENTRY(cl_int, clHwDbgGetExceptionPolicyAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->getExceptionPolicy(policy); + debugManager->getExceptionPolicy(policy); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -210,7 +216,9 @@ RUNTIME_ENTRY(cl_int, clHwDbgSetKernelExecutionModeAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->setKernelExecutionMode(mode); + debugManager->setKernelExecutionMode(mode); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -244,7 +252,9 @@ RUNTIME_ENTRY(cl_int, clHwDbgGetKernelExecutionModeAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->getKernelExecutionMode(mode); + debugManager->getKernelExecutionMode(mode); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -365,7 +375,9 @@ RUNTIME_ENTRY(cl_int, clHwDbgDestroyEventAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->destroyDebugEvent(*pDebugEvent); + debugManager->destroyDebugEvent(pDebugEvent); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -403,6 +415,11 @@ RUNTIME_ENTRY(cl_int, clHwDbgRegisterDebuggerAMD, ( return CL_INVALID_VALUE; } + // check if the debugger has already registered + if (NULL != as_amd(device)->hwDebugMgr()) { + return CL_INVALID_VALUE; + } + return as_amd(device)->hwDebugManagerInit(as_amd(context), reinterpret_cast(pMessageStorage)); } @@ -430,7 +447,10 @@ RUNTIME_ENTRY(cl_int, clHwDbgUnregisterDebuggerAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->unregisterDebugger(); + as_amd(device)->hwDebugManagerRemove(); + + return CL_SUCCESS; + } RUNTIME_EXIT @@ -519,7 +539,9 @@ RUNTIME_ENTRY(cl_int, clHwDbgWaveControlAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->wavefrontControl(action, mode, trapId, (void *) &waveAddress); + debugManager->wavefrontControl(action, mode, trapId, (void *) &waveAddress); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -584,9 +606,11 @@ RUNTIME_ENTRY(cl_int, clHwDbgAddressWatchAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->setAddressWatch(numWatchPoints, watchAddress, watchMask, - reinterpret_cast(watchMode), - watchEvent); + debugManager->setAddressWatch(numWatchPoints, watchAddress, watchMask, + reinterpret_cast(watchMode), + watchEvent); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -620,7 +644,9 @@ RUNTIME_ENTRY(cl_int, clHwDbgGetAqlPacketInfoAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->getPacketAmdInfo(aqlCodeInfo, packetInfo); + debugManager->getPacketAmdInfo(aqlCodeInfo, packetInfo); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -644,12 +670,19 @@ RUNTIME_ENTRY(cl_int, clHwDbgGetDispatchDebugInfoAMD, ( return CL_INVALID_DEVICE; } + if (NULL == debugInfo) { + LogWarning("clHwDbgGetDispatchDebugInfoAMD: Invalid debug information pointer."); + return CL_INVALID_VALUE; + } + amd::HwDebugManager * debugManager = as_amd(device)->hwDebugMgr(); if (NULL == debugManager) { return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->getDispatchDebugInfo((void *) debugInfo); + debugManager->getDispatchDebugInfo((void *) debugInfo); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -680,7 +713,9 @@ RUNTIME_ENTRY(cl_int, clHwDbgMapKernelCodeAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->mapKernelCode(aqlCodeAddress, aqlCodeSize); + debugManager->mapKernelCode(aqlCodeAddress, aqlCodeSize); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -743,7 +778,9 @@ RUNTIME_ENTRY(cl_int, clHwDbgMapScratchRingAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->mapScratchRing(scratchRingAddr, scratchRingSize); + debugManager->mapScratchRing(scratchRingAddr, scratchRingSize); + + return CL_SUCCESS; } RUNTIME_EXIT @@ -796,9 +833,9 @@ RUNTIME_EXIT * - CL_INVALID_KERNEL_ARGS if it fails to get the memory object for the kernel argument */ RUNTIME_ENTRY(cl_int, clHwDbgGetKernelParamMemAMD, ( - cl_device_id device, - cl_uint paramIdx, - cl_ulong * paramMem)) + cl_device_id device, + cl_uint paramIdx, + cl_mem * paramMem)) { if (!is_valid(device)) { return CL_INVALID_DEVICE; @@ -847,7 +884,7 @@ RUNTIME_EXIT */ RUNTIME_ENTRY(cl_int, clHwDbgSetGlobalMemoryAMD, ( cl_device_id device, - void * memObject, + cl_mem memObject, cl_uint offset, void * srcMem, cl_uint size)) @@ -862,7 +899,14 @@ RUNTIME_ENTRY(cl_int, clHwDbgSetGlobalMemoryAMD, ( return CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD; } - return debugManager->setGlobalMemory(memObject, offset, srcMem, size); + if (0 > offset || 0 >= size) { + return CL_INVALID_VALUE; + } + + amd::Memory* globalMem = as_amd(memObject); + debugManager->setGlobalMemory(globalMem, offset, srcMem, size); + + return CL_SUCCESS; } RUNTIME_EXIT diff --git a/opencl/api/opencl/amdocl/cl_debugger_amd.h b/opencl/api/opencl/amdocl/cl_debugger_amd.h index b1e17223ad..e27cdad5e8 100644 --- a/opencl/api/opencl/amdocl/cl_debugger_amd.h +++ b/opencl/api/opencl/amdocl/cl_debugger_amd.h @@ -112,7 +112,7 @@ extern "C" { #define CL_EVENT_TIMEOUT_AMD -83 -typedef cl_ulong cl_dbg_event_amd; //! debug event +typedef uintptr_t cl_dbg_event_amd; //! debug event /*! \brief Wave actions used to control the wave execution on the hardware * @@ -732,7 +732,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapScratchRingAMD( extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetKernelParamMemAMD( cl_device_id /* devicepointer */, cl_uint /* paramIdx */, - cl_ulong * /* paramMem */ + cl_mem * /* paramMem */ ) CL_API_SUFFIX__VERSION_2_0; /*! \brief Set value of a global memory object @@ -755,7 +755,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetKernelParamMemAMD( */ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetGlobalMemoryAMD( cl_device_id /* device */, - void * /* memObject */, + cl_mem /* memObject */, cl_uint /* offset */, void * /* srcMem */, cl_uint /* size */