From 1ee794c7f3b3ee1cdf162fac2f91a1a617757021 Mon Sep 17 00:00:00 2001
From: foreman
Date: Sat, 16 Nov 2019 17:25:59 -0500
Subject: [PATCH] P4 to Git Change 2031768 by cpaquot@cpaquot-ocl-lc-lnx on
2019/11/16 17:21:58
SWDEV-212440 - [HIP] Memory access fault observed on Pytorch while running performance tests with Microbenchmarking script
We need to loop through all the default stream to sync them in case
the app call hipFree on a different current stream and another current stream
is using the memory.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#85 edit
---
hipamd/api/hip/hip_memory.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hipamd/api/hip/hip_memory.cpp b/hipamd/api/hip/hip_memory.cpp
index a9dcd5b55c..a249397605 100644
--- a/hipamd/api/hip/hip_memory.cpp
+++ b/hipamd/api/hip/hip_memory.cpp
@@ -209,7 +209,9 @@ hipError_t hipFree(void* ptr) {
}
if (amd::SvmBuffer::malloced(ptr)) {
hip::syncStreams();
- hip::getNullStream()->finish();
+ for (size_t i=0; ifinish();
+ }
amd::SvmBuffer::free(*hip::getCurrentContext(), ptr);
HIP_RETURN(hipSuccess);
}