Skip to content

[Newton] Redesign Newton Manager [2d/N] - #8736

Merged
StafaH merged 14 commits into
isaac-sim:mainfrom
StafaH:newton/redesign-2d-captured-runtime
Nov 6, 2026
Merged

StafaH merged 14 commits into
isaac-sim:mainfrom
StafaH:newton/redesign-2d-captured-runtime

Conversation

@StafaH

@StafaH StafaH commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Part 2d of the Newton manager redesign (overview).
Follows [2c-iii/N] #8884 (merged) and folds in [2e/N] #8737. Builds on @maxkra15's captured-runtime work and its
regression coverage.

Newton's step folds the decimation loop even when some actuators cannot be captured, and the step, BVH refits, sensor
queries and derived asset data work inside a CUDA graph recorded by a caller, such as a whole environment step. Capture follows the Warp, Newton and MuJoCo Warp examples: Warp owns the capture
(wp.ScopedCapture / wp.capture_launch), Torch actuators that are not graphable stay eager, and Warp's blocking
stream orders work with Torch's default stream.

Changes

  • Step around the Newton actuators. Each physics step runs _before_actuators() (solver pre_step, collision,
    pre-actuator callbacks), the Newton actuators, then _after_actuators() (post-actuator callbacks, solver substeps);
    _finish_step() runs post-step callbacks and sensors once. With capture-safe actuators the whole decimation loop
    replays from one graph, as before. Actuators that cannot be captured (Torch networks) now run eagerly between captured
    _before_actuators and _after_actuators graphs instead of disabling the folded loop, so handles_decimation()
    holds whenever Newton actuators run in the step. Registering a callback or reallocating contacts captures again.
  • Record into an enclosing capture. NewtonBackend.step, refit_bvh, the Newton Warp renderer and the ray caster
    record their work into a caller's capture instead of starting or replaying their own graph. Recorded BVH refits run
    on every replay, because replays cannot consult host timestamps. Solver status checks run only outside capture.
  • Live derived data. NewtonBackend.live is true during a step and while a graph is recorded. Derived asset
    properties (link velocities, COM poses, heading, projected gravity, body-frame velocities, state concatenations)
    recompute on read in that interval, so step callbacks see the current substep and replays refresh them. Outside it
    the timestamp caches apply as before. This replaces the capture_unsafe guards that raised during capture.
  • Model changes before state reads. Queued model-property edits reach the solver at the next forward(),
    scene-data state read or step, through NewtonBackend.notify_model_changes. Fixed-root pose writes queue their edit
    instead of notifying the solver on every write.
  • View rows map to worlds. invalidate_fk maps articulation-view rows to worlds through
    model.articulation_world, so views over a subset or reordering of worlds reset the right worlds, and global
    articulations get FK without resetting the global world.

Performance

RTX PRO 6000 Blackwell, Warp 1.17.0, main at e44437edc. 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 this PR change
Cartpole 2.65M 2.61M −1.5%
Flat ANYmal-D 254.1k 260.8k +2.6%
Flat Go2 (Newton actuators in the step) 769.0k 768.3k 0%

This PR enables, rather than delivers, the larger gain: capturing the whole environment step, recorded by the caller,
in a later stage.

Testing

Targeted tests pass, run file by file: Newton manager, solvers, VBD, MJWarp tendon control, MPM reset masks,
coupler and custom coupling, visualization state, articulation and rigid object contracts, articulation, rigid object,
cable, joint coordinates, Newton actuators, BAM actuator, MPM object, contact sensor, frame transformer, ray caster,
IMU, cloner and the visualizer adapter. New coverage includes the decimation order with capture-safe and eager actuators, an outer capture of two backends side by side, FK over
reordered view rows with a global articulation, and a derived heading refreshed inside a replayed step.

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

@StafaH StafaH added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Oct 19, 2026
@StafaH
StafaH force-pushed the newton/redesign-2d-captured-runtime branch from d816383 to 138cda6 Compare October 23, 2026 05:36
StafaH added a commit that referenced this pull request Oct 26, 2026
# Description

