P4 to Git Change 1558526 by skudchad@skudchad_test2_win_opencl on 2018/05/23 13:34:33
SWDEV-145570 - [HIP] Implement hipPointerGetAttributes. ReviewBoardURL = http://ocltc.amd.com/reviews/r/14938/diff/ Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#28 edit
Этот коммит содержится в:
@@ -1180,7 +1180,32 @@ hipError_t hipHostGetDevicePointer(void** devicePointer, void* hostPointer, unsi
|
||||
hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void* ptr) {
|
||||
HIP_INIT_API(attributes, ptr);
|
||||
|
||||
assert(0 && "Unimplemented");
|
||||
size_t offset = 0;
|
||||
amd::Memory* memObj = getMemoryObject(ptr, offset);
|
||||
amd::Context &memObjCtx = memObj->getContext();
|
||||
int device = 0;
|
||||
|
||||
return hipErrorUnknown;
|
||||
if (memObj != nullptr) {
|
||||
attributes->memoryType = hipMemoryTypeDevice;
|
||||
attributes->hostPointer = memObj->getSvmPtr();
|
||||
attributes->devicePointer = memObj->getSvmPtr();
|
||||
attributes->isManaged = 0;
|
||||
attributes->allocationFlags = memObj->getMemFlags();
|
||||
for (auto& ctx : g_devices) {
|
||||
++device;
|
||||
if (*ctx == memObjCtx) {
|
||||
attributes->device = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
attributes->memoryType = hipMemoryTypeHost;
|
||||
attributes->hostPointer = (void*)ptr;
|
||||
attributes->devicePointer = 0;
|
||||
attributes->device = -1;
|
||||
attributes->isManaged = 0;
|
||||
attributes->allocationFlags = 0;
|
||||
}
|
||||
|
||||
return hipSuccess;
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user