SWDEV-272496 - Detect callbacks and force AQL barrier

HIP tests require HIP callbacks to be processed in another thread.
This change will use a thread from HSA signal callbacks to make
sure a HIP callback was done asynchronously.
Also process the callback before changing the status of command

Change-Id: Icef85d0e0f808663882cf6881ff1be3e5eca29ac
This commit is contained in:
German Andryeyev
2021-03-03 17:28:58 -05:00
parent c13f9df42a
commit 7f32d0b425
3 changed files with 32 additions and 7 deletions
+20 -7
View File
@@ -105,13 +105,26 @@ bool Event::setStatus(int32_t status, uint64_t timeStamp) {
}
}
if (!status_.compare_exchange_strong(currentStatus, status, std::memory_order_relaxed)) {
// Somebody else beat us to it, let them deal with the release/signal.
return false;
}
if (callbacks_ != (CallBackEntry*)0) {
processCallbacks(status);
if (amd::IS_HIP) {
// HIP API doesn't have any event, associated with a callback. Hence the SW status of
// the event is irrelevant, during the actual callback. At the same time HIP API requires
// to finish the callback before HIP stream can continue. Hence runtime has to process
// the callback first and then update the status.
if (callbacks_ != (CallBackEntry*)0) {
processCallbacks(status);
}
if (!status_.compare_exchange_strong(currentStatus, status, std::memory_order_relaxed)) {
// Somebody else beat us to it, let them deal with the release/signal.
return false;
}
} else {
if (!status_.compare_exchange_strong(currentStatus, status, std::memory_order_relaxed)) {
// Somebody else beat us to it, let them deal with the release/signal.
return false;
}
if (callbacks_ != (CallBackEntry*)0) {
processCallbacks(status);
}
}
if (Agent::shouldPostEventEvents() && command().type() != 0) {