From aa6d07518fdb211c49fd617ee9f69408f1acddfd Mon Sep 17 00:00:00 2001 From: Satyanvesh Dittakavi Date: Wed, 24 Jul 2024 14:47:32 +0000 Subject: [PATCH] SWDEV-475185 - Handle device id for hipStreamLegacy Change-Id: Ib56e6edb77a923f3f9738df64cb9d9ef0b4ba564 --- hipamd/src/hip_stream.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hipamd/src/hip_stream.cpp b/hipamd/src/hip_stream.cpp index 58bcdf68e2..9ea50d4023 100644 --- a/hipamd/src/hip_stream.cpp +++ b/hipamd/src/hip_stream.cpp @@ -116,8 +116,9 @@ int Stream::DeviceId(const hipStream_t hStream) { //return invalid device id return -1; } + bool isNullOrLegacyStream = (hStream == nullptr || hStream == hipStreamLegacy); hip::Stream* s = reinterpret_cast(inputStream); - int deviceId = (s != nullptr)? s->DeviceId() : ihipGetDevice(); + int deviceId = isNullOrLegacyStream ? ihipGetDevice() : s->DeviceId(); assert(deviceId >= 0 && deviceId < static_cast(g_devices.size())); return deviceId; }