SWDEV-480209 - Handle GraphExec object release

=> GraphExec instance is destroyed before async launch completes,
destroy after all pending graph launches
=> Remove GraphExec destroy during next sync point(hipStreamSync,
hipDeviceSync etc..)

Change-Id: I4df682aae5787fd6e5240a7be936ce50361345d0


[ROCm/clr commit: f9f995c6d0]
This commit is contained in:
Anusha GodavarthySurya
2024-10-01 12:00:46 +00:00
committed by Anusha Godavarthy Surya
parent c4afce2abc
commit 1a472b9703
7 changed files with 46 additions and 74 deletions
+1 -11
View File
@@ -27,8 +27,6 @@
#include "hip_mempool_impl.hpp"
namespace hip {
extern std::unordered_map<GraphExec*, std::pair<hip::Stream*, bool>> GraphExecStatus_;
extern amd::Monitor GraphExecStatusLock_;
std::vector<hip::Stream*> g_captureStreams;
// StreamCaptureGlobalList lock
@@ -1422,16 +1420,8 @@ hipError_t hipGraphExecDestroy(hipGraphExec_t pGraphExec) {
if (pGraphExec == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
amd::ScopedLock lock(GraphExecStatusLock_);
hip::GraphExec* ge = reinterpret_cast<hip::GraphExec*>(pGraphExec);
// bool found = false;
if (GraphExecStatus_.find(ge) == GraphExecStatus_.end()) {
ge->release();
} else {
// graph execution is under progress. destroy graphExec during next sync point
auto pair = GraphExecStatus_[ge];
GraphExecStatus_[ge] = std::make_pair(pair.first, true);
}
ge->release();
HIP_RETURN(hipSuccess);
}