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(); }