Skip to content

GaussianProjectionForward: fix camera data loading that exceeds blockDim#345

Merged
swahtz merged 2 commits into
openvdb:mainfrom
swahtz:fix_projection_load_cameras
Nov 19, 2025
Merged

GaussianProjectionForward: fix camera data loading that exceeds blockDim#345
swahtz merged 2 commits into
openvdb:mainfrom
swahtz:fix_projection_load_cameras

Conversation

@swahtz

@swahtz swahtz commented Nov 19, 2025

Copy link
Copy Markdown
Contributor

In loadCamerasIntoSharedMemory, each thread loaded an element of camera data into shared memory. However, if the amount of camera data exceeds the number of threads, all of the camera data would fail to be loaded. This happens around camera 13 (256 / 21 elements-per-camera). Changed this loading into a strided loop so all camera data will be loaded.

Also I changed the calculation of shared memory from a manual calculation to using sizeof() the appropriate nanovdb::math structs for safety's sake.

more accurate shared memory calculation

Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
@swahtz swahtz requested a review from a team as a code owner November 19, 2025 07:31
@swahtz swahtz added the Gaussian Splatting Issues related to Gaussian splattng in the core library label Nov 19, 2025
@swahtz swahtz added this to fVDB Nov 19, 2025
@swahtz swahtz added the core library Core fVDB library. i.e. anything in the _Cpp module (C++) or fvdb python module label Nov 19, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a critical bug in the Gaussian projection forward operation where camera data loading would fail when the number of cameras exceeded approximately 13 (256 threads / 21 elements per camera). The fix implements a strided loop pattern to ensure all camera data is loaded into shared memory regardless of the number of cameras, and improves the safety of shared memory calculations by using sizeof() operators.

  • Replaced single-pass conditional loading with strided loop to handle camera counts exceeding block dimensions
  • Changed shared memory type from T[] to char[] and updated pointer arithmetic to use sizeof() for type-safe offset calculations
  • Made shared memory size calculations more explicit and type-safe using sizeof(nanovdb::math::Mat3<scalar_t>) and sizeof(nanovdb::math::Vec3<scalar_t>)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@harrism harrism left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! Just think maybe the shared declaration should be aligned as in your other recent PR.

Comment thread src/fvdb/detail/ops/gsplat/GaussianProjectionForward.cu Outdated
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
@swahtz swahtz enabled auto-merge (squash) November 19, 2025 21:26
@swahtz swahtz merged commit a518bd1 into openvdb:main Nov 19, 2025
32 checks passed
@github-project-automation github-project-automation Bot moved this to Done in fVDB Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core library Core fVDB library. i.e. anything in the _Cpp module (C++) or fvdb python module Gaussian Splatting Issues related to Gaussian splattng in the core library

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants