NanoVDB: encode points for any resource in PointsToGrid (CUDA)#2244
Open
harrism wants to merge 1 commit into
Open
NanoVDB: encode points for any resource in PointsToGrid (CUDA)#2244harrism wants to merge 1 commit into
harrism wants to merge 1 commit into
Conversation
The point-encode step in tools::cuda::PointsToGrid was only reachable for the default DeviceResource, because it lived in the BuildT=Point full specialization of processPoints (i.e. <Point, DeviceResource>). A Point grid built with a custom resource fell through to the generic no-op and was silently left with unencoded point data. Fold the encode into the generic processPoints and gate it with if constexpr(is_same<BuildT, Point>). The encode kernels run on device data and are independent of the resource; only the trailing d_indx deallocation routes through ResourceT. Non-Point builds and default- resource Point builds are unchanged. Add a regression test that builds a NanoGrid<Point> through a custom resource and asserts every input point is recoverable from the encoded per-voxel data. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Mark Harris <mharris@nvidia.com>
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.
Follow-up to #2231, part of #2232 (NanoVDB injectable CUDA memory resources).
What
tools::cuda::PointsToGrid<Point, ResourceT>now encodes points for any resource. Previously the point-encoder lived only in thePointsToGrid<Point>full specialization (=PointsToGrid<Point, DeviceResource>), so a Point build with a custom resource missed it and fell through to the generic no-op — silently producing a grid with no encoded point data, no error. This was the known limitation called out in #2231's follow-ups.The encoder is folded into the generic
PointsToGrid<BuildT, ResourceT>::processPoints, gated byif constexpr (util::is_same<BuildT, Point>::value); the now-redundant full specialization is removed.Why existing paths are unchanged
if constexprblock is discarded, leaving the prior no-op body verbatim.ResourceT == DeviceResource, so the same encode kernels run with the same alignment — byte-for-byte the previous path.The resource governs allocation only; the encode kernels operate on device data, so making the encoder resource-agnostic is correct.
Testing
New
TestMemoryResource.PointsToGrid_PointEncodedWithCustomResourcebuilds aNanoGrid<Point>viaPointsToGridwith a custom resource and asserts the encoded coordinates match the input — red on current code (captures the no-op), green after the fix. RTX 6000 Ada / CUDA 12.6: memory-resource suite 9/9, CPUnanovdb_test_nanovdb153/153,nanovdb_test_cuda53/53.Non-CUDA builds
No impact on
NANOVDB_USE_CUDA=OFF— the change is confined totools/cuda/PointsToGrid.cuh(#if defined(__CUDACC__)-gated) and a CUDA-only test.🤖 Generated with Claude Code