Skip to content

Reduce direct locomotion step overhead - #6512

Merged
AntoineRichard merged 7 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/optimize-direct-locomotion
Sep 8, 2026
Merged

AntoineRichard merged 7 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/optimize-direct-locomotion

Conversation

@AntoineRichard

@AntoineRichard AntoineRichard commented Jul 14, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Reduces common Direct Locomotion task overhead used by Ant and Humanoid without introducing the experimental Ant post-step path.

The change:

  • stages effort targets once per environment step because articulation command buffers persist across decimation substeps;
  • uses the cached all-joint target path instead of repeatedly uploading joint indices;
  • keeps scalar zero assignments on-device;
  • removes a duplicate articulation reset already performed by the scene reset;
  • removes redundant clones after advanced indexing; and
  • uses the common fused joint-state writer provided by PhysX, Newton, and Isaac Lab OV.

The isolated device scalar change improved the Ant host-return measurement from 3.433 ms to 3.231 ms. The remaining changes remove repeated launches, index transfers, copies, and reset writes; the larger fused post-step and device-mask work is deliberately excluded.

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

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Release backport

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

Screenshots

Not applicable.

Validation

  • uv run python tools/changelog/cli.py check develop
  • uv run --frozen isaaclab -f
  • uv run --frozen --extra test python -m pytest source/isaaclab_tasks/test/core/test_environments_newton.py -k 'Direct and (Ant or Humanoid)' -q (2 passed)
  • Verified the fused writer interface on PhysX, Newton, and Isaac Lab OV.
  • The 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

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 (not required for this internal performance fix)
  • 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

Stage persistent effort targets once per environment step and remove redundant reset work, state copies, scalar transfers, and split joint-state writes.
@AntoineRichard AntoineRichard mentioned this pull request Jul 14, 2026
14 of 17 tasks
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jul 14, 2026
@AntoineRichard
AntoineRichard marked this pull request as ready for review July 14, 2026 08:59
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR reduces overhead in the direct locomotion environment. The main changes are:

  • Stages joint effort targets before the decimation loop.
  • Removes repeated joint index uploads and duplicate articulation reset work.
  • Avoids reset-time clones and uses the fused joint-state writer when available.
  • Adds a changelog entry for the locomotion overhead reduction.

Confidence Score: 4/5

The reset and logging changes need fixes before merging.

  • Success-rate logging can now pass a tensor into episode metadata.
  • Reset can mutate the shared default root pose when the indexed default buffer aliases storage.
  • The once-per-step effort staging depends on backend command persistence across decimation substeps.

source/isaaclab_tasks/isaaclab_tasks/core/locomotion/locomotion_direct_env.py

Important Files Changed

Filename Overview
source/isaaclab_tasks/changelog.d/ant-direct-reset-overhead.rst Adds a changelog note for the direct locomotion overhead reduction.
source/isaaclab_tasks/isaaclab_tasks/core/locomotion/locomotion_direct_env.py Moves effort staging, trims reset copies, and adds fused joint-state reset writes, with issues in metric typing and reset buffer ownership.

Reviews (1): Last reviewed commit: "Reduce direct locomotion step overhead" | Re-trigger Greptile

# Log survival success rate (survived = timed out without falling)
survived = self.reset_time_outs[env_ids].float()
self.extras.setdefault("log", {})["Metrics/success_rate"] = survived.mean().item()
self.extras.setdefault("log", {})["Metrics/success_rate"] = survived.mean()

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.

P1 Tensor Escapes Episode Log

When this env runs through wrappers that copy extras["log"] into episode info, Metrics/success_rate is now a device tensor instead of the previous Python float. SB3-style logging and serialization paths can receive that tensor directly, which can break or drop the success-rate metric.

Suggested change
self.extras.setdefault("log", {})["Metrics/success_rate"] = survived.mean()
self.extras.setdefault("log", {})["Metrics/success_rate"] = survived.mean().item()

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.

Good catch. Fixed in 08ac265 by restoring .item(), which preserves the historical Python-float contract for extras["log"] and SB3-style episode info.

@AntoineRichard AntoineRichard mentioned this pull request Jul 14, 2026
7 tasks done
Keep the success-rate episode metric as a Python float so logging integrations retain the existing scalar contract while the reset path remains otherwise unchanged.
Describe the compatibility path in backend-neutral terms now that OVPhysX can provide the optional fused joint-state writer independently.
AntoineRichard added a commit that referenced this pull request Jul 15, 2026
# Description

Adds Articulation.write_joint_state_to_sim_index to the OVPhysX backend.

The existing reset path updates the same state through separate position
and velocity writers. That requires four Warp cache-update kernels: one
for position, then three for velocity, the finite-difference baseline,
and acceleration zeroing. The new writer performs those cache updates in
one kernel while preserving the two OVPhysX tensor-binding writes
required to update DOF position and velocity.

The method preserves the existing semantics:

- resolves partial environment and joint indices through the standard
OVPhysX helpers
- updates joint position and velocity caches
- synchronizes the previous-velocity baseline and zeros selected joint
accelerations
- stamps the joint-acceleration cache
- invalidates pose and velocity dependents once unless skip_forward is
requested
- leaves unselected environments and joints unchanged

This is a focused OVPhysX backend PR. It has no dependency on #6512,
although the compatibility path there can use this method automatically
when both changes are present.

## Type of change

- New feature (non-breaking change which adds functionality)

## Validation

- Focused CPU OVPhysX tests: 3 passed, 207 deselected
- The modified integration test fails on origin/develop with the
expected missing-method AttributeError
- Changelog gate: ./isaaclab.sh -p tools/changelog/cli.py check develop
- Full pre-commit: ./isaaclab.sh -f
- Full documentation build was attempted but remained silent for several
minutes and was terminated; the public API docstring and RST
cross-reference checks pass

## Screenshots

Not applicable.

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the pre-commit checks with ./isaaclab.sh -f
- [x] I have documented the public API and added a changelog fragment
- [x] My changes generate no new warnings
- [x] I have added tests that prove the feature works
- [x] I have added a changelog fragment under
source/isaaclab_ovphysx/changelog.d/
- [x] My name already exists in CONTRIBUTORS.md
Call the common articulation joint-state writer directly now that the OvPhysX implementation has landed in develop. This keeps the reset path backend-neutral and removes a compatibility branch that is no longer reachable.
@AntoineRichard
AntoineRichard requested a review from a team July 21, 2026 07:38
matthewtrepte pushed a commit to matthewtrepte/IsaacLab that referenced this pull request Aug 4, 2026
# Description

Adds Articulation.write_joint_state_to_sim_index to the OVPhysX backend.

The existing reset path updates the same state through separate position
and velocity writers. That requires four Warp cache-update kernels: one
for position, then three for velocity, the finite-difference baseline,
and acceleration zeroing. The new writer performs those cache updates in
one kernel while preserving the two OVPhysX tensor-binding writes
required to update DOF position and velocity.

The method preserves the existing semantics:

- resolves partial environment and joint indices through the standard
OVPhysX helpers
- updates joint position and velocity caches
- synchronizes the previous-velocity baseline and zeros selected joint
accelerations
- stamps the joint-acceleration cache
- invalidates pose and velocity dependents once unless skip_forward is
requested
- leaves unselected environments and joints unchanged

This is a focused OVPhysX backend PR. It has no dependency on isaac-sim#6512,
although the compatibility path there can use this method automatically
when both changes are present.

## Type of change

- New feature (non-breaking change which adds functionality)

## Validation

- Focused CPU OVPhysX tests: 3 passed, 207 deselected
- The modified integration test fails on origin/develop with the
expected missing-method AttributeError
- Changelog gate: ./isaaclab.sh -p tools/changelog/cli.py check develop
- Full pre-commit: ./isaaclab.sh -f
- Full documentation build was attempted but remained silent for several
minutes and was terminated; the public API docstring and RST
cross-reference checks pass

## Screenshots

Not applicable.

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the pre-commit checks with ./isaaclab.sh -f
- [x] I have documented the public API and added a changelog fragment
- [x] My changes generate no new warnings
- [x] I have added tests that prove the feature works
- [x] I have added a changelog fragment under
source/isaaclab_ovphysx/changelog.d/
- [x] My name already exists in CONTRIBUTORS.md
@AntoineRichard

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 8, 2026
@AntoineRichard
AntoineRichard merged commit 25fad3e into isaac-sim:develop Sep 8, 2026
53 checks passed
@isaaclab-bot

isaaclab-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Backported to release/3.0.0 as bc86bef.

isaaclab-bot Bot pushed a commit that referenced this pull request Sep 8, 2026
# Description

Reduces common Direct Locomotion task overhead used by Ant and Humanoid
without introducing the experimental Ant post-step path.

The change:

- stages effort targets once per environment step because articulation
command buffers persist across decimation substeps;
- uses the cached all-joint target path instead of repeatedly uploading
joint indices;
- keeps scalar zero assignments on-device;
- removes a duplicate articulation reset already performed by the scene
reset;
- removes redundant clones after advanced indexing; and
- uses the common fused joint-state writer provided by PhysX, Newton,
and Isaac Lab OV.

The isolated device scalar change improved the Ant host-return
measurement from 3.433 ms to 3.231 ms. The remaining changes remove
repeated launches, index transfers, copies, and reset writes; the larger
fused post-step and device-mask work is deliberately excluded.

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

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Screenshots

Not applicable.

## Validation

- `uv run python tools/changelog/cli.py check develop`
- `uv run --frozen isaaclab -f`
- `uv run --frozen --extra test python -m pytest
source/isaaclab_tasks/test/core/test_environments_newton.py -k 'Direct
and (Ant or Humanoid)' -q` (`2 passed`)
- Verified the fused writer interface on PhysX, Newton, and Isaac Lab
OV.
- The 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

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

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation (not
required for this internal performance fix)
- [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 under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump `extension.toml` — CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

(cherry picked from commit 25fad3e)
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.

3 participants