Add transform-reduce extension points for CUDA VGICP derivatives - #104
Open
noelex wants to merge 1 commit into
Open
Add transform-reduce extension points for CUDA VGICP derivatives#104noelex wants to merge 1 commit into
noelex wants to merge 1 commit into
Conversation
Owner
|
Thank you for your contribution! This feature looks quite interesting. I'll take a closer look at it later. |
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.
Summary
This PR adds an extension point to the CUDA VGICP derivative pipeline so downstream implementations can customize how individual correspondences contribute to the final reduction without duplicating correspondence lookup, VGICP derivative evaluation, CUDA stream handling, or CUB reduction logic.
Custom transforms are applied after the standard VGICP derivative/error computation and before reduction. They receive the source/target correspondence indices and can produce arbitrary reduction result types.
This enables use cases such as:
The transforms are fused into the existing transform-reduce pipeline and do not require materializing per-correspondence derivative results.
What changed
IntegratedVGICPDerivativespolymorphic:issue_linearize()andissue_compute_error()virtualIntegratedVGICPFactorGPU::replace_derivatives()for derived factorsclone()so cloning cannot silently restore the default implementationgtsam_points_cudaSOVERSIONbecause makingIntegratedVGICPDerivativespolymorphic changes its ABIMinimal usage example
The following example applies a Cauchy loss to each VGICP correspondence.
The derived implementation only defines how each already-computed VGICP correspondence contributes to the reduction. Correspondence lookup and the standard VGICP derivative/error evaluation remain in
gtsam_points.The factor can then be used like a normal GPU VGICP factor:
Transforms used with the standard factor output should preserve
LinearizedSystem6::num_inliers, since it is used to update the factor's inlier statistics.For more advanced use cases, the transform-reduce helpers also support custom result types and custom associative reduction operators, allowing additional statistics or diagnostics to be accumulated in the same reduction pass.
Compatibility
This PR changes the ABI of
gtsam_points_cudabecauseIntegratedVGICPDerivativesbecomes polymorphic. The CUDA librarySOVERSIONis therefore bumped accordingly.At the behavioral level, the standard
IntegratedVGICPFactorGPUproduces the same VGICP results as before because its implementation uses identity transforms.Derived factors that call
replace_derivatives()must overrideclone()and reinstall an equivalent derivative implementation. The inheritedclone()throws instead of silently creating a factor with the default derivatives.Testing
VGICPDerivativesTransformReduceTest: 5/5 passed