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]
このコミットが含まれているのは:
Anusha GodavarthySurya authored and Anusha Godavarthy Surya committed 2024-11-27 10:29:15 -05:00
1 親 0cb25faf88
コミット bfc89974e0
3ファイル変更
+36 -11

検索条件に一致するファイルはありません

+16 -6
ファイルの表示
@@ -357,13 +357,23 @@ hipError_t hipStreamSynchronize_common(hipStream_t stream) {
HIP_RETURN(hipErrorStreamCaptureUnsupported);
}
}
bool wait = (stream == nullptr || stream == hipStreamLegacy) ? true : false;
auto hip_stream = hip::getStream(stream, wait);
// Wait for the current host queue
hip_stream->finish();
// Release freed memory for all memory pools on the device
hip_stream->GetDevice()->ReleaseFreedMemory();
if (stream == nullptr) {
// Do cpu wait on null stream and only on blocking streams
constexpr bool WaitblockingStreamOnly = true;
getCurrentDevice()->SyncAllStreams(true, WaitblockingStreamOnly);
// Release freed memory for all memory pools on the device
getCurrentDevice()->ReleaseFreedMemory();
} else {
constexpr bool wait = false;
auto hip_stream = hip::getStream(stream, wait);
// Wait for the current host queue
hip_stream->finish();
// Release freed memory for all memory pools on the device
hip_stream->GetDevice()->ReleaseFreedMemory();
}
return hipSuccess;
}