SWDEV-240806 - Release resources in Command::terminate for HIP
We do not want to release resources during setStatus in HIP because of Graphs
Change-Id: Idc7b188ab5f8be6975ea91005dd2bbf177401f8c
[ROCm/clr commit: 133287f31f]
This commit is contained in:
committed by
Maneesh Gupta
parent
863a43abfc
commit
dfbdbfecb5
@@ -145,7 +145,9 @@ bool Event::setStatus(int32_t status, uint64_t timeStamp) {
|
||||
if (status <= CL_COMPLETE) {
|
||||
// Before we notify the waiters that this event reached the CL_COMPLETE
|
||||
// status, we release all the resources associated with this instance.
|
||||
releaseResources();
|
||||
if (!IS_HIP) {
|
||||
releaseResources();
|
||||
}
|
||||
|
||||
activity_.ReportEventTimestamps(command());
|
||||
// Broadcast all the waiters.
|
||||
|
||||
@@ -262,7 +262,10 @@ class Command : public Event {
|
||||
eventWaitList_(nullWaitList),
|
||||
commandWaitBits_(0) {}
|
||||
|
||||
bool terminate() {
|
||||
virtual bool terminate() {
|
||||
if (IS_HIP) {
|
||||
releaseResources();
|
||||
}
|
||||
if (Agent::shouldPostEventEvents() && type() != 0) {
|
||||
Agent::postEventFree(as_cl(static_cast<Event*>(this)));
|
||||
}
|
||||
|
||||
@@ -123,6 +123,14 @@ void HostQueue::finish() {
|
||||
command->awaitCompletion();
|
||||
}
|
||||
command->release();
|
||||
if (IS_HIP) {
|
||||
ScopedLock sl(vdev()->execution());
|
||||
ScopedLock l(lastCmdLock_);
|
||||
if (lastEnqueueCommand_ != nullptr) {
|
||||
lastEnqueueCommand_->release();
|
||||
lastEnqueueCommand_ = nullptr;
|
||||
}
|
||||
}
|
||||
ClPrint(LOG_DEBUG, LOG_CMD, "All commands finished");
|
||||
}
|
||||
|
||||
@@ -238,7 +246,6 @@ Command* HostQueue::getLastQueuedCommand(bool retain) {
|
||||
// The batch update must be lock protected to avoid a race condition
|
||||
// when multiple threads submit/flush/update the batch at the same time
|
||||
ScopedLock sl(vdev()->execution());
|
||||
|
||||
// Since the lastCmdLock_ is acquired, it is safe to read and retain the lastEnqueueCommand.
|
||||
// It is guaranteed that the pointer will not change.
|
||||
if (retain && lastEnqueueCommand_ != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user