NVIDIAGameWorks/Falcor

Does Falcor support create a new Vulkan <-> CUDA shared buffer?

GensokyoLover opened this issue · 5 comments

I have a training task running on linux,and need to get buffers from falcor. but when i tried to run the InteropBuffer::createInteropBuffer, it fails and i wonder if it only supports DX->CUDA?

Yes, InteropBuffer is DX only as specified in the comment. It's also mostly just a deprecated/legacy class.

The better way is to use ExternalMemory defined in CudaUtils.h, or just use the new convenience API Buffer::getCudaMemory() directly. At least if you are working in C++. In Python code, you can access buffers as CUDA/pytorch tensors directly.

We don't have many Linux users yet, but I think we do run a few tests with shared buffers on internal Linux CI, so this should work.

Yes, InteropBuffer is DX only as specified in the comment. It's also mostly just a deprecated/legacy class.

The better way is to use ExternalMemory defined in CudaUtils.h, or just use the new convenience API Buffer::getCudaMemory() directly. At least if you are working in C++. In Python code, you can access buffers as CUDA/pytorch tensors directly.

We don't have many Linux users yet, but I think we do run a few tests with shared buffers on internal Linux CI, so this should work.
really thanks for your reply,but i found codes below. maybe it can only run on windows&vulkan
image

true, that is windows only it seems

can you try just adding this?

#if FALCOR_WINDOWS
    case Device::Type::Vulkan:
        desc.type = cudaExternalMemoryHandleTypeOpaqueWin32;
        break;
#elif FALCOR_LINUX
    case Device::Type::Vulkan:
        desc.type = cudaExternalMemoryHandleTypeOpaqueFd;
        break;
#endif

Edit: nope sorry, that won't work, you'd also need to set the handle on the correct field

can you try just adding this?

#if FALCOR_WINDOWS
    case Device::Type::Vulkan:
        desc.type = cudaExternalMemoryHandleTypeOpaqueWin32;
        break;
#elif FALCOR_LINUX
    case Device::Type::Vulkan:
        desc.type = cudaExternalMemoryHandleTypeOpaqueFd;
        break;
#endif

Edit: nope sorry, that won't work, you'd also need to set the handle on the correct field
fine,i tried to use buffertonumpy and succeeded,cpu also meet my needs,thanks for your reply and advice