SWDEV-489823 - Fix hipStreamEndCapture leak when capture is invalidated

Change-Id: If8f5163d70e04d34a75fd0a7ba6c0a15ea59bb8b
This commit is contained in:
Vladana Stojiljkovic
2024-10-07 17:22:15 +02:00
rodzic 5ccc140e1b
commit 6f2bad3998
2 zmienionych plików z 7 dodań i 0 usunięć
+5
Wyświetl plik
@@ -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;
}
+2
Wyświetl plik
@@ -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();