SWDEV-460925 - Do awaitCompletion before releasing the lastEnqueueCommand

Change-Id: I210399dd1bced13c0923fdb1c215e044920c5a4b


[ROCm/clr commit: d6eaf49033]
This commit is contained in:
Ioannis Assiouras authored and Maneesh Gupta committed 2024-05-28 06:31:10 +00:00
1 parent cb67c6d949
commit 60ba0874fa
1 file changed
+11 -8
+11 -8
View File
@@ -146,16 +146,19 @@ void HostQueue::finish(bool cpu_wait) {
if (cpu_wait || !device().IsHwEventReady(command->event(), kWaitCompletion)) {
ClPrint(LOG_DEBUG, LOG_CMD, "HW Event not ready, awaiting completion instead");
command->awaitCompletion();
}
if (IS_HIP) {
ScopedLock sl(vdev()->execution());
ScopedLock l(lastCmdLock_);
// Runtime can clear the last command only if no other submissions occured during finish()
if (command == lastEnqueueCommand_) {
lastEnqueueCommand_->release();
lastEnqueueCommand_ = nullptr;
if (IS_HIP) {
ScopedLock sl(vdev()->execution());
ScopedLock l(lastCmdLock_);
// Runtime can clear the last command only if no other submissions occured
// during finish()
if (command == lastEnqueueCommand_) {
lastEnqueueCommand_->release();
lastEnqueueCommand_ = nullptr;
}
}
}
command->release();
ClPrint(LOG_DEBUG, LOG_CMD, "All commands finished");
}