cudaExternalMemoryGetMappedBuffer result question


Since a call to cudaExternalMemoryGetMappedBuffer results in a void* pointer… can this be cast to CUdeviceptr required by cuMemcpyDtoD?

I’m trying to update DirectX12 texture (a 2D shader resource texture) from CUDA. My kernel fills an array in GPU memory and I’d like to copy it to DX12 texture, which is mapped using cudaImportExternalMemory.

The result I’m getting is wrong, but not completely - resulting texture is “mangled”, but I can recognize parts of the desired image. Maybe I’m just missing to do some synchronization calls?

Any advice is appreciated, thanks.