Server uses cuda virtual memory management API (cuMemAddressReserve, cuMemCreate..) to create memory region and issues error
cuda_copy_md.c:489 UCX WARN cuPointerSetAttribute(0x7f85c0000000, SYNC_MEMOPS) error: operation not supported.
Can RNDV protocl support the memory space allocated by CUDA VMM API?
cudaError_t vmm_alloc(void **ptr, size_t size, int currentDevice, CUdeviceptr start_add) {
CUmemAllocationProp prop = {};
memset(&prop,0,sizeof(prop));
prop.type = CU_MEM_ALLOCATION_TYPE_PINNED;
prop.location.type = CU_MEM_LOCATION_TYPE_DEVICE;
prop.location.id = currentDevice;
prop.allocFlags.gpuDirectRDMACapable = 1;
size_t granularity = 0;
CUresult result;
// Calculates either the minimal or recommended granularity.
result = cuMemGetAllocationGranularity(&granularity, &prop, CU_MEM_ALLOC_GRANULARITY_MINIMUM);
if (result != CUDA_SUCCESS) {
printf("cudaErrorMemoryAllocation error %d\n",result);
return cudaErrorMemoryAllocation;
}
size = ((size - 1) / granularity + 1) * granularity;
CUdeviceptr dptr;
// Allocate an address range reservation.
result = cuMemAddressReserve(&dptr, size, 0, start_add + granularity, 0);
if (result != CUDA_SUCCESS) {
printf("cuMemAddressReserve error %d\n",result);
return cudaErrorMemoryAllocation;
}
printf("dptr = %p\n",dptr);
CUmemGenericAllocationHandle allocationHandle;
// Create a CUDA memory handle representing a memory allocation of a given size described by the given properties.
result = cuMemCreate(&allocationHandle, size, &prop, 0);
if (result != CUDA_SUCCESS) {
printf("cuMemCreate error %d\n",result);
return cudaErrorMemoryAllocation;
}
// Maps an allocation handle to a reserved virtual address range.
// cuMemMap can only create mappings on VA range reservations that are not currently mapped.
result = cuMemMap(dptr, size, 0, allocationHandle, 0);
if (result != CUDA_SUCCESS) {
printf("cuMemMap error %d\n",result);
return cudaErrorMemoryAllocation;
}
CUmemAccessDesc accessDescriptor;
accessDescriptor.location.id = prop.location.id;
accessDescriptor.location.type = prop.location.type;
accessDescriptor.flags = CU_MEM_ACCESS_FLAGS_PROT_READWRITE;
// Set the access flags for each location specified in desc for the given virtual address range.
// Any new mapping to this virtual address will need to have access granted through cuMemSetAccess, as all mappings start with no accessibility setup.
result = cuMemSetAccess(dptr, size, &accessDescriptor, 1);
if (result != CUDA_SUCCESS) {
printf("cuMemSetAccess error %d\n",result);
return cudaErrorMemoryAllocation;
}
*ptr = (void *)dptr;
return cudaSuccess;
}
Describe the bug
Server uses cuda virtual memory management API (cuMemAddressReserve, cuMemCreate..) to create memory region and issues error
cuda_copy_md.c:489 UCX WARN cuPointerSetAttribute(0x7f85c0000000, SYNC_MEMOPS) error: operation not supported
.Can RNDV protocl support the memory space allocated by CUDA VMM API?
Steps to Reproduce
Setup and versions
Additional information
VMM API to create memory region