MCPcopy Create free account
hub / github.com/RenderKit/oidn / cudaPointerGetAttributes

Function cudaPointerGetAttributes

devices/cuda/curtn.cpp:1010–1052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1008 }
1009
1010 cudaError_t CUDARTAPI cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr)
1011 {
1012 CUmemorytype type;
1013 unsigned int isManaged;
1014
1015 CUpointer_attribute cuAttributes[] = {CU_POINTER_ATTRIBUTE_MEMORY_TYPE,
1016 CU_POINTER_ATTRIBUTE_IS_MANAGED,
1017 CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL,
1018 CU_POINTER_ATTRIBUTE_DEVICE_POINTER,
1019 CU_POINTER_ATTRIBUTE_HOST_POINTER};
1020
1021 void* cuAttributeValues[] = {&type,
1022 &isManaged,
1023 &attributes->device,
1024 &attributes->devicePointer,
1025 &attributes->hostPointer};
1026
1027 CUresult result = cuPointerGetAttributes(5, cuAttributes, cuAttributeValues, (CUdeviceptr)ptr);
1028 if (result != CUDA_SUCCESS)
1029 return Runtime::setError(result);
1030
1031 if (isManaged)
1032 {
1033 attributes->type = cudaMemoryTypeManaged;
1034 }
1035 else
1036 {
1037 switch (type)
1038 {
1039 case CU_MEMORYTYPE_HOST:
1040 case CU_MEMORYTYPE_UNIFIED: // shouldn't happen, but just in case
1041 attributes->type = cudaMemoryTypeHost;
1042 break;
1043 case CU_MEMORYTYPE_DEVICE:
1044 attributes->type = cudaMemoryTypeDevice;
1045 break;
1046 default: // should be 0
1047 attributes->type = cudaMemoryTypeUnregistered;
1048 }
1049 }
1050
1051 return cudaSuccess;
1052 }
1053
1054 cudaError_t CUDARTAPI cudaImportExternalMemory(cudaExternalMemory_t* extMem_out,
1055 const cudaExternalMemoryHandleDesc* memHandleDesc)

Callers 1

getPtrStorageMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected