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
Tento commit je obsažen v:
Anusha GodavarthySurya
2024-10-01 12:00:46 +00:00
odevzdal Anusha Godavarthy Surya
rodič 05d6f75830
revize f9f995c6d0
7 změnil soubory, kde provedl 46 přidání a 74 odebrání
+1 -11
Zobrazit soubor
@@ -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);
}