SWDEV-482086 - Fix hipGraphInstantiate leak

* In a scenario where kernel is launched with hipExtLaunchKernelGGL and stop event is used, hipGraphInstantiate leaks. Since stop event is used, profiling is enabled and Timestamp (ReferencedCountedObject) is created, but it doesn't get released.
* The idea behind this solution is that profiling should be disabled when command is captured, hence the timestamp should not be created. Because information about capturing isn't available when kernel command is created, packet capturing state is used to determine whether to create a timestamp or not.

Change-Id: Ia23adac4592ded4fb5e236acf99e12e729f63692
This commit is contained in:
Vladana Stojiljkovic
2024-09-09 15:52:15 +02:00
parent d6193a2f23
commit da5f1a6146
3 changed files with 15 additions and 13 deletions
+4 -4
View File
@@ -268,7 +268,7 @@ class Command : public Event {
std::vector<void*> data_;
const Event* waitingEvent_; //!< Waiting event associated with the marker
bool capturing_ = false; //!< Flag to enable/disable graph gpu packet capture
bool packetCapturing_ = false; //!< Flag to enable/disable graph gpu packet capture
std::vector<uint8_t*>* gpuPackets_; //!< GPU packets captured when graph capturing is enabled
GraphKernelArgManager* graphKernArgMgr_ = nullptr; //!< KernelMgr for graph
address kernArgOffset_ = nullptr; //!< KernelArg buffer to used when graph capturing is enabled
@@ -316,13 +316,13 @@ class Command : public Event {
command_pool_ = nullptr;
}
}
bool getCapturingState() const { return capturing_; }
bool getPktCapturingState() const { return packetCapturing_; }
//! Sets AQL capture state, aql packet to capture and where to copy kernArgs
void setCapturingState(bool state, std::vector<uint8_t*>* packet,
void setPktCapturingState(bool state, std::vector<uint8_t*>* packet,
amd::GraphKernelArgManager* graphKernArgMgr,
std::string* capturedKernelName) {
capturing_ = state;
packetCapturing_ = state;
gpuPackets_ = packet;
graphKernArgMgr_ = graphKernArgMgr;
capturedKernelName_ = capturedKernelName;