Skip to content

NanoVDB: fix Point grid size alignment and vector entry points (CUDA) - #2329

Open
swahtz wants to merge 1 commit into
AcademySoftwareFoundation:masterfrom
swahtz:nanovdb-pointstogrid-fixes
Open

NanoVDB: fix Point grid size alignment and vector entry points (CUDA)#2329
swahtz wants to merge 1 commit into
AcademySoftwareFoundation:masterfrom
swahtz:nanovdb-pointstogrid-fixes

Conversation

@swahtz

@swahtz swahtz commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • tools::cuda::PointsToGrid now pads the point blind data to NANOVDB_DATA_ALIGNMENT when sizing a Point grid, as GridBlindMetaData::blindDataSize and the other builders do. A payload that was not a multiple of 32 bytes (PointType::Voxel8/Voxel16, or most point counts with World32) left mGridSize misaligned, so the next grid in any multi-grid buffer built from it (mergeGrids, cuda::mergeGridHandles, the vector entry points) started at a misaligned address and device code reading its header faulted. The ThreePointsToGrid size expectation is updated accordingly.
  • The std::vector<std::tuple> overloads of tools::cuda::voxelsToGrid / pointsToGrid could not compile when instantiated (they called the deprecated mergeDeviceGrids with the stream in the pool-buffer slot, and the point form passed one template argument too many). They now merge through cuda::mergeGridHandles; a static_assert names the dual-space-only limitation. The declared-but-undefined pointsToGrid(points, count, voxelSize, type, buffer, stream) overload, which the deprecated cudaPointsToGrid calls, gets its definition.
  • pendingchanges/nanovdb.txt records both fixes.

Found while adding single-space mergeGridHandles/splitGridHandles overloads (follow-up to #2232, requested in openvdb/fvdb-core#770); those land separately.

Test plan

  • New TestNanoVDBCUDA.pointsToGridVectorOverloads: merges two Voxel8 point grids through the vector entry point (the case that faulted), asserts gridSize % NANOVDB_DATA_ALIGNMENT == 0, and exercises the voxel-set overload and the new single-set definition.
  • nanovdb_test_cuda 66/66 and nanovdb_test_nanovdb 156/156 pass locally (CUDA 13.2, sm_120, NANOVDB_CUDA_WERROR on).
  • CI

PointsToGrid sized a Point grid as the tree plus the raw point payload,
with no padding. GridBlindMetaData::blindDataSize and every other
builder round blind data up to NANOVDB_DATA_ALIGNMENT, so a payload that
was not a multiple of 32 bytes (PointType::Voxel8 or Voxel16, or most
point counts with World32) left mGridSize misaligned. The grid was fine
on its own, but the next grid in any multi-grid buffer built from it
(mergeGrids, cuda::mergeGridHandles, the vector entry points) started at
a misaligned address, and device code reading that header faulted with
a misaligned-address error. The blind data is now padded like
blindDataSize, and the ThreePointsToGrid expectation follows.

The std::vector<std::tuple> overloads of tools::cuda::voxelsToGrid and
pointsToGrid, which build one grid per tuple and merge them, could not
compile when instantiated: they called the deprecated mergeDeviceGrids
with the stream in the pool-buffer slot, and the point form named one
template argument too many. They now merge through
cuda::mergeGridHandles with the pool buffer and stream in place; a
static_assert names the dual-space-only limitation instead of an opaque
overload failure. The pointsToGrid(points, count, voxelSize, type, ...)
overload, declared and called by the deprecated cudaPointsToGrid but
never defined, gets its definition.

New test pointsToGridVectorOverloads merges two Voxel8 point grids
through the vector entry point (the case that faulted), asserts the
grid sizes are aligned, and exercises the voxel-set overload and the
new single-set definition.

Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant