I’m having some problems importing memory from DX12.
The memory is created with CreateCommittedResource, exported via CreateSharedHandle, and imported via cuMemImportFromShareableHandle. This all works.
When calling cuMemMap however I get an CUDA_ERROR_NOT_SUPPORTED.
The problem is that the DX12 memory is smaller than a page (64kB). Therefor it’s probably also not aligned to a page boundary.
I can however import the memory with cudaImportExternalMemory + cudaExternalMemoryGetMappedBuffer.
This is not ideal as it needs to be freed using cudaFree, which leads to a device synchronization. I want to avoid this if possible.
Is there any way to emulate what cudaExternalMemoryGetMappedBuffer does with the virtual memory management functions?
I assume it maps the whole page, and returns a pointer to where the buffer starts within the page, but I see no obvious way to do this manually.