diff --git a/projects/clr/hipamd/src/hip_event.cpp b/projects/clr/hipamd/src/hip_event.cpp index 619af62467..fb2d592f80 100644 --- a/projects/clr/hipamd/src/hip_event.cpp +++ b/projects/clr/hipamd/src/hip_event.cpp @@ -166,7 +166,7 @@ int64_t EventDD::time(bool getStartTs) const { return static_cast(end); } } - +// ================================================================================================ hipError_t Event::streamWaitCommand(amd::Command*& command, hip::Stream* stream) { amd::Command::EventWaitList eventWaitList; if (event_ != nullptr) { @@ -182,12 +182,7 @@ hipError_t Event::streamWaitCommand(amd::Command*& command, hip::Stream* stream) } return hipSuccess; } - -hipError_t Event::enqueueStreamWaitCommand(hipStream_t stream, amd::Command* command) { - command->enqueue(); - return hipSuccess; -} - +// ================================================================================================ hipError_t Event::streamWait(hipStream_t stream, uint flags) { hip::Stream* hip_stream = hip::getStream(stream); // Access to event_ object must be lock protected @@ -203,10 +198,7 @@ hipError_t Event::streamWait(hipStream_t stream, uint flags) { if (status != hipSuccess) { return status; } - status = enqueueStreamWaitCommand(stream, command); - if (status != hipSuccess) { - return status; - } + command->enqueue(); command->release(); return hipSuccess; } @@ -323,6 +315,7 @@ hipError_t ihipEventCreateWithFlags(hipEvent_t* event, unsigned flags) { return hipSuccess; } +// ================================================================================================ hipError_t hipEventCreateWithFlags(hipEvent_t* event, unsigned flags) { HIP_INIT_API(hipEventCreateWithFlags, event, flags); @@ -333,6 +326,7 @@ hipError_t hipEventCreateWithFlags(hipEvent_t* event, unsigned flags) { HIP_RETURN(ihipEventCreateWithFlags(event, flags), *event); } +// ================================================================================================ hipError_t hipEventCreate(hipEvent_t* event) { HIP_INIT_API(hipEventCreate, event); @@ -343,6 +337,7 @@ hipError_t hipEventCreate(hipEvent_t* event) { HIP_RETURN(ihipEventCreateWithFlags(event, 0), *event); } +// ================================================================================================ hipError_t hipEventDestroy(hipEvent_t event) { HIP_INIT_API(hipEventDestroy, event); @@ -367,6 +362,7 @@ hipError_t hipEventDestroy(hipEvent_t event) { HIP_RETURN(hipSuccess); } +// ================================================================================================ hipError_t hipEventElapsedTime(float* ms, hipEvent_t start, hipEvent_t stop) { HIP_INIT_API(hipEventElapsedTime, ms, start, stop); @@ -388,6 +384,7 @@ hipError_t hipEventElapsedTime(float* ms, hipEvent_t start, hipEvent_t stop) { HIP_RETURN(eStart->elapsedTime(*eStop, *ms), "Elapsed Time = ", *ms); } +// ================================================================================================ hipError_t hipEventRecord_common(hipEvent_t event, hipStream_t stream, unsigned int flags) { if (!(flags == hipEventRecordDefault || flags == hipEventRecordExternal)){ return hipErrorInvalidValue; @@ -433,22 +430,26 @@ hipError_t hipEventRecord_common(hipEvent_t event, hipStream_t stream, unsigned return status; } +// ================================================================================================ hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream) { HIP_INIT_API(hipEventRecord, event, stream); HIP_RETURN(hipEventRecord_common(event, stream, hipEventRecordDefault)); } +// ================================================================================================ hipError_t hipEventRecord_spt(hipEvent_t event, hipStream_t stream) { HIP_INIT_API(hipEventRecord, event, stream); PER_THREAD_DEFAULT_STREAM(stream); HIP_RETURN(hipEventRecord_common(event, stream, hipEventRecordDefault)); } +// ================================================================================================ hipError_t hipEventRecordWithFlags(hipEvent_t event, hipStream_t stream, unsigned int flags) { HIP_INIT_API(hipEventRecordWithFlags, event, stream, flags); HIP_RETURN(hipEventRecord_common(event, stream, flags)); } +// ================================================================================================ hipError_t hipEventSynchronize(hipEvent_t event) { HIP_INIT_API(hipEventSynchronize, event); @@ -473,6 +474,7 @@ hipError_t hipEventSynchronize(hipEvent_t event) { HIP_RETURN(status); } +// ================================================================================================ hipError_t ihipEventQuery(hipEvent_t event) { if (event == nullptr) { return hipErrorInvalidHandle; diff --git a/projects/clr/hipamd/src/hip_event.hpp b/projects/clr/hipamd/src/hip_event.hpp index b7c888d392..84bb300891 100644 --- a/projects/clr/hipamd/src/hip_event.hpp +++ b/projects/clr/hipamd/src/hip_event.hpp @@ -121,7 +121,6 @@ class Event { hipError_t elapsedTime(Event& eStop, float& ms); virtual hipError_t streamWaitCommand(amd::Command*& command, hip::Stream* stream); - virtual hipError_t enqueueStreamWaitCommand(hipStream_t stream, amd::Command* command); virtual hipError_t streamWait(hipStream_t stream, uint flags); virtual hipError_t recordCommand(amd::Command*& command, amd::HostQueue* stream, diff --git a/projects/clr/hipamd/src/hip_event_ipc.cpp b/projects/clr/hipamd/src/hip_event_ipc.cpp index 0a63870b8b..52849e874b 100644 --- a/projects/clr/hipamd/src/hip_event_ipc.cpp +++ b/projects/clr/hipamd/src/hip_event_ipc.cpp @@ -75,6 +75,7 @@ bool IPCEvent::createIpcEventShmemIfNeeded() { return true; } +// ================================================================================================ hipError_t IPCEvent::query() { if (ipc_evt_.ipc_shmem_) { int prev_read_idx = ipc_evt_.ipc_shmem_->read_index; @@ -87,6 +88,7 @@ hipError_t IPCEvent::query() { return hipSuccess; } +// ================================================================================================ hipError_t IPCEvent::synchronize() { if (ipc_evt_.ipc_shmem_) { int prev_read_idx = ipc_evt_.ipc_shmem_->read_index; @@ -101,6 +103,7 @@ hipError_t IPCEvent::synchronize() { return hipSuccess; } +// ================================================================================================ hipError_t IPCEvent::streamWait(hipStream_t stream, uint flags) { int offset = ipc_evt_.ipc_shmem_->read_index; @@ -152,6 +155,7 @@ hipError_t IPCEvent::enqueueRecordCommand(hipStream_t stream, amd::Command* comm return hipSuccess; } +// ================================================================================================ hipError_t IPCEvent::GetHandle(ihipIpcEventHandle_t* handle) { if (!createIpcEventShmemIfNeeded()) { return hipErrorInvalidValue; @@ -163,6 +167,7 @@ hipError_t IPCEvent::GetHandle(ihipIpcEventHandle_t* handle) { return hipSuccess; } +// ================================================================================================ hipError_t IPCEvent::OpenHandle(ihipIpcEventHandle_t* handle) { ipc_evt_.ipc_name_ = handle->shmem_name; if (!amd::Os::MemoryMapFileTruncated(ipc_evt_.ipc_name_.c_str(), @@ -186,7 +191,6 @@ hipError_t IPCEvent::OpenHandle(ihipIpcEventHandle_t* handle) { } // ================================================================================================ - hipError_t hipIpcGetEventHandle(hipIpcEventHandle_t* handle, hipEvent_t event) { HIP_INIT_API(hipIpcGetEventHandle, handle, event); diff --git a/projects/clr/hipamd/src/hip_graph_internal.hpp b/projects/clr/hipamd/src/hip_graph_internal.hpp index 2debc3bc55..5bbbd521b8 100644 --- a/projects/clr/hipamd/src/hip_graph_internal.hpp +++ b/projects/clr/hipamd/src/hip_graph_internal.hpp @@ -2180,13 +2180,7 @@ class GraphEventWaitNode : public GraphNode { void EnqueueCommands(hip::Stream* stream) override { if (!commands_.empty()) { hip::Event* e = reinterpret_cast(event_); - hipError_t status = - e->enqueueStreamWaitCommand(reinterpret_cast(stream), commands_[0]); - if (status != hipSuccess) { - ClPrint(amd::LOG_ERROR, amd::LOG_CODE, - "[hipGraph] Enqueue stream wait command failed for node %p - status %d", this, - status); - } + commands_[0]->enqueue(); commands_[0]->release(); } }