SWDEV-460925 - Do awaitCompletion before releasing the lastEnqueueCommand

Change-Id: I210399dd1bced13c0923fdb1c215e044920c5a4b


[ROCm/clr commit: d6eaf49033]
Этот коммит содержится в:
Ioannis Assiouras
2024-05-09 01:02:56 +01:00
коммит произвёл Maneesh Gupta
родитель cb67c6d949
Коммит 60ba0874fa
+11 -8
Просмотреть файл
@@ -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");
}