I'm currently designing a dll (and so) library, that will build offload tasks to CUDA, SYCL, OpenCL or Vulkan (not yet decided). As it is unknown what the application will do (might also use the same APIs), my question is, whether there might arise runtime issues for one of the APIs, when using it it in the DLL and in the application.
I'd guess that, creating two contexts in SYCL/OpenCL/Vulkan wouldn't hurt and should separate the API calls accordingly. Is that right and is it sufficient to just explicitly create a context / stream (in CUDA) in the DLL?
Would it additionally be possible to hand a buffer object from the DLL to the application, so that the calling application could directly use the same buffer on their context or is it required to copy to the host first?