Update NanoVDB for single-space GridHandle and widen Torch-pool coverage - #752
Open
swahtz wants to merge 1 commit into
Open
Update NanoVDB for single-space GridHandle and widen Torch-pool coverage#752swahtz wants to merge 1 commit into
swahtz wants to merge 1 commit into
Conversation
… coverage Bump the NanoVDB pin from 7946f17e to e679862f, the merge commit of openvdb #2288 (single-space device GridHandle<cuda::Buffer<T,R>>). The new hasDeviceSingle/hasHostSingle buffer traits are detected with false defaults, so TorchDeviceBuffer's dual-trait specialization is unaffected. On top of the bump, three allocator-coverage improvements: - ReinitializeSdf: the VoxelBlockManager's firstLeafID/jumpMap buffers now allocate through BuilderResource (torch's active CUDA allocator) via a local TorchVbmBuffer adapter, instead of DeviceBuffer's separate pool. The upstream VBM handle still requires the legacy dual-buffer static interface (hasDeviceDual gates + BufferT::create + a void*-returning deviceData()), so the single-space cuda::Buffer is wrapped rather than used directly; the adapter documents the upstream follow-up (openvdb #2232). - SaveNanoVDB: the device staging buffers (the defensive host-grid upload and the per-batch (N+1)-element value buffer) become nanovdb::cuda::Buffer over BuilderResource, stream-ordered on the save stream. The indexToGrid output handle stays TorchDeviceBuffer: the builder's output path still requires a dual-trait buffer upstream. - TorchDeviceBuffer: CUDA allocations can now be associated with an explicit stream (raw_alloc_with_stream), and create() forwards the stream nanovdb builders pass instead of discarding it. Previously the allocation was silently associated with the device's current torch stream, which is only correct when that coincides with the builder's stream. Verified: full rebuild (112 targets, sm_120, -Werror=all-warnings clean); tests/unit/test_sdf.py 10/10, test_io.py 622/622, test_basic_ops.py 276/276 (+1 skip) on an RTX PRO 6000 Blackwell. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
swahtz
force-pushed
the
feat/nanovdb-single-space-adoption
branch
from
August 23, 2026 23:23
268ea68 to
2d0eb61
Compare
Contributor
|
Can this be updated based on the recently merged step 3 PRs (2292, 2293), and the now open 3-3 #2301? |
Contributor
Author
Indeed. I was putting this together from the last tranche of PRs but then saw the other ones were moving quickly so thought I'd hold off for the opportunity to cover those other ones. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Follow-up to #732. Upstream has since merged openvdb #2286 (small-builder
ResourceTseams — already in our previous pin, and our only relevant call site,indexToGridinSaveNanoVDB.cu, was already routed) and #2288 (single-space device-onlyGridHandle<cuda::Buffer<T,R>>, step 3 part 1 of openvdb #2232). This PR advances the pin past #2288 and widens Torch-allocator coverage where it is reachable today.1. Pin bump:
7946f17e→e679862fThe merge commit of upstream #2288. The new
hasDeviceSingle/hasHostSingletraits are detected, defaulting to false, soTorchDeviceBuffer's dual-trait specialization compiles and behaves unchanged.2. ReinitializeSdf: VBM metadata buffers through the Torch pool
The VoxelBlockManager's
firstLeafID/jumpMapbuffers were allocated withnanovdb::cuda::DeviceBuffer— outside torch's pool (and, withNANOVDB_USE_SYNC_CUDA_MALLOCbuilds, via synchronouscudaMalloc). They now allocate throughBuilderResourcevia a localTorchVbmBufferadapter over the single-spacenanovdb::cuda::Buffer, stream-ordered on the reinit stream.Why an adapter and not
cuda::Bufferdirectly:VoxelBlockManagerHandle's device accessors are gated onBufferTraits<BufferT>::hasDeviceDualandstatic_casttheir pointers from avoid*-returningdeviceData(), andbuildVoxelBlockManagerallocates through the legacyBufferT::create(bytes, guide, device, stream)static interface. Bringing the VBM handle into the single-space world is an upstream follow-up on the #2232 roadmap (noted in the adapter's doc comment).3. SaveNanoVDB: device staging onto
cuda::Buffer<…, BuilderResource>The defensive host-grid upload buffer and the per-batch
(N+1)-element value staging buffer becomenanovdb::cuda::BufferoverBuilderResource, stream-ordered on the save stream (previouslyTorchDeviceBuffervia stream-lessraw_alloc). TheindexToGridoutput handle staysTorchDeviceBuffer: upstream's builder output path (getBuffer→BufferT::create→deviceData()) still requires a dual-trait buffer; #2288's edits toIndexToGrid.cuh/AddBlindData.cuhwere grid-index hardening, not single-space output support.4. TorchDeviceBuffer: stream-correct allocation
The constructor gains an optional stream and uses
raw_alloc_with_stream;create()forwards the stream nanovdb builders pass instead of discarding it (the same fix review flagged on the old #655 fork). Previously the allocation was silently associated with the device's current torch stream, which is only correct when that coincides with the builder's stream. Null stream keeps the previous behavior, so all existing two-argument constructor call sites are unchanged.What is deliberately NOT here
Replacing
TorchDeviceBufferwithGridHandle<cuda::Buffer<uint8_t, TorchResource>>for grid storage stays blocked on upstream step-3 parts 2–3: cross-space transfers are a named compile error until part 2, and the pinned-hostcreatemapping lands in part 3 — both required forGridBatch's CPU grids and.to(device).Testing
_fvdb_cpp(112 targets, sm_120) with zero warnings under-Werror=all-warnings/-Wall -Werror.tests/unit/test_sdf.py10/10 (exercises the VBM adapter),tests/unit/test_io.py622/622 (exercises the SaveNanoVDB staging path),tests/unit/test_basic_ops.py276 passed / 1 skipped (carries the torch peak-memory bounds sensitive to allocator routing) — on an RTX PRO 6000 Blackwell, PyTorch 2.13.🤖 Generated with Claude Code