warp icon indicating copy to clipboard operation
warp copied to clipboard

Add external resource interoperability

Open ramenguy99 opened this issue 9 months ago • 4 comments

Category

  • [x] New feature
  • [ ] Bugfix
  • [ ] Breaking change
  • [ ] Refactoring
  • [ ] Documentation
  • [ ] Other (please explain)

Description

Hi, this PR adds support for the External Resource Interoperability API for interoperability between Cuda and other graphics APIs such as Vulkan, D3D12 and D3D11.

PR is functional and tested on windows with Vulkan, some docs are missing and some cleanup might be needed. If there is interest in merging something like this I am more than happy to complete this.

~ Dario

Changelog

  • Expose External Resource Interoperability API through ExternalSemaphore and ExternalMemoryBuffer

Before your PR is "Ready for review"

  • [x] All commits are signed-off to indicate that your contribution adheres to the Developer Certificate of Origin requirements
  • [ ] Necessary tests have been added
  • [ ] Documentation is up-to-date
  • [ ] Auto-generated files modified by compiling Warp and building the documentation have been updated (e.g. stubs.py, functions.rst)
  • [ ] Code passes formatting and linting checks with pre-commit run -a

ramenguy99 avatar Mar 23 '25 21:03 ramenguy99

I think @nvlukasz will be back next week. Will remind him to take a look.

shi-eric avatar Mar 25 '25 19:03 shi-eric

Thanks @ramenguy99, this looks like a potentially useful contribution.

My main concern is that I'm not aware of any immediate use for it, so we don't have good test cases or usage examples.

Can you share more information about how you are using this functionality?

nvlukasz avatar Apr 02 '25 15:04 nvlukasz

Hi, I'm currently using this with a Vulkan rendering library that has python bindings and can expose buffers / semaphores for interop with warp. This library is a personal project and is not currently open source, although I plan to release it at some point (hopefully in a few months). I also see a possibility to test this with something like slangpy in the future. But I don't think interop is exposed at the moment, especially due to the added complexity of being built on top of an RHI.

I agree that it does not make a lot of sense to merge this without immediate users, tests or examples. I can reopen this in the future once there is an easy way to integrate it.

ramenguy99 avatar Apr 03 '25 16:04 ramenguy99

@nvlukasz If I may add a point to the discussion, we are also looking into integrating warp into UE5. Currently there is a lot of overhead due to costly UE5 rendering thread->UE CPU->warp python->warp CUDA->warp python->UE5 CPU->UE5 rendering thread data transfers taking place. This is due to the fact that we want to update the vertices of meshes in UE5 (which already live on the GPU) through warp and there is currently no interop between UE5's rendering thread and warp. Not sure what this PR does but the feature itself could be quite useful.

ManosAgelidis avatar Apr 24 '25 10:04 ManosAgelidis