diff --git a/projects/clr/hipamd/src/hip_event.cpp b/projects/clr/hipamd/src/hip_event.cpp index f18b2febc5..9953e3da76 100644 --- a/projects/clr/hipamd/src/hip_event.cpp +++ b/projects/clr/hipamd/src/hip_event.cpp @@ -19,8 +19,9 @@ THE SOFTWARE. */ #include - #include "hip_event.hpp" +#include "hip_graph_internal.hpp" + #if !defined(_MSC_VER) #include #endif @@ -406,16 +407,16 @@ hipError_t hipEventRecord_common(hipEvent_t event, hipStream_t stream, unsigned std::vector lastCapturedNodes = s->GetLastCapturedNodes(); e->SetNodesPrevToRecorded(lastCapturedNodes); if (flags == hipEventRecordExternal) { - hip::GraphNode* pGraphNode; - status = - hipGraphAddEventRecordNode((hipGraphNode_t*)&pGraphNode, (hipGraph_t)s->GetCaptureGraph(), - (hipGraphNode_t*)s->GetLastCapturedNodes().data(), - s->GetLastCapturedNodes().size(), (hipEvent_t)e); + hip::GraphNode* node = new hip::GraphEventRecordNode(reinterpret_cast(e)); + hipError_t status = hip::ihipGraphAddNode( + node, reinterpret_cast(s->GetCaptureGraph()), + reinterpret_cast(s->GetLastCapturedNodes().data()), + s->GetLastCapturedNodes().size(), false); if (status != hipSuccess) { ClPrint(amd::LOG_ERROR, amd::LOG_API, "hipEventRecord add external event node failed"); return status; } - s->SetLastCapturedNode(pGraphNode); + s->SetLastCapturedNode(node); } } else { if (e->deviceId() != hip_stream->DeviceId()) { diff --git a/projects/clr/hipamd/src/hip_graph_internal.hpp b/projects/clr/hipamd/src/hip_graph_internal.hpp index 5e45823b03..768a05bb1a 100644 --- a/projects/clr/hipamd/src/hip_graph_internal.hpp +++ b/projects/clr/hipamd/src/hip_graph_internal.hpp @@ -47,6 +47,9 @@ class GraphExec; class UserObject; class GraphKernelNode; typedef GraphNode* Node; +hipError_t ihipGraphAddNode(hip::GraphNode* graphNode, hip::Graph* graph, + hip::GraphNode* const* pDependencies, size_t numDependencies, + bool capture); class UserObject : public amd::ReferenceCountedObject { typedef void (*UserCallbackDestructor)(void* data);