From cf01ea2dae8936627f3bfbdf3b2b369e52dcfdeb Mon Sep 17 00:00:00 2001 From: Sarbojit Sarkar Date: Wed, 1 Dec 2021 15:20:12 +0000 Subject: [PATCH] SWDEV-313722 - Fix for segfault while using rocprof Change-Id: Ia00868e058069ee73ce4a852ab2529d8f785a4b7 [ROCm/clr commit: 9a3cb1608b6ca385cae78f35f7e865d2918c417e] --- projects/clr/hipamd/src/hip_intercept.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/clr/hipamd/src/hip_intercept.cpp b/projects/clr/hipamd/src/hip_intercept.cpp index d2d72d5187..162b32714f 100644 --- a/projects/clr/hipamd/src/hip_intercept.cpp +++ b/projects/clr/hipamd/src/hip_intercept.cpp @@ -32,6 +32,9 @@ extern const std::string& FunctionName(const hipFunction_t f); const char* hipKernelNameRef(const hipFunction_t f) { return FunctionName(f).c_str(); } int hipGetStreamDeviceId(hipStream_t stream) { + if (!hip::isValid(stream)) { + return -1; + } hip::Stream* s = reinterpret_cast(stream); return (s != nullptr)? s->DeviceId() : ihipGetDevice(); }