SWDEV-284671 - Add HW event wait to improve hipDeviceSynchronize

If AMD event contains a reference to a HW event, then runtime
could check/wait for HW event. CPU status update will occur later
after HSA signal callback, but it's not important for the result.

Change-Id: I591391a953bbdba6a25ac07e2cd98aeb17cd4596
Этот коммит содержится в:
German Andryeyev
2021-06-07 15:56:47 -04:00
коммит произвёл Maneesh Gupta
родитель 5fdf5d05df
Коммит 85c70a7495
5 изменённых файлов: 41 добавлений и 8 удалений
+6 -6
Просмотреть файл
@@ -107,10 +107,6 @@ void HostQueue::finish() {
Command* command = nullptr;
if (IS_HIP) {
command = getLastQueuedCommand(true);
if (nullptr != command) {
command->awaitCompletion();
command->release();
}
}
if (nullptr == command) {
// Send a finish to make sure we finished all commands
@@ -120,9 +116,13 @@ void HostQueue::finish() {
}
ClPrint(LOG_DEBUG, LOG_CMD, "marker is queued");
command->enqueue();
command->awaitCompletion();
command->release();
}
// Check HW status of the ROCcrl event. Note: not all ROCclr modes support HW status
static constexpr bool kWaitCompletion = true;
if (!device().IsHwEventReady(command->event(), kWaitCompletion)) {
command->awaitCompletion();
}
command->release();
ClPrint(LOG_DEBUG, LOG_CMD, "All commands finished");
}