From e7931a86495b7031d4229871ad44682098c19e3a 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
[ROCm/hip commit: 9529795fab8778b8e9bfbbe8704a991dea039c44]
---
projects/hip/api/hip/hip_memory.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/projects/hip/api/hip/hip_memory.cpp b/projects/hip/api/hip/hip_memory.cpp
index a9dcd5b55c..a249397605 100644
--- a/projects/hip/api/hip/hip_memory.cpp
+++ b/projects/hip/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);
}