diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudebugmanager.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudebugmanager.cpp index f67d0c9eb4..aa066f94d1 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpudebugmanager.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpudebugmanager.cpp @@ -93,7 +93,6 @@ GpuDebugManager::executePreDispatchCallBack(void* aqlPacket, oclEventHandle_, aqlPacket_, aclBinary_, - deviceTrapInfo_, preDispatchCallBackArgs_); } @@ -107,7 +106,7 @@ GpuDebugManager::executePostDispatchCallBack() if (NULL != postDispatchCallBackFunc_) { cl_device_id clDeviceId = as_cl(device_); postDispatchCallBackFunc_(clDeviceId, - 0, + aqlPacket_->completion_signal.handle, postDispatchCallBackArgs_); } } @@ -202,10 +201,8 @@ GpuDebugManager::setupTrapInformation(DebugToolInfo* toolInfo) toolInfo->reservedCuNum_ = execMode_.reservedCuNum; - toolInfo->trapHandler_ = - as_amd(reinterpret_cast(deviceTrapInfo_[kDebugTrapHandlerLocation])); - toolInfo->trapBuffer_ = - as_amd(reinterpret_cast(deviceTrapInfo_[kDebugTrapBufferLocation])); + toolInfo->trapHandler_ = rtTrapInfo_[kDebugTrapHandlerLocation]; + toolInfo->trapBuffer_ = rtTrapInfo_[kDebugTrapBufferLocation]; } diff --git a/projects/clr/rocclr/runtime/device/hwdebug.cpp b/projects/clr/rocclr/runtime/device/hwdebug.cpp index 8cfa01fa21..189478ece7 100644 --- a/projects/clr/rocclr/runtime/device/hwdebug.cpp +++ b/projects/clr/rocclr/runtime/device/hwdebug.cpp @@ -45,7 +45,9 @@ HwDebugManager::HwDebugManager(amd::Device* device) { memset(&debugInfo_, 0, sizeof(debugInfo_)); - memset(deviceTrapInfo_, 0, sizeof(uint64_t) * kDebugTrapLocationMax); + for (int i = 0; i < kDebugTrapLocationMax; i++) { + rtTrapInfo_[i] = NULL; + } } HwDebugManager::~HwDebugManager() @@ -172,4 +174,14 @@ HwDebugManager::assignKernelParamMem(uint32_t paramIdx, amd::Memory* mem) paramMemory_[paramIdx] = mem; } +void +HwDebugManager::installTrap(cl_dbg_trap_type_amd trapType, + amd::Memory* trapHandler, + amd::Memory* trapBuffer) +{ + rtTrapInfo_[trapType<<2] = trapHandler; + rtTrapInfo_[(trapType<<2)+1] = trapBuffer; +} + + } // namespace amd diff --git a/projects/clr/rocclr/runtime/device/hwdebug.hpp b/projects/clr/rocclr/runtime/device/hwdebug.hpp index bca608a75f..7fa5baedb4 100644 --- a/projects/clr/rocclr/runtime/device/hwdebug.hpp +++ b/projects/clr/rocclr/runtime/device/hwdebug.hpp @@ -157,6 +157,11 @@ public: //! Get kernel parameter memory object cl_mem getKernelParamMem(uint32_t paramIdx) const; + //! Install trap handler + void installTrap(cl_dbg_trap_type_amd trapType, + amd::Memory* pTrapHandler, + amd::Memory* pTrapBuffer); + //! Flush cache virtual void flushCache(uint32_t mask) = 0; @@ -207,7 +212,7 @@ public: //! Execute the pre-dispatch callback function virtual void executePreDispatchCallBack(void* aqlPacket, - void* toolInfo) = 0; + void* toolInfo) = 0; //! Return the use of HW DEBUG flag bool isMsgBufferReady() const { return dbgMsgBufferReady_; } @@ -222,9 +227,6 @@ protected: //! Return the register flag bool isRegistered() const { return isRegistered_; } - //! Return the device trap handler information - const uint64_t* deviceTrapInfo() const { return deviceTrapInfo_; } - protected: const amd::Context* context_; ///< context that used to create host queue for the debugger @@ -236,7 +238,7 @@ protected: 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* rtTrapInfo_[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 @@ -255,7 +257,6 @@ protected: cl_dbg_exception_policy_amd excpPolicy_; //!< exception policy cl_dbg_kernel_exec_mode_amd execMode_; //!< kernel execution mode RuntimeTrapInfo rtTrapHandlerInfo_; //!< Runtime trap information - };