-
Notifications
You must be signed in to change notification settings - Fork 437
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
Allow external memory support with DeviceLocalBuffers #1506
Conversation
Yeah, I think we need to eventually untie memory allocation, memory mapping and buffer creation in Vulkano, to give developers a lower level of control. In particular, we should not be doing separate operations "alloc_and_map". Ideally, the developer can use a builder to create a Vulkan object (memory and buffers are separate objects), and internal Vulkano state tracking would ensure safety or panic!() on a violation. In your particular case, we would need a "Buffer" class and a "DeviceMemory" class that can be bound separately rather than a "DeviceLocalBuffer". We would also need a "DeviceMemoryMapping" to wrap the raw ptr. This is a pre-existing problem and should not hold up your MR, but something to think about for Vulkano developers long term. |
I definitely think this is a good idea! |
Yes this would be great! So what to do with this PR meanwhile? |
@hakolao Pull Request reviewed and merged. Thank you very much for your contribution! 👍 |
P.S: by popular demand, I added "DeviceMemoryMapping" I'll leave the Buffer and Image work to someone else though :-) |
Motivation:
DeviceLocalBuffer
wraps a lot of functionality inside that would be convenient if it could be used with exportedDeviceMemory
. External memory support was added in #1467, but it didn't really expose easy ways to use this with existing buffer functionality (or at least did not document how). This PR binds this external memory support toDeviceLocalBuffer
which is useful e.g. if one wants to fill / modify / compute with CUDA, but render with Vulkano. Currently though only on Linux.We use this for a CUDA-Vulkan interoperable buffer in the following manner:
I'm still a Vulkano beginner and don't know if there's a better way to do this, but for our use case this would be nice. This PR is an attempt to achieve this without any breaking changes and changes should only apply on Linux. I considered other ways, such as conditional inputs or an additional field to
MemoryRequirements
but neither of those seemed to cut it.Let me know what would be the right way to do this, if this isn't such. Feel free to modify this PR directly.