Skip to content

[Newton] Redesign Newton Manager [3/N] - #8928

Merged
StafaH merged 23 commits into
isaac-sim:mainfrom
StafaH:newton/redesign-3-env-control
Nov 10, 2026
Merged

StafaH merged 23 commits into
isaac-sim:mainfrom
StafaH:newton/redesign-3-env-control

Conversation

@StafaH

@StafaH StafaH commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Part 3 of the Newton manager redesign (overview).
Follows [2d-ii/N] #8946 (merged).

The environment's control now runs inside the Newton step. When every action term and every asset that writes to the
simulation can be recorded, the Newton step handles them: each physics step of the captured decimation
loop applies the actions and writes the assets before the Newton actuators, as the environment's own loop does. One
env.step then makes one physics call instead of decimation calls.

Changes

  • handle_actions. PhysicsManager.handle_actions(actions, scene) returns False by default.
    NewtonManager.handle_actions registers ActionManager.apply_action and scene.write_data_to_sim as pre-actuator
    callbacks and sets NewtonBackend.handles_actions. The backend then stages the body forces after the pre-actuator callbacks, so wrenches
    written by the assets hold for that physics step's substeps, and a reordered or ball-jointed articulation
    republishes its state at the start of its write. Post-step callbacks still run once per step. Hard resets register
    them again on the new backend. When something cannot be recorded, nothing is handled and the environment keeps its
    loop. ManagerBasedEnv also keeps its loop when render_interval is not a multiple of the decimation, a recorder
    term records after every physics step (RecorderManager.records_physics_steps), or a sensor that refreshes on
    update (contact history or eager sensor updates) has a period that is not a whole number of environment steps.
  • Capture flags.
    • ActionTerm.is_graphable (default False) marks terms whose apply_actions launches only Warp work on
      fixed buffers: joint position, velocity and effort, joint-to-limits (with EMA) and binary joint actions. These
      terms now write their processed actions in place, so a held processed_actions reference sees later
      commands. A subclass that overrides process_actions or apply_actions must set it again.
      ActionManager.is_graphable is whether all terms set it.
    • AssetBase.is_graphable (default False) is True for Newton rigid objects and collections, and for
      Newton articulations whose actuators run no Torch model and that have no fixed-tendon control.
      ActuatorCollection.is_graphable and InteractiveScene.is_graphable report the same.
  • Wrench work in a captured step. WrenchComposer.pending replaces active in the Newton asset writers. While a
    graph records, a composer that was ever written always merges, composes into the body frame and clears its buffers,
    so replays apply wrenches written after the capture. The on_first_use constructor argument captures the step again
    at the first write.

Performance

RTX PRO 6000 Blackwell, Warp 1.17.0. isaaclab benchmark runtime --task <task> --num_envs 4096 --num_steps 1000 --warmup_steps 100 --visualizer none physics=newton_mjwarp, two alternating sequential rounds after a warm-up run
(steps/s):

Task main [2d/N] this PR vs [2d/N]
Cartpole 2.632M 2.634M 2.808M +6.6%
Flat ANYmal-D 254.0k 261.1k 261.9k +0.3%
Reach-Franka 1.049M 1.051M 1.078M +2.6%

Testing

  • New: a backend that handles actions matches the environment loop with a state-dependent action over a captured decimation loop,
    including after a hard reset. Dropping the re-staging of body forces turns it red.
  • New: recorded wrench work applies wrenches written after the capture, and recordable joint action terms process
    into the same buffer.
  • Handled and env-loop Cartpole and Reach-Franka rollouts on MJWarp match exactly. Flat ANYmal-D (Newton actuators,
    external wrench applied mid-rollout) matches the unfolded environment loop exactly.
  • Targeted tests pass, run file by file: Newton manager, solvers, VBD, MJWarp tendon control, MPM reset masks,
    coupler, visualization state, articulation and rigid object contracts, articulation, rigid object, cable, joint
    coordinates, Newton actuators, BAM actuator, MPM object, sensors, cloner, visualizer adapter, wrench composer,
    actions, experimental capture safety and Warp action parity, interactive scene.
  • Kit-only tests did not run locally.

Checklist

  • 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 changelog fragments

@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Nov 4, 2026
@StafaH
StafaH force-pushed the newton/redesign-3-env-control branch 2 times, most recently from de943f2 to ea811f0 Compare November 6, 2026 21:54
@StafaH
StafaH marked this pull request as ready for review November 6, 2026 22:09
@StafaH
StafaH requested a review from a team November 6, 2026 22:09
@greptile-apps

greptile-apps Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect bounded Newton-backed manager simulation workflows.

Preserve intermediate sensor, recorder, and render calls before merging the expanded Newton folding path.

Findings

  1. P1 Intermediate physics samples disappear ▶

Summary

This PR lets Newton run graph-safe actions and asset writes inside its physics step.

  • Newton runs recordable environment control inside its decimated physics step.
  • Newton wrench updates remain live after a physics step is captured.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Process actions once] --> B{Control supports capture?}
    B -->|Yes| C[One Newton call]
    C --> D[Apply actions]
    D --> E[Write assets and stage forces]
    E --> F[Run actuators and physics]
    F -->|Repeat for decimation| D
    F --> G[Return to environment]
    B -->|No| H[Environment runs physics loop]
    H --> G
    G --> I[Recorder, render, and scene update]
Loading

Reviews (1) · Last reviewed commit: "Declare graph capture support on every m..." · Reviewed by 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

Needs attention: Scope and over-engineering (1), Compatibility and deprecation (1), Style consistency (3). Other reviewed categories look good.

  • PR description: The body matches the diff and reports hardware, command, workload, warmup, and throughput; add exact benchmark revisions and state that processed_actions references now observe later commands.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: Minimal implementation: extend ActionTerm/ActionManager, AssetBase/InteractiveScene, PhysicsManager/NewtonManager, and WrenchComposer; no source modules were added. Collapse InteractiveScene._sim_writers into direct loops while retaining capability-gated callbacks, in-place buffers, decimation, and wrench recapture. Scope is cohesive; no split recommended.
  • API: API changes look good.
  • Compatibility and deprecation: Breaking changes: processed_actions references now observe later process_actions calls, without a deprecation bridge or migration guidance; document aliasing, old and new behavior, and transition guidance.
  • Implementation: Implementation looks good.
  • Style consistency: New capability members violate class conventions: AssetBase.supports_graph_capture lacks ClassVar, while properties and public methods follow operations or private helpers; annotate and reorder them.
  • Test quality: Test quality looks good.

Minor fixes needed. Posted 5 inline findings.

Automated review; human maintainers own approval decisions.

@AntoineRichard AntoineRichard left a comment

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.

The bound-control path changes physics-step behavior in three cases: sensor sampling, reordered articulation state, and first-use wrench merges. Details are inline.

Validation: 8 focused tests passed (6 action tests, the Franka gripper regression, and the recorder capability test). A CPU sensor timing probe and a CUDA wrench-merge probe confirmed the sampling and merge failures. The reordered-state issue was traced through the production callback order, with an isolated CPU reproduction confirming stale implicit-effort telemetry. Full-scene simulation could not be completed because the published Newton wheel lacks APIs expected by this checkout.

@maxkra15 maxkra15 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.

I reproduced three cases where binding changes the existing loop's behavior: extra post-step callback invocations, changed sensor sampling cadence, and stale commands from custom action processing. Left the details inline. I'd fix these before merging. The targeted action, wrench, gripper and manager checks pass; these came from additional runtime probes on Newton 1.9 / MuJoCo Warp 3.17.

StafaH added 13 commits November 9, 2026 11:18
ManagerBasedEnv binds its action terms and the scene's asset writes to the
physics step through PhysicsManager.bind_control. Newton registers them as
control callbacks, re-stages body forces after them, and runs the whole
decimation loop in one captured step when every term and asset can be
recorded. Action terms declare supports_graph_capture and
apply_every_physics_step, and Newton keeps the loop in the environment
when an unbound term must run before every physics step.

Wrench composers record merge, composition and reset independent of host
flags once used, and capture the step again at their first write.
@AntoineRichard

Copy link
Copy Markdown
Collaborator

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 Nov 9, 2026
@StafaH

StafaH commented Nov 10, 2026

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 Nov 10, 2026

@maxkra15 maxkra15 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.

Rechecked the latest changes, including the first-step opt-out. No further blockers from me. 75 focused checks passed (71 CPU, 4 CUDA), covering the action terms, eligibility gates, manager lifecycle and captured action/actuator stepping. I haven't rerun LEAPP export or the Kit-only tests.

@StafaH
StafaH merged commit 43359cf into isaac-sim:main Nov 10, 2026
58 checks passed
hujc7 added a commit that referenced this pull request Nov 13, 2026
…rs (#8821)

## Review Map

- A number is one feature and its letters are that feature's PRs, in
merge order; an arrow points from a PR to the PRs that build on it.
- A stacked PR's page shows the cumulative diff of its dependency chain;
the "Exact changes" link opens that PR's Files changed page on its own
changes (parent head to PR head). #6646's head merges `main` for one
conflict, so its link also shows `main`'s #8928.
- #8783 and #6607 are no longer part of the series.

| PR | Status | Depends on | Exact changes |
|---|---|---|---|
| 📌 #8821 Part 1a/8: shared id and mask helpers, mask writers without
host sync |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8821?label=)
| — | — |
| #8824 Part 1b/8: PhysX tendon mask setters through the masks |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8824?label=)
| 1a |
[link](https://github.com/isaac-sim/IsaacLab/pull/8824/changes/84470f4c0c5dfe1905dd1b5d822f6faf50832d4d..2fbbcc5a98a91f34c129f1ce65b227201ec50f60)
|
| #6646 Part 2a/8: reset only the masked environments |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/6646?label=)
| 1a |
[link](https://github.com/isaac-sim/IsaacLab/pull/6646/changes/84470f4c0c5dfe1905dd1b5d822f6faf50832d4d..41ed0c0775175ad2f76db6bb9c31202d80e1519b)
|
| #8997 Part 2b/8: actuator networks reset by mask |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8997?label=)
| 2a |
[link](https://github.com/isaac-sim/IsaacLab/pull/8997/changes/41ed0c0775175ad2f76db6bb9c31202d80e1519b..cb14223b1d957f7fd8ac232ea50605618ce53de3)
|
| #8856 Part 3a/8: env origins as a ProxyArray, `SceneEntityCfg` Warp
selections |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8856?label=)
| 2a |
[link](https://github.com/isaac-sim/IsaacLab/pull/8856/changes/41ed0c0775175ad2f76db6bb9c31202d80e1519b..f8944ad680d2bb4b09b13d2adb4b740eafe7b363)
|
| #8228 Part 3b/8: ray caster camera frames as a ProxyArray, Rough
velocity tasks (re-cut not pushed yet) |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8228?label=)
| 3a | — |
| #8998 Part 4a/8: recording utilities, lazy buffers correct under
recording |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8998?label=)
| 2b, 3a |
[link](https://github.com/isaac-sim/IsaacLab/pull/8998/changes/9d74ad2de08a152312833dbe3ad9260b02f683b0..0e2a77d842051fb3946feb988f2e14d010aac3fb)
|
| Parts 4b-4h/8: the Warp frontend on the stable managers (not opened) |
— | 4a | — |
| Part 5/8: OVPhysX on the Warp frontend (not opened) | — | 4h | — |
| Part 6/8: Warp noise model with an additive bias (not opened) | — | 4h
| — |
| #7012 Part 7/8: `--video` on the Warp frontend (re-cut not pushed yet)
|
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/7012?label=)
| 4h | — |
| Part 8a/8: Direct Warp environment step (not opened) | — | 5, 7 | — |
| #6582 Part 8b/8: Shadow Hand Warp twin, Allegro twin fix (re-cut not
pushed yet) |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/6582?label=)
| 8a | — |
| #8861 [DO-NOT-MERGE] all parts combined for review |
![](https://img.shields.io/github/pulls/detail/state/isaac-sim/IsaacLab/8861?label=)
| ALL | — |

```mermaid
---
config:
  look: neo
  flowchart:
    curve: basis
---
flowchart TD
  A1("📌 <b>#8821</b> · 1a<br/>id/mask helpers")
  B1("<b>#8824</b> · 1b<br/>PhysX tendon masks")
  A2("<b>#6646</b> · 2a<br/>masked resets")
  B2("<b>#8997</b> · 2b<br/>actuator net reset")
  A3("<b>#8856</b> · 3a<br/>env origins, Warp selections")
  B3("<b>#8228</b> · 3b<br/>Rough velocity")
  A4("<b>#8998</b> · 4a<br/>recording utilities")
  P4("4b-4h<br/>Warp frontend on the stable managers")
  P5("5<br/>OVPhysX")
  P6("6<br/>noise model")
  P7("<b>#7012</b> · 7<br/>--video")
  A8("8a<br/>Direct env step")
  B8("<b>#6582</b> · 8b<br/>Shadow twin")
  A1 --> B1
  A1 --> A2
  A2 --> B2
  A2 --> A3
  A3 --> B3
  B2 --> A4
  A3 --> A4
  A4 --> P4
  P4 --> P5
  P4 --> P6
  P4 --> P7
  P5 --> A8
  P7 --> A8
  A8 --> B8
  style A1 stroke-width:3px
```

## Summary

Id and mask selections in the Newton, OVPhysX and PhysX assets, the
camera and the wrench composer resolve through main's `resolve_1d_mask`
and a new `resolve_ids`, both in `isaaclab.utils.warp.memory`, instead
of hand-written copies (−907 / +410 source lines). Newton mask writers
that converted masks to ids now write through the mask: the fixed-tendon
setters are 2.7-5.4x faster.

# Description

**Update (2026-11-12):** a Newton model-property write recorded into a
graph capture now refreshes the solver on every replay, not only the
first (`NewtonManager.add_model_change` records the refresh inside a
capture); merged main `616f517707d`.

**Update (2026-11-10):** a mask longer than its destination raises
instead of being written past the end (the Newton fixed-tendon writer
launches over the mask), and the PhysX and rigid-object selection
docstrings say ids come first, as `resolve_ids` does. The
`all_ids=slice(None)` form of `resolve_ids` leaves this PR for the part
that first uses it.

## 1. Changes

1. **Helpers** (`isaaclab/utils/warp/memory.py`, next to main's
`resolve_1d_mask`): new `resolve_ids` (ids or a boolean mask → ids on
the device of the caller's all-ids array; callers that need contiguous
int32 ids pass the result through main's `resolve_1d_indices`, as main's
indexed writers do). `resolve_1d_mask` takes `scratch_mask` as optional
again: a mask passed without one is used as given when it is not longer
than the destination, so a shorter mask writes only the rows it covers,
as main's Newton mask writers do; a longer mask raises with or without a
scratch mask. New `write_2d_with_mask` writes a scalar or a 2-D array
into a buffer where an env mask and an item mask are both true,
launching main's masked copy and fill kernels over the mask lengths on
the output's device (torch vector data with strided components goes
through scalar views, without a copy); the Newton articulation and
collection mask writers use it.
2. **All assets, `Camera` and `WrenchComposer` use them**, so every
selection accepts the same inputs: integer sequences, negative-step
slices, ids on another device. A `ProxyArray` raises `TypeError`.
3. **Newton writes without a host sync:** the fixed-tendon mask setters
write through the masks; joint-coordinate writes reuse a scratch mask.
The `RigidObjectCollection` mask writers (main's, since #8870) launch
over the mask lengths like the other Newton mask writers, so a mask
shorter than the asset dimension writes only the rows it covers.
4. **Fixes:** the deformable `write_nodal_*_to_sim_mask` writers raised
whenever `env_mask` was given (OVPhysX, PhysX); the Newton fixed-tendon
mask setters accepted data of the wrong shape; a Newton model-property
write recorded into a graph capture (such as the fixed-tendon mask
writer, now capturable) left the solver on the first replay's values,
because `NewtonManager.add_model_change` only queued the refresh on the
host.

## 2. Performance (MEASURED)

8gpu L40, Newton contract mocks, 4096 envs, host µs per call including
the GPU wait, main `299af193136` against this PR
at `b75b5a81585` (same source as the head but for main's #8971), 3
alternated runs per arm.

| Write | main | this PR | |
|---|---|---|---|
| Fixed-tendon stiffness mask, half envs, 2 tendons | 455 | 84 | 5.4x |
| Fixed-tendon position limit mask, all | 216 | 80 | 2.7x |
| Fixed-tendon position limit mask, half envs, 2 tendons | 393 | 84 |
4.7x |
| `write_fixed_tendon_properties_to_sim_mask`, all | 373 | 124 | 3.0x |
| `write_fixed_tendon_properties_to_sim_mask`, half envs, 2 tendons |
573 | 127 | 4.5x |
| Joint position index write, half envs | 290 | 249 | 1.17x |
| Joint state index write, half envs | 321 | 281 | 1.14x |
| Joint position mask write; collection pose and velocity mask writes |
| | within ±1% |

## Type of change

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)

## Screenshots

Not applicable.

## 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
`uv run isaaclab --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have validated the changed behavior with focused coverage and
applied the [test-audit
criteria](https://github.com/isaac-sim/IsaacLab/blob/HEAD/skills/developer/test-audit/SKILL.md)
to any test changes
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump package versions — CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants