SWDEV-489823 - Fix hipStreamEndCapture leak when capture is invalidated
Change-Id: If8f5163d70e04d34a75fd0a7ba6c0a15ea59bb8b
This commit is contained in:
@@ -1016,6 +1016,11 @@ hipError_t hipStreamEndCapture_common(hipStream_t stream, hip::Graph** pGraph) {
|
||||
// If capture was invalidated, due to a violation of the rules of stream capture
|
||||
if (s->GetCaptureStatus() == hipStreamCaptureStatusInvalidated) {
|
||||
*pGraph = nullptr;
|
||||
// When capture is invalidated, graph should be deleted, otherwise it leaks
|
||||
hip::Graph* graph = s->GetCaptureGraph();
|
||||
delete graph;
|
||||
s->ResetCaptureGraph();
|
||||
|
||||
return hipErrorStreamCaptureInvalidated;
|
||||
}
|
||||
|
||||
|
||||
@@ -405,6 +405,8 @@ public:
|
||||
pCaptureGraph_ = pGraph;
|
||||
captureStatus_ = hipStreamCaptureStatusActive;
|
||||
}
|
||||
/// Reset graph to nullptr when capture is invalidated, but keep the status
|
||||
void ResetCaptureGraph() { pCaptureGraph_ = nullptr; }
|
||||
void SetCaptureId() {
|
||||
// ID is generated in Begin Capture i.e.. when capture status is active
|
||||
captureID_ = GenerateCaptureID();
|
||||
|
||||
Reference in New Issue
Block a user