Skip to content

[Newton] Redesign Newton Manager [2e/N] - #8737

Closed
StafaH wants to merge 9 commits into
isaac-sim:mainfrom
StafaH:newton/redesign-2e-step-graph
Closed

StafaH wants to merge 9 commits into
isaac-sim:mainfrom
StafaH:newton/redesign-2e-step-graph

Conversation

@StafaH

@StafaH StafaH commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

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 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 (this PR) Run each Newton step as one step graph

The PRs target main, so each one also shows the commits of the stages below it until they merge. Review only
this PR's own commit:
c3477e692 Run each Newton step as one step graph.

What this PR does

Each NewtonManager.step() launches one StepGraph covering the step's physics steps:
collide -> control callbacks -> Newton actuators -> post-actuator callbacks -> substeps -> post-step callbacks -> sensors. Consecutive graphable operations replay from one CUDA graph; work that cannot be captured (TorchScript/LSTM
actuators, eager callbacks) runs in place between captured segments.

  • isaaclab.utils.StepGraph / StepOp, and NewtonActuatorAdapter.zero_outputs, reset_dofs, state_buffers and
    computed_effort so the step graph can run Newton actuators over the model's flat DOF space.
  • Named step callbacks returning handles: register_pre_step_callback, register_control_callback,
    register_post_actuator_callback, register_state_force_callback, register_post_step_callback, and
    unregister_step_callback(handle).

The environment still decides the decimation loop as on main (the Newton step folds it only when Newton actuators
run inside the step). Resets, MDP terms and capture of the environment step are untouched (later PRs).

Type of change

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

Migration

Before Now
activate_newton_actuator_path() activate_actuators()
register_pre_actuator_callback(fn) register_control_callback(fn)
unregister_post_step_callback(fn) unregister_step_callback(handle) with the handle from register_post_step_callback

Testing

Full sweep: no file regresses against main. All 32 Newton environments, the 14 Kit-free contrib environments and
the 31 OVPhysX environments run. Not run: Kit-only tests and the GB300, Rizon coffee and teapot examples.

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

The simulation registry owns the shared builder and the NewtonBackend
again, as on main. Consumers request them with
sim.get_or_create_backend(NewtonBuilderCfg(...)) and NewtonBackendCfg(...),
so the get_newton_builder, get_newton_backend and create_newton_backend
helpers are gone. NewtonBackendCfg.class_type is NewtonBackend, which
takes the cfg, an optional builder and the physics dt.

Managers are no longer constructed standalone: NewtonManager() takes no
arguments and reads its configuration, device and timestep from the
attached simulation, like the other physics managers. This removes the
lazy cfg and builder properties and the get_physics_dt override.
Independent backends remain possible by constructing NewtonBackend
directly from a builder.
Drop the deprecation shims instead of carrying them: get_model,
get_state_0, get_state_1, get_control, get_contacts, get_solver,
get_num_envs, get_dt, get_solver_dt, cl_register_site and
add_frame_transform_sensor. Callers read the NewtonBackend fields and
use register_site; the changelog lists each removal as breaking with its
replacement.
NewtonBuilderCfg and NewtonBackendCfg move from newton_manager_cfg to
newton_builder_cfg and newton_backend_cfg, following the x.py/x_cfg.py
layout used across Isaac Lab.
Restore main code that the backend move did not have to touch: the
manager close order, decimation guards, docstrings and the visualizer
test. Shorten the step-callback comments, and bind the model, state and
control once in the asset data simulation bindings.
@StafaH
StafaH force-pushed the newton/redesign-2e-step-graph branch from 9581177 to c3477e6 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 commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

Folded into #8736.

@StafaH StafaH closed this Nov 2, 2026
StafaH added a commit that referenced this pull request Nov 6, 2026
# Description

Part 2d of the Newton manager redesign
([overview](#8218 (comment))).
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

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

1 participant