Accessing large amounts of memory from compute shader?

Viewed 27

I need to access large amounts of data from a GLSL compute shader (read and write).

For reference, I work with an nvidia A6000 gpu with 50GB of memory, the driver is up to date.

Here is what I've tried so far:

  1. Using a SSBO: glBufferData() can allocate arbitrarily large buffers but the shader will only be able to access 2GB of memory (according to my tests).
  2. Using a texture: glTextureStorage3D() can allocate very large textures but the shader will only be able to access 4GB of memory (according to my tests).
  3. Using multiple textures: I break the data in multiple bindless 3D textures (GL_ARB_bindless_texture extension) that work like pages of memory. I store the texture handles in a UBO. It effectively does what I want but there are several downsides:
    • The texture/image handle pairs take space in the UBO, which could be needed by something else.
    • The textures are not accessed in a uniform control flow: two invocations of the same subgroup can fetch data in different pages. This is allowed on Nvidia gpus with the GL_NV_gpu_shader5 extension, but I could not find a similar extension on AMD.
  4. Using NV_shader_buffer_load and NV_shader_buffer_store to get a pointer to gpu memory. I haven't tested this method yet, but I suspect it could be more efficient than solution 3 since there is no need to dereference the texture/image handles which introduce an indirection.

Thus, I would like to know: Would solution 4 work for my use case? Is there a better/faster way? Is there a cross-platform way?

0 Answers
Related