Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GensokyoLover opened this issue Nov 14, 2023 · 5 comments
Open

Comments

@GensokyoLover
Copy link

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?

@skallweitNV
Copy link
Collaborator

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.

@GensokyoLover
Copy link
Author

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

@skallweitNV
Copy link
Collaborator

true, that is windows only it seems

@skallweitNV
Copy link
Collaborator

skallweitNV commented Nov 14, 2023

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

@GensokyoLover
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants