NanoVDB (https://www.aswf.io/nanovdb/) is a platform-independent sparse volume data structure that makes it possible to use OpenVDB volumes on the GPU. This patch uses it for volume rendering in Cycles, replacing the previous usage of dense 3D textures.
This is a preliminary patch and not finished yet, but is in a working state.
I tried to keep changes to a minimum for now and am therefore using NanoVDB only for data look up, as an in-place replacement for 3D textures. This is not necessarily the most optimal way to use it, since the NanoVDB API also has helpers to do traversal etc. that may benefit from node caching which this approach completly circumvents (each look up does a full traversal of the NanoVDB data structure). But it's the simplest way to get one of the biggest benefits into Cycles, which is memory savings due to the sparsity of the data.
This is also still missing some optimizations (render times are currently slightly worse compared to 3D textures) and there are open questions, e.g. with regards to how the NanoVDB library should be referenced. It is now part of official OpenVDB in a side branch, so could be added to the external OpenVDB package already built with Blender. But it may also be added separately or even taken into the source tree (extern/), since it's header-only. The current code does the second option and expects a copy of the NanoVDB code in the external libraries directory (on Windows \lib\win64_vc15\nanovdb for example). Also, this only implements nearest and linear sampling right now. Cycles technically supports cubic sampling too, but I'm not sure it's actually possible to hit that on a VDB volume (which always defaults to linear sampling from the looks of it)? So I haven't added that in this version of the patch to reduce amount of code.
To enable, set the WITH_NANOVDB CMake option and put a copy of https://github.com/AcademySoftwareFoundation/openvdb/tree/feature/nanovdb/nanovdb into a nanovdb subdirectory in your Blender libraries path. Note that that version of NanoVDB is currently missing a fix that makes SampleFromVoxels work for vector types, so you may have to comment out the code that handles IMAGE_DATA_TYPE_NANOVDB_FLOAT3 for this patch to compile, until NanoVDB is updated.
Image of the bunny sample data set rendered with NanoVDB using OptiX: