Repository navigation
Skip inactive articulation wrench resets - #6511
AntoineRichard merged 2 commits into
Conversation
Avoid clearing instantaneous wrench buffers when no wrench was applied. This removes unnecessary device work from every articulation write.
Greptile SummaryThis PR skips inactive instantaneous wrench resets in articulation write paths. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "Skip inactive PhysX wrench resets" | Re-trigger Greptile |
| if self._instantaneous_wrench_composer.active: | ||
| self._instantaneous_wrench_composer.reset() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
# 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
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
Validation
Checklist