optixDenoiserInvoke without cudaDeviceSynchronize

Hey,

I have a Vulkan project where I share a Vulkan Offscreen buffer with the optix denoiser. The VkBuffer contains my scene image data.
The input and output layers for optixDenoiserInvoke are handles to one VkBuffer (I use the same buffer for input and output).

When I call optixDenoiserInvoke, nothing happens, my buffer doesnt seem to get denoised. But when I make a call to cudaDeviceSynchronize right after optixDenoiserInvoke, everything works. I don’t understand why, because my buffer is device local.

I use the code of simpleVulkan example as reference.

The denoser is running in an asynchronous manner like all OptiX 7 API functions with a CUDA stream argument.
You’re using two different APIs which always requires the proper synchronization between them before accessing shared resources.

If you’re reading the denoised image in Vulkan while the asynchronous denoiser operations have not finished, the result is undefined.
If adding the cudaDeviceSynchronize to wait for the denoiser to finish its operations solves your issue, than that is simply required.
This is not different than when syncing other APIs against each other, like GDI, OpenGL, DX, Vulkan, and CUDA.

Ok that makes sense,
I left the synchronization part yet, because I thought it would work out-of-the-box and I’d only get flickering issues for example.

Thanks a lot!