From bc89e5bc5f5741a96618d234aa12ff213da4724f Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 20 Mar 2019 18:43:07 -0400
Subject: [PATCH] P4 to Git Change 1759224 by cpaquot@cpaquot-ocl-lc-lnx on
2019/03/20 17:47:43
SWDEV-183452 - [HIP] PyTorch test_pin_memory fails
hipPointerGetAttributes should return hipMemoryTypeHost for hipHostMalloc memories.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#46 edit
[ROCm/hip commit: eea83a2c5e459af76966387b902998d5063da2d1]
---
projects/hip/api/hip/hip_memory.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/projects/hip/api/hip/hip_memory.cpp b/projects/hip/api/hip/hip_memory.cpp
index f45b4944d3..ab6b788921 100644
--- a/projects/hip/api/hip/hip_memory.cpp
+++ b/projects/hip/api/hip/hip_memory.cpp
@@ -1438,11 +1438,11 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void
int device = 0;
if (memObj != nullptr) {
- attributes->memoryType = hipMemoryTypeDevice;
+ attributes->memoryType = (CL_MEM_SVM_FINE_GRAIN_BUFFER | memObj->getMemFlags())? hipMemoryTypeHost : hipMemoryTypeDevice;
attributes->hostPointer = memObj->getSvmPtr();
attributes->devicePointer = memObj->getSvmPtr();
attributes->isManaged = 0;
- attributes->allocationFlags = memObj->getMemFlags();
+ attributes->allocationFlags = memObj->getMemFlags() >> 16;
amd::Context &memObjCtx = memObj->getContext();
for (auto& ctx : g_devices) {