Skip to content

Scale relation collision checks with BVH - #853

Draft
TuurStuyck wants to merge 2 commits into
mainfrom
tstuyck/feature/relation-solver-bvh
Draft

Scale relation collision checks with BVH#853
TuurStuyck wants to merge 2 commits into
mainfrom
tstuyck/feature/relation-solver-bvh

Conversation

@TuurStuyck

Copy link
Copy Markdown
Collaborator

Summary

Scale relation collision checks with BVH

Detailed description

  • Avoid quadratic narrow-phase work in sparse CUDA scenes with grouped per-environment BVHs.
  • Preserve existing collision semantics and dense/small-scene behavior with focused correctness tests.
  • Add reproducible benchmarks for runtime, memory, and scaling comparisons.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant