SWDEV-472840 SWDEV-461980 - Fix null stream sync performance
=> If null stream is not created during sync skip nullstrm creation
=> Do cpu wait on blocking & null stream if it exists
Change-Id: I90d6ced6a2dd1782ba58f3fed4e3608fc0efa55a
[ROCm/clr commit: 17e7b7c2ef]
Tá an tiomantas seo le fáil i:
tiomanta ag
Anusha Godavarthy Surya
tuismitheoir
0cb25faf88
tiomantas
bfc89974e0
@@ -257,15 +257,30 @@ void Device::destroyAllStreams() {
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
void Device::SyncAllStreams( bool cpu_wait) {
|
||||
void Device::SyncAllStreams(bool cpu_wait, bool wait_blocking_streams_only) {
|
||||
// Make a local copy to avoid stalls for GPU finish with multiple threads
|
||||
std::vector<hip::Stream*> streams;
|
||||
streams.reserve(streamSet.size());
|
||||
{
|
||||
amd::ScopedLock lock(streamSetLock);
|
||||
for (auto it : streamSet) {
|
||||
streams.push_back(it);
|
||||
it->retain();
|
||||
if (wait_blocking_streams_only) {
|
||||
auto null_stream = GetNullStream();
|
||||
for (auto it : streamSet) {
|
||||
if (it != null_stream && (it->Flags() & hipStreamNonBlocking) == 0) {
|
||||
streams.push_back(it);
|
||||
it->retain();
|
||||
}
|
||||
}
|
||||
// Add null stream to the end of the list so that wait happens after all blocking streams.
|
||||
if (null_stream != nullptr) {
|
||||
streams.push_back(null_stream);
|
||||
null_stream->retain();
|
||||
}
|
||||
} else {
|
||||
for (auto it : streamSet) {
|
||||
streams.push_back(it);
|
||||
it->retain();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto it : streams) {
|
||||
|
||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir