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


[ROCm/clr commit: 85c70a7495]
This commit is contained in:
German Andryeyev
2021-06-07 15:56:47 -04:00
کامیت شده توسط Maneesh Gupta
والد 8d7a745246
کامیت a9abd850ea
5فایلهای تغییر یافته به همراه41 افزوده شده و 8 حذف شده
@@ -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");
}