Part of the Newton manager redesign (overview with API examples:

#8218 (comment)).
[1/N] #8711 (merged) made physics managers
instances owned by the simulation as `sim.backend_manager`. The former
[2/N] #8712 is split into five stacked PRs:

| PR | Stage |
|---|---|
| [2a/N] **#8733 (this PR)** | Move Newton simulation data onto
NewtonBackend |
| [2b/N] #8734 | Describe Newton solvers with solver specifications |
| [2c/N] #8735 | Move Newton manager logic into backend functions |
| [2d/N] #8736 | Capture Newton model changes and Torch work in the step
|
| [2e/N] #8737 | Run each Newton step as one step graph |

This PR is the bottom of the stack and targets `main` directly.

## What this PR does

Newton's `Model` stays the immutable description (like `mjModel`).
**`NewtonBackend`** becomes the mutable data bound
to one finalized model (like `mjData`): state, control, solver,
collision pipeline, contacts, sensors, Newton actuators
and reset masks. The manager reads and writes `backend.*` instead of
private fields, and a hard reset closes the
backend and finalizes a new one.

- The simulation registry still owns the builder and backend: consumers
call
`sim.get_or_create_backend(NewtonBuilderCfg(...))` /
`sim.get_or_create_backend(NewtonBackendCfg(...))` as before.
`NewtonBackendCfg.class_type` is `NewtonBackend`, constructed through
`instantiate`.
- Replication outputs (`NewtonCloneRecord`, site index map, world
transforms, source builders) are read through
manager accessors instead of private fields; site and extended-attribute
requests persist on the builder across hard
  resets, so sensors no longer re-register them.
- `add_contact_sensor` / `add_imu_sensor` return the Newton sensor.
- `NewtonBuilderCfg` and `NewtonBackendCfg` move into their own
`newton_builder_cfg.py` / `newton_backend_cfg.py`.
- The per-solver manager subclasses and their hooks are unchanged apart
from operating on the backend.

## Type of change

- Breaking change. No deprecation shims: removed APIs are listed below
with their replacements.

## Migration

| Before | Now |
|---|---|
| `manager.get_model()`, `get_state_0()`, `get_state_1()`,
`get_control()`, `get_contacts()` | `manager.backend.model`, `.state_0`,
`.state_1`, `.control`, `.contacts` |
| `manager._solver`, `_contacts`, `_collision_pipeline`, `_adapter`,
`_world_reset_mask`, `_fk_reset_mask`, `kinematics_dirty` |
`backend.solver`, `.contacts`, `.collision_pipeline`, `.actuators`,
`.world_mask`, `.fk_mask`, `.kinematics_dirty` |
| `get_num_envs()`, `get_dt()`, `get_solver_dt()` |
`backend.model.world_count`, `backend.dt`, `backend.solver_dt` |
| `cl_register_site(...)` | `register_site(...)` |
| `add_frame_transform_sensor(...)` | construct
`newton.sensors.SensorFrameTransform` on `backend.model` |
| `add_contact_sensor` / `add_imu_sensor` returning a key or index |
both return the Newton sensor |
| private replication fields (`_cl_site_index_map`, `_world_xforms`,
`_cl_protos`, ...) | `get_site_index_map()`, `get_world_xforms()`,
`get_clone_source_builders()`, `get_clone_record()` |
| `from isaaclab_newton.physics.newton_manager_cfg import
NewtonBuilderCfg, NewtonBackendCfg` | `from isaaclab_newton.physics
import NewtonBuilderCfg, NewtonBackendCfg` |
| sensors re-registering sites / `body_qdd` on `STOP` | not needed;
requests persist on the builder |

## Testing

Every test file in its own process without Isaac Sim (Kit), compared
with `main`: no file has more failures or fewer
passes, apart from two tests removed with the deprecated accessors.
Remaining failures also fail on `main` or need
missing extras (Kit launcher tests, rl_games/sb3, `rerun`). Not run:
Kit-only tests and the GB300, Rizon coffee and
teapot examples.

## Checklist

- [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
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added changelog fragments

---------

Co-authored-by: Maximilian Krause <[email protected]>
@StafaH
StafaH marked this pull request as ready for review November 2, 2026 22:53
@github-actions github-actions Bot added isaac-mimic Related to Isaac Mimic team infrastructure labels Nov 2, 2026
@StafaH

StafaH commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

run-ci

@StafaH StafaH mentioned this pull request Nov 5, 2026
3 tasks done
The cache checks compare against _sim_timestamp as on main; the stamp now folds in the backend state version, and the plain simulated time used for finite differencing moves to _sim_time.
_sim_timestamp is the plain simulated time again, as on main. Derived-data caches compare against _state_version, which every step and FK advance, so simulated time adds nothing to the key.
Type the graph keys, keep public backend methods before private ones, drop an unused test stub attribute, and fix stale callback names in a test and the changelog.
@StafaH

StafaH commented Nov 5, 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 5, 2026

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

I'm not sure about the names of some methods actuator vs control, step_1 and step_2. The timestamps are not timestamps anymore for newton, but they still are for physx and ovphysx? Maybe we should also move all of them to this system in a future PR? If so can we open an issue so that we do not loose track of it?

Keep the pre_actuator/post_actuator callback names from main, since the hooks are defined by where they run relative to the Newton actuators. Rename _step1/_step2 to _before_actuators/_after_actuators.
@StafaH

StafaH commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

@AntoineRichard Renamed in 5b11365: the callbacks keep the pre_actuator/post_actuator names from main (no rename anymore), and _step1/_step2 are now _before_actuators/_after_actuators.

@maxkra15

maxkra15 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

At examples/tablecloth.py:1376, looks like this call got missed in the rename. register_post_control_callback no longer exists, so the example raises AttributeError here. Could we switch this to register_post_actuator_callback too?

@StafaH

StafaH commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

@maxkra15 Good catch, fixed in 40e7a64.

@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 6, 2026
@maxkra15
maxkra15 self-requested a review November 6, 2026 00:37
@maxkra15
maxkra15 self-requested a review November 6, 2026 00:47
@maxkra15

maxkra15 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

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 6, 2026
@StafaH
StafaH merged commit b3ef9ce into isaac-sim:main Nov 6, 2026
69 of 91 checks passed
StafaH added a commit that referenced this pull request Nov 6, 2026
# Description

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

`NewtonSolver` was a class that was never instantiated: every call
passed the solver configuration and Newton's solver
back in, e.g. `cfg.class_type.pre_step(cfg, solver, state)`. It is now a
driver built once from its configuration and
model, so the backend calls `backend.solver_ops.pre_step(state)`.

## Changes

- **`NewtonSolver(cfg, model, mode, env_template)`** stores `cfg` and
builds Newton's solver into `native` through the
overridable `build(model, mode, env_template)`. Per-solver methods
(`init_state`, `pre_step`, `step`, `post_step`,
`reset`, `eval_fk`, `check_step`, contact and capture queries) are
instance methods, and each driver narrows `cfg`
  to its configuration type.
- **Configuration-level hooks stay classmethods** (`solver_classes`,
`prepare_builder`, `applied_deterministic_mode`,
`shares_materials`, `coupling_error`, `fixed_tendon_control`): they need
no built solver.
- **`NewtonBackend.solver_ops`** holds the driver;
`NewtonBackend.solver` stays Newton's solver.
- **Couplers hold their entries' drivers.** `CouplerSolver` keeps one
driver per entry and `CoupledMJWarpVBDSolver`
keeps its rigid and soft drivers, instead of re-deriving them from
configurations and `solver.solver(name)`.
- MJWarp, Kamino, MPM, VBD, the coffee-task MPM solver, the teapot
example's coupler and the Newton visualizer
  follow the new API.

## Breaking

Custom solvers override `build(self, model, mode, env_template)` and
instance methods such as `pre_step(self, state)`,
reading `self.cfg` and `self.native`. Code that called
`cfg.class_type.<method>(cfg, solver, ...)` calls
`backend.solver_ops.<method>(...)`.

## Validation

Targeted tests, one file at a time: `test_newton_manager.py` (50),
`test_newton_solvers.py` (36), `test_vbd_core.py`
(8), `test_mpm_reset_mask_contract.py` (4),
`test_mjwarp_tendon_control.py` (10), `test_coupler.py` (66),
`custom_coupling/test_manager.py` (9), `test_articulation.py` (42),
`test_rigid_object.py` (22), asset contract tests
(296 + 146), all passing.

## Type of change

- Breaking change (existing functionality will not work without user
modification)

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the `pre-commit` checks with `./isaaclab.sh --format`
- [x] I have added changelog fragments under each touched package's
`changelog.d/`
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 infrastructure isaac-lab Related to Isaac Lab team isaac-mimic Related to Isaac Mimic team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants