SWDEV-460770 - Handle Graph Exec release
Handle GraphExec instance is destroyed before async launch completes GraphExec instance is destroyed after async launch completes GraphExec instance is destroyed without a launch Change-Id: I45a7c82295fea916c7559bd8f796df710513aea1
This commit is contained in:
zatwierdzone przez
Maneesh Gupta
rodzic
51e4368723
commit
bf4d10ff61
@@ -27,6 +27,8 @@
|
||||
#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;
|
||||
amd::Monitor g_captureStreamsLock{"StreamCaptureGlobalList"};
|
||||
@@ -1396,8 +1398,16 @@ hipError_t hipGraphExecDestroy(hipGraphExec_t pGraphExec) {
|
||||
if (pGraphExec == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
amd::ScopedLock lock(GraphExecStatusLock_);
|
||||
hip::GraphExec* ge = reinterpret_cast<hip::GraphExec*>(pGraphExec);
|
||||
delete ge;
|
||||
// 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);
|
||||
}
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user