SWDEV-292547 - Fix for hipStreamPerThread

Change-Id: I9328c7ec92d954433f8e69732d91e65fa6fe013a


[ROCm/clr commit: 9e4766d990]
This commit is contained in:
Sarbojit Sarkar
2021-09-21 09:25:16 +00:00
parent fa0694e90f
commit ecde1f5b96
+4 -1
View File
@@ -292,11 +292,14 @@ public:
~stream_per_thread() {
if (m_stream != nullptr && hip::isValid(m_stream)) {
delete reinterpret_cast<hip::Stream*>(m_stream);
m_stream = nullptr;
}
}
hipStream_t& get() {
if (m_stream == nullptr) {
// There is a scenario where hipResetDevice destroys stream per thread
// hence isValid check is required to make sure only valid stream is used
if (m_stream == nullptr || !hip::isValid(m_stream)) {
ihipStreamCreate(&m_stream, hipStreamDefault, hip::Stream::Priority::Normal);
}
return m_stream;