Fix hipPointerGetAttributes

Modified hipPointerGetAttributes to support hipHostRegister ptrs and mapped device ptrs from hipHostRegister
Change-Id: I2f4cf12e09578768308f644123d6d4bdccbd77a8


[ROCm/hip commit: a7b5347c90]
이 커밋은 다음에 포함됨:
Satyanvesh Dittakavi가 2020-12-15 01:40:24 -05:00를 커밋했습니다
1 부모 07aa78a19b
커밋 390615cc60
2 파일이 변경됨
+346 -2

검색과 일치하는 파일 없음

+7 -2
파일 보기
@@ -2083,9 +2083,14 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void
attributes->memoryType = ((CL_MEM_SVM_FINE_GRAIN_BUFFER | CL_MEM_USE_HOST_PTR) &
memObj->getMemFlags())? hipMemoryTypeHost : hipMemoryTypeDevice;
if (attributes->memoryType == hipMemoryTypeHost) {
attributes->hostPointer = static_cast<char*>(memObj->getSvmPtr()) + offset;
if (memObj->getHostMem() != nullptr) {
attributes->hostPointer = static_cast<char*>(memObj->getHostMem()) + offset;
}
else {
attributes->hostPointer = static_cast<char*>(memObj->getSvmPtr()) + offset;
}
}
attributes->devicePointer = static_cast<char*>(memObj->getSvmPtr()) + offset;
attributes->devicePointer = reinterpret_cast<char*>(memObj->getDeviceMemory(*hip::getCurrentDevice()->devices()[0])->virtualAddress() + offset);
constexpr uint32_t kManagedAlloc = (CL_MEM_SVM_FINE_GRAIN_BUFFER | CL_MEM_ALLOC_HOST_PTR);
attributes->isManaged =
((memObj->getMemFlags() & kManagedAlloc) == kManagedAlloc) ? true : false;