Finalize: delete legacy, optimize, rename, clean up#1074
Open
Finalize: delete legacy, optimize, rename, clean up#1074
Conversation
Summary: Adds SkeletonDerivativeT, a shared utility class that encapsulates the fundamental derivative primitive used by all skeleton-based error functions: the joint hierarchy walk that accumulates derivatives from a joint up to the root. This utility will be used by JointErrorFunctionT, VertexErrorFunctionT, MultiSourceErrorFunctionT, and standalone error functions that need skeleton derivative computation. Key features: - accumulateJointGradient: batched hierarchy walk for gradient computation - accumulateJointJacobian: batched hierarchy walk for Jacobian computation - accumulateVertexGradient/Jacobian: mesh vertex derivative computation via skinning weights - accumulateBlendShapeGradient/Jacobian: blend shape parameter derivatives - Per-DOF activeJointParams check, ancestor-only traversal, batched vectors Differential Revision: D94558394
Summary: Renames ConstraintErrorFunctionT to JointErrorFunctionT and restructures it to inherit directly from SkeletonErrorFunctionT (removing the GeneralErrorFunctionT intermediate layer). Uses SkeletonDerivativeT for hierarchy walks in getGradient/getJacobian. Key changes: - ConstraintErrorFunctionT -> JointErrorFunctionT (new files: joint_error_function.h/inl.h) - Inherits SkeletonErrorFunctionT directly instead of GeneralErrorFunctionT - Leaf classes use new evalFunction(worldVecs) + getLocalVectors() interface - All 11 leaf classes updated: Position, Plane, Normal, Orientation, Aim*, FixedAxis*, Distance, Projection - Distance and Projection error functions now inherit JointErrorFunctionT (previously SkeletonErrorFunctionT) - GeneralizedLossT gets isL2()/invC2() accessors for optimization - diff_ik downstream updated for ProjectionErrorFunctionT member rename - External PointSplineErrorFunction (rocktenn/drita) updated Differential Revision: D94558392
Summary: Adds VertexConstraintErrorFunctionT and its leaf classes (VertexPosition, VertexPlane, VertexProjection, VertexNormal) as new vertex-based error functions that inherit from SkeletonErrorFunctionT directly instead of through GeneralErrorFunctionT. Key changes: - VertexConstraintErrorFunctionT inherits SkeletonErrorFunctionT directly - Uses SkeletonDerivativeT for vertex derivative computation (skinning weights, blend shapes) - Supports parallel threading via dispenso - L2 fast-path optimization - VertexNormalConstraintErrorFunctionT handles normal rotation correction via SkeletonDerivativeT - Includes comprehensive vertex constraint leaf tests (48 new tests) Differential Revision: D94558395
Summary: Adds MultiSourceErrorFunctionT, renamed from GeneralErrorFunctionT, as the base class for error functions that use the multi-source contribution model. Also adds CenterOfMassErrorFunctionT as a subclass, and updates JtJDistance and JtJPosition error functions to use the renamed base class. Key changes: - GeneralErrorFunctionT -> MultiSourceErrorFunctionT - ContributionT -> SourceT - CenterOfMassErrorFunctionT added as new MultiSource subclass - JtJDistance and JtJPosition updated to use MultiSourceErrorFunctionT - Tests for MultiSourceErrorFunctionT edge cases and CenterOfMass Note: CameraProjectionConstraintErrorFunctionT will be added in a follow-up diff as it requires more design work to restructure from ConstraintErrorFunctionT to MultiSourceErrorFunctionT. Differential Revision: D94558389
Summary: Updates standalone error functions (collision, collision_stateless, point_triangle_vertex, vertex_vertex_distance, camera_projection) to use SkeletonDerivativeT as a utility member for derivative computation. Also applies Option B (inline hierarchy walk) to JointErrorFunctionT's getGradient/getJacobian to eliminate the 25-50% performance regression from delegating to SkeletonDerivativeT. The inline walk matches the pre-refactor performance within 1-7%. Adds baseline_all benchmark target for comprehensive performance validation. Differential Revision: D94558396
Summary: Final phase of the error function refactoring: 1. Delete legacy VertexErrorFunctionT and old standalone VertexProjectionErrorFunctionT 2. Performance: wR precomputation (Position gradient -15%, Orientation -27%), scaledDfdv, single-evalFunction interface, Distance/Projection standalone 3. Rename VertexConstraintErrorFunctionT → VertexErrorFunctionT, drop "Constraint" from vertex leaf names/files, consolidate types into error_function_types.h 4. Unify getNumConstraints(), fix solver2 bindings, update pymomentum tests Performance (1000 constraints, vs pre-refactor baseline): Position: Gradient -15%, Jacobian -2.5% | Orientation: Gradient -27%, Jacobian -2.3% FixedAxis: Gradient -18%, Jacobian -5.1% | AimDist: Gradient -17%, Jacobian -5.6% All JointErrorFunctionT subclasses strictly faster than baseline. Differential Revision: D94847831
Contributor
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:
Final phase of the error function refactoring:
scaledDfdv, single-evalFunction interface, Distance/Projection standalone
from vertex leaf names/files, consolidate types into error_function_types.h
Performance (1000 constraints, vs pre-refactor baseline):
Position: Gradient -15%, Jacobian -2.5% | Orientation: Gradient -27%, Jacobian -2.3%
FixedAxis: Gradient -18%, Jacobian -5.1% | AimDist: Gradient -17%, Jacobian -5.6%
All JointErrorFunctionT subclasses strictly faster than baseline.
Differential Revision: D94847831