Skip to content

Skip inactive articulation wrench resets - #6511

Merged
AntoineRichard merged 2 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/newton-skip-inactive-wrench-reset
Jul 15, 2026
Merged

AntoineRichard merged 2 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/newton-skip-inactive-wrench-reset

Conversation

@AntoineRichard

@AntoineRichard AntoineRichard commented Jul 14, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Skips resetting inactive instantaneous-wrench composers in the Newton, PhysX, and OVPhysX articulation write paths.

Newton and PhysX previously cleared all seven composer buffers on every physics substep even when no instantaneous wrench had been applied. Nsight attributed fourteen 442,368-byte clears per Ant environment step to this work on Newton. OVPhysX already avoids resets when neither composer is active; its guard removes the remaining redundant reset when only permanent wrenches are active.

The active check preserves the existing reset after every applied instantaneous wrench. An inactive composer is already fully reset: construction and full reset both zero its five input and two output buffers, while every supported add or set operation marks it active.

This is one focused slice of superseded Draft PR #6509 and is independent of benchmark PR #6474.

Type of change

  • Bug fix (non-breaking performance fix)

Validation

  • ./isaaclab.sh -p tools/changelog/cli.py check develop
  • ./isaaclab.sh -f before commit
  • ./isaaclab.sh -f after commit and before push
  • The Newton source change was exercised by the original focused CPU/CUDA validation before the PR split; new test files are intentionally omitted from this slice.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • Documentation changes are not required
  • 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 for every touched package
  • My name already exists in CONTRIBUTORS.md

Avoid clearing instantaneous wrench buffers when no wrench was applied. This removes unnecessary device work from every articulation write.
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jul 14, 2026
@AntoineRichard AntoineRichard mentioned this pull request Jul 14, 2026
14 of 17 tasks
@AntoineRichard
AntoineRichard marked this pull request as ready for review July 14, 2026 08:59
@AntoineRichard
AntoineRichard requested review from hujc7 and ooctipus July 14, 2026 09:00
@greptile-apps

greptile-apps Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR skips inactive instantaneous wrench resets in articulation write paths. The main changes are:

  • Guarded instantaneous composer resets in Newton and PhysX.
  • Narrowed the OVPhysX reset to active instantaneous composers.
  • Added changelog fragments for the Newton, PhysX, and OVPhysX packages.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
source/isaaclab_newton/isaaclab_newton/assets/articulation/articulation.py Guards the Newton instantaneous wrench composer reset behind the composer active flag.
source/isaaclab_physx/isaaclab_physx/assets/articulation/articulation.py Guards the PhysX instantaneous wrench composer reset behind the composer active flag.
source/isaaclab_ovphysx/isaaclab_ovphysx/assets/articulation/articulation.py Skips the OVPhysX instantaneous composer reset when only permanent wrenches are active.
source/isaaclab_newton/changelog.d/ant-direct-wrench-overhead.rst Adds a Newton changelog entry for the inactive reset optimization.
source/isaaclab_physx/changelog.d/skip-inactive-wrench-reset.rst Adds a PhysX changelog entry for the inactive reset optimization.
source/isaaclab_ovphysx/changelog.d/skip-inactive-wrench-reset.rst Adds an OVPhysX changelog entry for the inactive reset optimization.

Reviews (2): Last reviewed commit: "Skip inactive PhysX wrench resets" | Re-trigger Greptile

Comment on lines +300 to +301
if self._instantaneous_wrench_composer.active:
self._instantaneous_wrench_composer.reset()

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.

P2 Inactive Outputs Stay Stale

When only permanent wrenches are active, this branch now skips the instantaneous composer reset, so its out_force_b and out_torque_b buffers are no longer cleared at the end of the write. Callers that inspect the instantaneous composer after write_data_to_sim() can still see the previous step's composed instantaneous wrench even though no instantaneous wrench is active for the current step.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This stale-output state is not reachable through the supported WrenchComposer API. The composer starts inactive with zeroed outputs. Every add/set method sets active and dirty to true. The only operation that clears active is a full reset, which zeros all five input buffers and both output buffers. After an active instantaneous wrench is applied, write_data_to_sim performs that full reset before the next frame. Partial resets deliberately leave active true. Therefore a later permanent-only frame skips a composer whose outputs are already zero, not the previous composed wrench. Direct writes to underlying buffers are explicitly documented as unsupported and may already produce stale outputs independently of this change. No code change is needed here.

Apply the instantaneous-composer active guard to the PhysX and OVPhysX articulation write paths. This avoids redundant buffer clears while preserving active instantaneous wrench behavior.
@AntoineRichard AntoineRichard changed the title Skip inactive Newton wrench resets Skip inactive articulation wrench resets Jul 14, 2026
@AntoineRichard
AntoineRichard marked this pull request as draft July 14, 2026 09:14
@AntoineRichard
AntoineRichard marked this pull request as ready for review July 14, 2026 11:33
@AntoineRichard
AntoineRichard merged commit f4ccaff into isaac-sim:develop Jul 15, 2026
65 of 67 checks passed
matthewtrepte pushed a commit to matthewtrepte/IsaacLab that referenced this pull request Aug 4, 2026
# Description

Skips resetting inactive instantaneous-wrench composers in the Newton,
PhysX, and OVPhysX articulation write paths.

Newton and PhysX previously cleared all seven composer buffers on every
physics substep even when no instantaneous wrench had been applied.
Nsight attributed fourteen 442,368-byte clears per Ant environment step
to this work on Newton. OVPhysX already avoids resets when neither
composer is active; its guard removes the remaining redundant reset when
only permanent wrenches are active.

The active check preserves the existing reset after every applied
instantaneous wrench. An inactive composer is already fully reset:
construction and full reset both zero its five input and two output
buffers, while every supported add or set operation marks it active.

This is one focused slice of superseded Draft PR isaac-sim#6509 and is
independent of benchmark PR isaac-sim#6474.

## Type of change

- Bug fix (non-breaking performance fix)

## Validation

- ./isaaclab.sh -p tools/changelog/cli.py check develop
- ./isaaclab.sh -f before commit
- ./isaaclab.sh -f after commit and before push
- The Newton source change was exercised by the original focused
CPU/CUDA validation before the PR split; new test files are
intentionally omitted from this slice.

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the pre-commit checks with ./isaaclab.sh --format
- [x] Documentation changes are not required
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added a changelog fragment for every touched package
- [x] My name already exists in CONTRIBUTORS.md
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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants