CUDA access to Vulkan depth texture

Hello there!
I have been trying to read from a Vulkan 2D depth texture (used as DEPTH_STENCIL_ATTACHMENT) in CUDA 10.2 with no success so far (driver API used). The texture is a simple 32 bit floating point depth format with optimal tiling (and I can’t use linear tiling because it is not supported with the depth format on my GPU). Everything is fine on the vulkan side (using external memory and stuff, as demonstrated in the cuda-vulkan interop sample of the CUDA toolkit). The CUDA side is more troublesome and fails at different points, depending on the approach I try.

Here is what I tried :

  1. Map the texture’s buffer using cuExternalMemoryGetMappedBuffer and access it using the device pointer through a Pitch2D texture --> managed to access some data but I can see the optimal tiling interfering with what is assumed by CUDA to be linear access.
  2. Map the texture as a mipmapped array. Requires the texture to have at least one mipmap level, which I ensured was present (allocated in Vulkan, and reported to cuExternalMemoryGetMappedMipmappedArray(), which otherwise fails with 0 mipmap levels by the way - but 0 mipmap levels is valid, isn’t it?). cuExternalMemoryGetMappedMipmappedArray() fails when specifying CUDA_ARRAY3D_DEPTH_TEXTURE as flag, so omitted it (but tried with or without CUDA_ARRAY3D_SURFACE_LDST). Then, tried to get access through a texture via the mipmapped array : got invalid value on cuTexObjectCreate(). Did the same with cuSurfObjectCreate(), got invalid value again.
  3. Same as 2 (imported the texture as a mipmapped array) but this time, I extracted the first mipmap level as a CUarray, and used this array to create a surface through cuSurfObjectCreate(). Got an “unaligned memory access” error in a simple test kernel that reads from the texture and writes to a buffer, meaning that the CUarray handle was probably invalid.
  4. all variants you can imagine of casting CUDeviceptr to CUarray and reverse, and mixing approaches 2 and 3.

So, my question is the following : how are you supposed to access an optimal tiling, non-mipmapped Vulkan texture on CUDA? And especially a depth texture?

Regards, FMdC.