Skip to content

[Newton] Speed up deformable cloning using Newton replication - #7572

Open
camevor wants to merge 2 commits into
isaac-sim:developfrom
camevor:newton-delegate-cloth-replication
Open

[Newton] Speed up deformable cloning using Newton replication#7572
camevor wants to merge 2 commits into
isaac-sim:developfrom
camevor:newton-delegate-cloth-replication

Conversation

@camevor

@camevor camevor commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Description

Speeds up Newton cloth and soft-body startup by replicating compatible deformables instead of rebuilding them per environment. Retains the existing fallback for rotated or incompatible environments and adds regression coverage for both paths.

Type of change

  • (Startup performance enhancement)

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Checklist

Docker and GPU tests run on demand. Push the commits you want tested, then
comment run-ci on the pull request.

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump extension.toml — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@camevor
camevor requested a review from a team September 4, 2026 13:37
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Sep 4, 2026
@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Speeds up Newton deformable startup by adding registered cloth and soft-body geometry once and replicating it across translation-compatible environments, while retaining per-world construction for incompatible transforms.

  • Adds an opt-in protocol that lets compatible per-world builder hooks participate in batched Newton replication.
  • Computes replicated deformable particle offsets after validating the destination particle count.
  • Adds regression coverage for translation-only replication, rotated-world fallback, and pre-existing destination particles.
  • Adds changelog fragments for the Newton and contrib packages.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure established in the supported cloning paths.

The optimized path validates hook compatibility and replicated particle counts, while incompatible transforms and hooks continue through the existing per-world fallback.

Important Files Changed

Filename Overview
source/isaaclab_contrib/isaaclab_contrib/deformable/deformable_object.py Adds translation-compatible deformable replication preparation, particle-layout validation, and offset binding while preserving per-world construction.
source/isaaclab_newton/isaaclab_newton/cloner/newton_clone_utils.py Extends homogeneous builder replication with an all-hooks opt-in protocol and post-replication callbacks.
source/isaaclab_contrib/test/deformable/test_deformable_builder_hooks.py Covers one-time deformable construction and replication, destination particle prefixes, and fallback for differing world rotations.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Clone mapping and environment transforms] --> B{Single homogeneous source?}
    B -->|No| F[Per-world builder loop]
    B -->|Yes| C{Every hook opts in and accepts transforms?}
    C -->|No| F
    C -->|Yes| D[Prepare deformables once on source builder]
    D --> E[Replicate source builder across worlds]
    E --> G[Validate particle count and bind per-world offsets]
    F --> H[Add deformables independently for each world]
    G --> I[Final Newton builder]
    H --> I
Loading

Reviews (1): Last reviewed commit: "Newton-side cloth replication" | Re-trigger Greptile

@isaaclab-review-bot isaaclab-review-bot Bot 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.

Isaac Lab Review Bot

Adds an opt-in Newton replication path for compatible per-world builder hooks, allowing registered deformable meshes to be built once and replicated while retaining the per-world fallback. The new hook protocol needs clearer transform-frame documentation.

  • Design and architecture: The fast path is gated by hook capability checks and deformable rotation compatibility, with post-replication particle-layout validation and fallback to the existing per-world construction path. However, the cross-package hook contract does not document that its capability callback receives transforms relative to world 0 while its preparation callback receives the absolute world-0 pose.
  • API: The replicate_builder_mapping signature and return contract remain unchanged, and the hook opt-in is additive. Document the coordinate frames, quaternion convention, and [m] units for the newly described hook arguments so future implementations cannot silently place replicated geometry using the wrong frame.
  • Implementation: The deformable offset calculation accounts for pre-existing destination particles and the complete source-builder particle stride, and offsets are reset before preparation. Regression coverage exercises both translation-only replication and the rotated-world fallback. The remaining issue is the ambiguity in the documented callback argument semantics.

Minor fixes needed. Posted 1 actionable finding inline.

Automated review; human maintainers own approval decisions.

"""Replicate source builders, naming homogeneous copies at their destinations."""
"""Replicate source builders, naming homogeneous copies at their destinations.

A hook joins the batched path by carrying ``_can_replicate_builder(xforms)`` and

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.

🔵 Suggestion · Api — Hook protocol docstring omits transform frames

The documented extension point passes mixed frames: _can_replicate_builder receives xforms relative to world 0 (line 319), while _prepare_builder_replication receives the absolute world-0 pose (xforms_np[0], line 334). The docstring names the arguments but not their frames or units, so an implementer treating source_position/source_rotation as relative (or xforms as absolute) would silently mispose replicated geometry. State both frames and [m] units here.

Comment on lines +199 to +205
if not SimulationManager._deformable_registry:
return True
rotations = xforms[:, 3:]
return bool(
np.allclose(rotations[:, :3], 0.0, atol=1.0e-6, rtol=0.0)
and np.allclose(np.abs(rotations[:, 3]), 1.0, atol=1.0e-6, rtol=0.0)
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can be explicitely state that this function tests for unit quaternion?

Comment on lines +199 to +200
if not SimulationManager._deformable_registry:
return True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not expert but why this is there?

Comment on lines +238 to +243
for entry, source_offset, particle_count in replicated_entries:
entry.particles_per_body = particle_count
entry.particle_offsets = [
destination_particle_base + world * source_particle_stride + source_offset
for world in range(num_worlds)
]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could probably be vectorized?

@kellyguo11 kellyguo11 moved this to In review in Isaac Lab Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

3 participants