SWDEV-423317 - Enable GPU wait for hip sync calls

hipStreamSynchronize and hipDeviceSynchronize won't longer wait
for CPU commands in DD mode

Change-Id: I079c8bbfc34ddc6d3e2d74c92a34665877e512a5


[ROCm/clr commit: fbea58ba11]
This commit is contained in:
German Andryeyev
2023-09-21 15:47:56 -04:00
parent f62807d411
commit 2d492a201b
5 changed files with 13 additions and 10 deletions
+4 -3
View File
@@ -122,7 +122,7 @@ int Stream::DeviceId(const hipStream_t hStream) {
}
// ================================================================================================
void Stream::SyncAllStreams(int deviceId) {
void Stream::SyncAllStreams(int deviceId, bool cpu_wait) {
// Make a local copy to avoid stalls for GPU finish with multiple threads
std::vector<hip::Stream*> streams;
streams.reserve(streamSet.size());
@@ -136,7 +136,7 @@ void Stream::SyncAllStreams(int deviceId) {
}
}
for (auto it : streams) {
it->finish();
it->finish(cpu_wait);
it->release();
}
}
@@ -442,8 +442,9 @@ hipError_t hipStreamSynchronize_common(hipStream_t stream) {
}
}
bool wait = (stream == nullptr) ? true : false;
constexpr bool kDontWaitForCpu = false;
// Wait for the current host queue
hip::getStream(stream, wait)->finish();
hip::getStream(stream, wait)->finish(kDontWaitForCpu);
return hipSuccess;
}