Scale relation collision checks with BVH - #853
Draft
TuurStuyck wants to merge 2 commits into
Draft
Conversation
Use a grouped Warp BVH broad phase to avoid evaluating every object pair in sparse scenes while preserving the existing dense path and solver behavior. Add correctness coverage and a reproducible benchmark harness for scaling and regression measurements. Signed-off-by: tstuyck <tstuyck@nvidia.com>
RelationSolverState now validates and caches each object's local and anchor world bounding boxes once at construction instead of recomputing and re-validating them (via .get_bounding_box().to(device) and implicit torch.all(...) syncs) on every solver iteration. Downstream collision-loss calls thread through an assume_valid_extents flag to skip re-validating extents whose ordering is already guaranteed by that one-time check (translation and clearance expansion can't invert min <= max once it holds). Also: consolidate the three loss.item() calls per optimizer iteration into one, skip the pre-loop initial-loss forward pass when max_iters > 0 (iteration 0 recomputes the same value anyway), vectorize the anchor cross-env consistency check instead of looping per-env, and reuse _reconstruct_all_positions for position-history snapshots instead of one .tolist() sync per object. Removed the one remaining full-tensor torch.all(world_min <= world_max) assertion in the BVH pair-selection path, which re-validated an invariant RelationSolverState already guarantees and was still forcing a sync every iteration in exactly the higher-object-count regime this change targets. Signed-off-by: tstuyck <tstuyck@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.
Summary
Scale relation collision checks with BVH
Detailed description