diff --git a/hipamd/src/hip_hmm.cpp b/hipamd/src/hip_hmm.cpp index fd18b2b6f9..bedc2f1029 100644 --- a/hipamd/src/hip_hmm.cpp +++ b/hipamd/src/hip_hmm.cpp @@ -80,6 +80,10 @@ hipError_t hipMemPrefetchAsync(const void* dev_ptr, size_t count, int device, HIP_RETURN(hipErrorInvalidValue); } + if (!hip::isValid(stream)) { + HIP_RETURN(hipErrorContextIsDestroyed); + } + size_t offset = 0; amd::Memory* memObj = getMemoryObject(dev_ptr, offset); // Return error if count passed is more than the actual size allocated