Skip to content

[Newton] Redesign Newton Manager [2b/N] - #8734

Merged
StafaH merged 13 commits into
isaac-sim:mainfrom
StafaH:newton/redesign-2b-solver-specs
Oct 27, 2026
Merged

StafaH merged 13 commits into
isaac-sim:mainfrom
StafaH:newton/redesign-2b-solver-specs

Conversation

@StafaH

@StafaH StafaH commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Part 2b of the Newton manager redesign (overview).
Builds on [2a/N] #8733 (merged), which moved Newton's simulation data onto NewtonBackend.

Summary

There is now one NewtonManager and one generic solver path for every Newton solver. The six per-solver manager
subclasses (NewtonMJWarpManager, NewtonVBDManager, ...) are gone. What differs per solver lives in a small,
stateless Isaac Lab solver class (MJWarpSolver, XPBDSolver, ...) that the solver
configuration selects through class_type. Newton's solver is never wrapped: backend.solver is Newton's solver.

Why: most of what Isaac Lab does with a solver is the same for all of them: build it from its config, step it,
reset masked worlds, run forward kinematics, collide with Newton's CollisionPipeline. The manager's own job
(lifecycle, builder, hard reset, callbacks) doesn't depend on the solver at all. So:

  • NewtonSolver holds that generic path as class methods taking the config and Newton's solver; a subclass
    overrides only where its solver differs;
  • XPBD and Featherstone are three-line classes;
  • the solver classes hold no state, so Newton's solver is the only solver object;
  • a coupler builds each entry through that entry's own config. CouplerCfg.outer_contact_entry limits the outer
    collision pipeline to one entry's shape pairs.

Before and after

# Choosing a solver: unchanged
sim_cfg = SimulationCfg(physics=NewtonCfg(solver_cfg=MJWarpSolverCfg()))
sim.backend_manager                 # always a NewtonManager
sim.backend_manager.backend.solver  # Newton's SolverMuJoCo: unchanged

# A simple solver, before: a manager subclass. Now: a solver class and its config.
class XPBDSolver(NewtonSolver):
    solver_class = SolverXPBD
    deterministic = True

@configclass
class XPBDSolverCfg(NewtonSolverCfg):
    class_type: type | str = "{DIR}.xpbd_solver:XPBDSolver"
    iterations: int = 2

# The manager calls them with the config and Newton's solver.
solver_cls = solver_cfg.class_type
backend.solver = solver_cls.build(solver_cfg, model, mode)
solver_cls.reset(solver_cfg, backend.solver, backend.state_0, backend.world_mask)

# A custom solver, before: subclass a manager and override its hooks. Now: subclass the solver.
class MyMPMSolver(MPMSolver):
    @classmethod
    def build(cls, cfg, model, mode, env_template=None):
        return MyMPM(model, mpm_solver_config(cfg))

What differs between solvers

Solver Overrides
XPBD, Featherstone nothing (Featherstone warns that it ignores inertia changes)
VBD builder coloring, BVH rebuild before and joint IK after each step
MJWarp MuJoCo contacts, warm-start reset, sensors off under determinism, tendon control
Kamino loop-closure FK through its reset, optional internal collision detector
MPM in-place stepping, collider projection, no per-world reset, grid capture check
Couplers build each entry's solver through the entry's own config

Breaking changes

There are no deprecation shims. Each removal is listed in the changelog with its replacement.

Removed Use instead
NewtonMJWarpManager, NewtonXPBDManager, NewtonVBDManager, NewtonFeatherstoneManager, NewtonKaminoManager, NewtonMPMManager NewtonManager; the solver config's class_type selects MJWarpSolver, XPBDSolver, ...
NewtonSolverCfg.class_type selecting a manager it selects the NewtonSolver; a custom manager goes on NewtonCfg.class_type
Overriding _build_solver, _step_solver, ... Override build, step, reset, ... on a NewtonSolver subclass
NewtonManager.create_builder isaaclab_newton.physics.create_builder
NewtonManager.create_fixed_tendon_control(articulation) NewtonSolver.fixed_tendon_control(cfg, articulation, model)
NewtonMPMManager.reset_solver_state reset_mpm_solver_state(backend, ...)
Contrib NewtonCouplerManager, NewtonCoupledMJWarpVBDManager CouplerSolver, CoupledMJWarpVBDSolver; override CouplerSolver.build_coupled for a custom coupled solver
Modules mjwarp_manager, xpbd_manager, ..., *_manager_cfg *_solver / *_solver_cfg; import from isaaclab_newton.physics

Behavior changes

  • VBD's per-step preparation runs in both stepping paths, and VBD registers its Newton custom builder attributes.
  • When determinism is requested, MJWarp is built with its sensor stage disabled instead of raising, and the config is no
    longer modified. Tasks whose sensors need attributes only that stage fills (IMU/PVA body_qdd, joint wrench
    body_parent_f) still raise.
  • MJWarp with use_mujoco_cpu=True steps eagerly instead of capturing a CUDA graph.
  • NewtonCfg.collision_cfg is rejected for any solver that does not use Newton's collision pipeline: MJWarp with
    MuJoCo contacts (as before), Kamino with its own collision detector, and MPM.
  • NewtonCfg.class_type=None raises; omit it to use NewtonManager.
  • Couplers forward NewtonCfg.debug_mode diagnostics to their entries' solvers.
  • A coupler without proxies steps its entries independently; a coupled MPM entry that doesn't step in place raises.
  • Coupler {ENV_REGEX_NS} selectors expand against the environment template the manager passes in, not a global.

Testing

Targeted tests pass on the branch merged with current main: manager abstraction (106), coupler (66), coupler
runtime, custom coupling, contrib coupling environments without Isaac Sim, VBD core, MPM reset contract and spawners,
MJWarp tendon control, cloner, visualization state, the Newton visualizer tests, and the articulation contract
(-k newton). The GB300, Rizon coffee, teapot and coupled MJWarp/VBD solvers resolve. Tests that need Isaac Sim
(test_manual_coupling, test_newton_solver_reset, test_newton_fabric_body_sync, MPM rendering) were 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

@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-2b-solver-specs branch from be11c09 to 7b63601 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 force-pushed the newton/redesign-2b-solver-specs branch from 7b63601 to 9c4ba52 Compare October 27, 2026 01:43
@StafaH
StafaH marked this pull request as ready for review October 27, 2026 01:43
@StafaH
StafaH requested a review from a team October 27, 2026 01:43
@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 2/5

[High impact] The redesign reaches Newton simulation and coupling workflows across Isaac Lab.

Fix contact growth and custom solver construction before merging.

Findings

  1. P1 Contact growth breaks reset ▶
  2. P1 Custom solver selections are ignored ▶
  3. P1 Custom VBD constructors can fail ▶
  4. P2 API summary names removed module ▶

Summary

This PR replaces per-solver managers with one NewtonManager driven by solver configurations.

  • One Newton manager drives every solver through its configuration.
  • Couplers build each entry through its own solver configuration.
  • Inherited class variables stay out of configuration fields.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[SimulationContext] --> B[NewtonManager]
    B --> C[NewtonBackend]
    C --> D[Resolved solver configuration]
    D --> E[Newton solver]
    D --> F[Contacts and collision pipeline]
    D --> G[Step and reset methods]
    H[Coupler configuration] --> I[Entry configurations]
    I --> J[Entry solvers]
    J --> K[Newton coupled solver]
    D -. may be .-> H
Loading

Reviews (1) · Last reviewed commit: "Describe Newton solvers by their configu..." · Reviewed by Greptile

Comment on lines +836 to +838
backend.collision_pipeline = solver_cfg.create_collision_pipeline(
model, solver, **args, rigid_contact_max=required
)

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 Contact growth breaks reset

With deterministic physics and MJWarpSolverCfg(use_mujoco_contacts=False), reset fails when MuJoCo needs more contacts than the pipeline allocated and collision_cfg is set. to_pipeline_args() already includes rigid_contact_max, even when it is None. Passing **args alongside rigid_contact_max=required therefore raises TypeError.

Set args['rigid_contact_max'] = required before rebuilding the pipeline.

Suggested change
backend.collision_pipeline = solver_cfg.create_collision_pipeline(
model, solver, **args, rigid_contact_max=required
)
args["rigid_contact_max"] = required
backend.collision_pipeline = solver_cfg.create_collision_pipeline(model, solver, **args)

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.

Fixed: the rebuild sets rigid_contact_max in the args, and the test covers a configured pipeline.

Comment on lines +185 to +190
kwargs = solver_kwargs(SolverMuJoCo, self, mode)
# ls_parallel is deprecated in newton; forwarding it (even as False) emits a warning.
kwargs.pop("ls_parallel", None)
if deterministic:
kwargs["disable_sensors"] = True
return SolverMuJoCo(model, **kwargs)

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 Custom solver selections are ignored

MJWarpSolverCfg.build() ignores solver_class and always constructs SolverMuJoCo. _KaminoSolverCfgBase.build() likewise always constructs SolverKamino. A configuration subclass that selects a custom solver silently runs the stock solver instead, even though solver_classes() registers attributes for the selected class.

Resolve solver_class in both builders and use the selected class for construction and argument filtering.

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.

Fixed: both build solver_class.

Comment on lines +95 to +96
if self.rigid_compliant_alm is None:
del kwargs["rigid_compliant_alm"]

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 Custom VBD constructors can fail

VBDSolverCfg.build() deletes rigid_compliant_alm even when solver_kwargs() has filtered it out. A custom SolverVBD subclass can expose a narrower constructor, such as (model, iterations=10), and choose the remaining settings itself. With the default rigid_compliant_alm=None, this raises KeyError before constructing the solver.

Use kwargs.pop('rigid_compliant_alm', None) so an already-filtered argument is safe.

Suggested change
if self.rigid_compliant_alm is None:
del kwargs["rigid_compliant_alm"]
if self.rigid_compliant_alm is None:
kwargs.pop("rigid_compliant_alm", None)

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.

Fixed: pop(..., None).

@@ -13,20 +13,19 @@ full Isaac Lab installation containing :mod:`isaaclab_tasks`.
.. autosummary::

newton_manager_cfg.CoupledMJWarpVBDSolverCfg

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.

P2 API summary names removed module

The class list still names newton_manager_cfg.CoupledMJWarpVBDSolverCfg, but this PR removes that module. The detailed class entry uses the new path correctly. The stale summary entry produces an import warning and a broken link when Sphinx builds the documentation.

Update the class list to coupled_mjwarp_vbd_solver_cfg.CoupledMJWarpVBDSolverCfg too.

Suggested change
newton_manager_cfg.CoupledMJWarpVBDSolverCfg
coupled_mjwarp_vbd_solver_cfg.CoupledMJWarpVBDSolverCfg

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

Fixed.

@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: Design and architecture (1), Scope and over-engineering (1), API (1), Compatibility and deprecation (5), Implementation (2), Style consistency (3), Test quality (2).

  • PR description: The body overstates collision_cfg rejection: Kamino-internal and MPM paths ignore it; qualify MJWarp determinism because required sensor attributes still raise, and add CouplerCfg.outer_contact_entry to the summary.
  • Design and architecture: The generic manager still branches on MJWarp-only use_mujoco_cpu semantics; move deterministic-mode resolution behind a NewtonSolverCfg capability method.
  • Scope and over-engineering: Minimal implementation: keep NewtonManager; keep newton_builder.py and mpm_solver.py as functional owners; keep the custom coupled solver and its separate configuration module for runtime state and import isolation, but remove duplicated bound-contact state. Suggested PR breakdown: (1) configclass ClassVar fix; (2) Newton manager, config, builder, and MPM migration; (3) contrib coupling and custom solver; (4) tasks, examples, documentation, and focused validation.
  • API: The custom-coupling autosummary still references deleted newton_manager_cfg; point it to coupled_mjwarp_vbd_solver_cfg so documentation builds resolve the public class.
  • Compatibility and deprecation: Breaking changes: public managers, modules, class_type, builder, tendon, reset helpers, and class_type=None behavior lack deprecation bridges; keep old contracts functional with targeted warnings, migration guidance, and transition tests.
  • Implementation: Internal-contact Kamino and MPM paths accept collision_cfg but never use it; reject collision_cfg whenever uses_collision_pipeline() is false.
  • Style consistency: MJWarp determinism now forces sensors off, but its field and NewtonCfg documentation still require callers to set the flag; document the actual automatic behavior.
  • Test quality: Remove the duplicated contact-sensor and inherited capability assertions, plus the ClassVar inheritance check already owned by the focused configclass regression test.

Significant concerns. Posted 15 inline findings.

Automated review; human maintainers own approval decisions.

"CouplerEntryCfg",
"CouplerProxyMappingCfg",
"CouplerProxyCfg",
"NewtonCouplerManager",

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.

🔴 Critical · Compatibility — Coupler manager exports removed abruptly

NewtonCouplerManager, NewtonCoupledMJWarpVBDManager, and custom_coupling.newton_manager_cfg vanish with no transition. Keep deprecated aliases and the old module importable for the prescribed cycle.

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.

Intentional: no shims in this series. The removal is marked Breaking in the changelog with its replacement.

"NewtonCfg",
"NewtonCloneRecord",
"NewtonCollisionPipelineCfg",
"NewtonFeatherstoneManager",

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.

🔴 Critical · Compatibility — Removed solver managers lack deprecation

The six per-solver manager classes and their modules are deleted outright, so existing imports and subclasses fail immediately. Keep deprecated aliases and forwarding modules that warn with replacement and removal guidance for the supported window.

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.

Intentional: no shims in this series. The removal is marked Breaking in the changelog with its replacement.

self._clone: NewtonCloneRecord | None = None
self._active_extended_state_attributes: set[str] = set()
self.views.clear()
self._solver_specific_clear()

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.

🔴 Critical · Compatibility — Manager helper methods removed without bridges

create_builder, create_fixed_tendon_control, and NewtonMPMManager.reset_solver_state disappear, breaking existing callers and changing the reset receiver from manager to backend. Retain deprecated delegates to the replacement functions.

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.

Intentional: no shims in this series. The removal is marked Breaking in the changelog with its replacement.

model, solver, solver_cfg = backend.model, backend.solver, backend.solver_cfg
if not solver_cfg.uses_collision_pipeline(solver):
backend.contacts = solver_cfg.create_contacts(solver)
if backend.contacts is not None and self._cfg.collision_cfg is not None:

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.

🔴 Critical · Implementation — collision_cfg silently ignored for some solvers

The rejection runs only when create_contacts() returns a buffer, so Kamino with its internal detector and MPM accept collision_cfg and discard it. Raise whenever uses_collision_pipeline() is false.

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.

Fixed: rejected whenever the solver does not use the collision pipeline.

.. _Newton documentation: https://newton.readthedocs.io/en/latest/
"""

class_type: type[NewtonManager] | str = "{DIR}.newton_manager:NewtonManager"

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.

🔴 Critical · Compatibility — NewtonSolverCfg.class_type removed abruptly

Custom solver configurations setting class_type now fail or are silently ignored. Keep the field functional for one deprecation cycle, translating it to solver_class or NewtonCfg.class_type with a targeted warning.

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.

Intentional: no shims in this series. The removal is marked Breaking in the changelog with its replacement.

# ls_parallel is deprecated in newton; forwarding it (even as False) emits a warning.
kwargs.pop("ls_parallel", None)
if deterministic:
kwargs["disable_sensors"] = True

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.

🟡 Warning · Style Consistency — disable_sensors docs contradict behavior

build now forces disable_sensors=True under a determinism guarantee, but this field's docstring and NewtonCfg.deterministic_mode still instruct callers to set it themselves. Update both.

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.

Fixed: the docs describe the automatic disable.

# no Newton setting applies -- report the request rather than dropping it silently.
if getattr(solver_cfg, "use_mujoco_cpu", False):
if cfg.deterministic or cfg.deterministic_mode != "not_guaranteed":
if getattr(cfg.solver_cfg, "use_mujoco_cpu", False):

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.

🟡 Warning · Design Architecture — Manager branches on MJWarp-only field

_resolve_deterministic_mode duck-types use_mujoco_cpu, keeping one solver's semantics in the generic manager. Express this through a NewtonSolverCfg method overridden by MJWarpSolverCfg.

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.

Fixed: moved behind applied_deterministic_mode, overridden by MJWarp.

# Building blocks — used by _simulate_full / _simulate_physics_only
# ------------------------------------------------------------------

def _prepare_step(self) -> None:

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.

🟡 Warning · Style Consistency — Inline one-line _prepare_step wrapper

_prepare_step only forwards to backend.solver_cfg.pre_step(backend.solver, backend.state_0), and both callers already bind backend. Inline it at the two call sites.

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.

Inlined.

Auto-set in :meth:`__post_init__` from :attr:`solver_cfg.class_type`.
Users normally do not set this directly.
"""
class_type: type[NewtonManager] | str = "{DIR}.newton_manager:NewtonManager"

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.

🟡 Warning · Compatibility — class_type=None no longer re-derived

__post_init__ previously rejected explicit values, so downstream presets pass class_type=None through replace(). That None now reaches instantiation unchecked. Reject or re-derive it.

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.

Fixed: None now raises clearly; omit it for the default manager.

NewtonMJWarpManager(NewtonCfg())._validate_deterministic_solver_cfg(
CustomSolverCfg(**solver_cfg_kwargs), wp.DeterministicMode.GPU_TO_GPU
)
assert CustomSolverCfg().deterministic is True

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.

🟡 Warning · Test Quality — Test asserts Python ClassVar inheritance

CustomSolverCfg().deterministic is True only checks that a subclass inherits a ClassVar, which is Python behavior; the deterministic rejection test already owns the contract. Remove it.

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.

Removed.

env_template: Environment path template of the clone plan, e.g. ``"/World/envs/env_{}"``.
"""
self.cfg = cfg
self.native: SolverBase = self.build_native(model, mode, env_template)

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.

newton solver holds only cfg and native?

@StafaH StafaH Oct 27, 2026 •

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.

Agreed, removed the wrapper. backend.solver is Newton's solver again; NewtonSolver is now only stateless class methods taking the config and Newton's solver.

articulation.write_fixed_tendon_properties_to_sim_mask()
scene.step("tendon")

solver_model = scene.sim.backend_manager.backend.solver.mjw_model

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.

currently the native feels like a shim

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.

Removed: .native is gone and backend.solver is the Newton solver.

wp.copy(state.body_qd, model.body_qd)
wp.copy(state.body_q, wrapped, dest_offset=cable_body_start, count=len(wrapped_xforms))
state.body_f.zero_()
backend.solver.reset(backend.state_0, flags=0)

@ooctipus ooctipus Oct 27, 2026 •

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.

have you consider an alternative functional option that does

class NewtonSolverFunctions:

    @classmethod
    def reset(solver, state, flag)

newton_solver_functions.reset(backend.solver, backend.state_0, flags=0)

versus

backend.solver.native.reset(backend.state_0, flags=0)

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.

Went with this in 03efc9e: solver_cfg.class_type.reset(solver_cfg, backend.solver, state, world_mask). This line is back to backend.solver.reset(...).

The backend holds Newton's solver directly again. Each solver configuration's
class_type selects a NewtonSolverFunctions subclass whose class methods take
the configuration and Newton's solver, so Isaac Lab no longer wraps it.

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

Experimental review tooling 🤖

Snapshot review: This run reviewed 03efc9e1ffda92d794470879b053eca199b0f04b. The PR advanced to e261242a4d39d8bdbe898a730c87ee0cac8e5996 before publication; newer commits are outside this run's scope, and findings may already be addressed there. Comments are attached to the reviewed commit.

Thanks for opening this PR to IsaacLab! We're currently experimenting with automated review tooling, and we'd appreciate a little human time to review the review! The reviewer is under review, too.

Please reply with feedback on useful findings, false positives, and anything the tool missed.

Open Code Review v1.13.3 with Sol6.1 (azure/openai/gpt-6.1-sol, via NVIDIA Inference Hub) reviewed 03efc9e1ffda92d794470879b053eca199b0f04b.

Reasoning effort: high. Review effort: medium.

Result: OCR reported 3 observations. 1 potential issues are posted inline and 2 additional suggestions are summarized below.

Additional suggestions from the tool
  • source/isaaclab_newton/isaaclab_newton/physics/kamino_solver_cfg.py:324 (low, documentation): The new :meth: references to build and eval_fk are unqualified, so Sphinx looks for them on the configuration class or its module, neither of which defines these methods. They will render without working API links. Use qualified solver-function references; if linking to the Kamino overrides, also ensure those methods are documented as targets (the current KaminoSolverFunctions autoclass has no :members:).
  • source/isaaclab_newton/isaaclab_newton/physics/mpm_solver_cfg.py:124 (low, documentation): MPMSolverCfg has no step method, so this unqualified method reference has no valid target in the configuration class. Link to MPMSolverFunctions instead, or use literal step text to avoid a broken API cross-reference.

Scope: 80 of 93 changed files selected, including Python tests and .rst files. This was a static review; simulation tests were not run.

Review time: 8m27s. Token usage: 4,043,765.

Comment on lines +283 to +284
for entry_cfg in {type(entry.solver_cfg): entry.solver_cfg for entry in cfg.entries}.values():
entry_cfg.class_type.prepare_builder(entry_cfg, builder)

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.

Experimental review tooling · medium · bug

Deduplicating by configuration type drops distinct solver-functions implementations. For example, two MPMSolverCfg entries can select different custom class_type values, but this dictionary retains only the last configuration, so the first implementation's required builder preparation never runs even though its solver is still constructed. Deduplicate by the selected preparation hook/implementation instead, and add a regression test with same-type configurations selecting different functions classes.

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.

Fixed in e69747c: dedup by class_type. Regression test in 953c6a8.

…solver-specs

# Conflicts:
#	source/isaaclab_newton/isaaclab_newton/physics/kamino_manager.py
@maxkra15

Copy link
Copy Markdown
Contributor

coupler.py deduplicates entries using type(entry.solver_cfg)
Two VBDSolverCfg instances can select different implementations through class_type. with the current chnages, only the last implementation’s prepare_builder() runs which can omit required model preparation before finalization
reproduced this with two custom VBD implementations: expected preparation calls were ['First', 'Second']; actual calls were ['Second']. previous implementation preserved distinct preparation hooks Suggested fix: deduplicate by selected solver implementation or preparation hook. Preserve the existing behavior of coloring once for repeated standard VBD entries, and extend the lifecycle test with different implementations sharing one config type

@StafaH

StafaH commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

@maxkra15 Fixed in e69747c: dedup by class_type, so each implementation prepares once and repeated standard VBD entries still color once. 953c6a8 extends the lifecycle test with two implementations sharing one cfg type.

@AntoineRichard AntoineRichard self-assigned this Oct 27, 2026
…solver-specs

# Conflicts:
#	source/isaaclab_contrib/isaaclab_contrib/coupling/coupler.py
#	source/isaaclab_contrib/test/coupling/test_coupler.py
@StafaH

StafaH commented Oct 27, 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 Oct 27, 2026
@StafaH
StafaH merged commit 6414515 into isaac-sim:main Oct 27, 2026
58 of 59 checks passed
@ooctipus
ooctipus deleted the newton/redesign-2b-solver-specs branch October 28, 2026 01:22
StafaH added a commit that referenced this pull request Oct 30, 2026
# Description

Part 2c of the Newton manager redesign
([overview](#8218 (comment))).
Builds on [2a/N] #8733 and [2b/N] #8734 (both merged).

## Summary

`NewtonManager`'s step, reset and contact logic moves onto
`NewtonBackend`. A backend now holds everything one
model's step needs and the methods that run it, so backends with
different solvers can be built and stepped side by
side without a manager or simulation context:

```python
backend = NewtonBackend(NewtonBackendCfg(physics_cfg=cfg, device="cuda:0"), builder, dt=0.01)
backend.init_solver()                       # solver, contacts, initial FK
backend.invalidate_fk(env_mask, articulation_ids=ids)
backend.step()                              # forward + step; captured as a CUDA graph after the first call
backend.refit_bvh(timestamp)                # shared BVHs, refit once per state
```

**Why:**
- **Hard resets are correct by construction.** Step callbacks,
solver-init callbacks, pending model changes, the
outer-capture flag and the captured graph live on the backend, so they
are discarded with the model instead of
  being cleared by hand in the manager.
- **Several simulations per process.** No backend method reads manager
or module state (`test_two_backends.py`: MJWarp and
Featherstone stepped side by side, eager and captured, with reset masks
isolated per backend).
- **Groundwork for 2d/2e:** the step becomes one captured graph whose
capture the caller can own.

The manager keeps what outlives a model (builder, sites, clone record,
decimation) and scene-data timestamps. Solver
behavior goes through `solver_cfg.class_type` as in 2b. Behavior is
unchanged, including the solver-init callback and
initial-FK order.

`NewtonQueries.run_query` combined a shared BVH refit with each
consumer's query capture. It is split: the shared part
is `backend.refit_bvh(timestamp)`, and the renderer and ray caster
capture their own query, as the frame transformer
already did.

The Newton viewer now registers its picking forces with each new backend
on a hard reset, since state-force callbacks
belong to the backend.

## Breaking changes

| Removed | Use instead |
|---|---|
| `NewtonQueries.run_query` | `backend.refit_bvh(timestamp)`, then
capture the query with `newton_backend.capture_graph` |
| `NewtonQueries.capture_graph`, `._refit_bvh` |
`newton_backend.capture_graph`, `backend.refit_bvh` |
| `NewtonManager.transforms_may_change_on_graph_replay` |
`NewtonBackend.transforms_may_change_on_graph_replay` |
| Manager privates (`_simulate_full`, `_graph`, `_post_step_callbacks`,
...) | `backend.step()`, `backend.graph`, `backend.post_step_callbacks`,
... |

## Performance

`isaaclab benchmark runtime`, 4096 envs, `physics=newton_mjwarp`, 1000
steps, warm kernel cache, run sequentially:

| Task | main | this PR |
|---|---|---|
| Cartpole | 2.65 M steps/s | 2.69 M steps/s |
| Reach-Franka | 1.058 M steps/s | 1.054 M steps/s |
| Flat ANYmal-D | 254.6 k steps/s | 254.6 k steps/s |

## Testing

Targeted tests pass, run file by file: manager abstraction (106), two
backends (3), Newton visualizer adapter, VBD core, MJWarp tendon
control,
MPM reset masks and object, coupler, coupler runtime, custom coupling,
visualization state, articulation (incl.
contract `-k newton`), joint coordinates, Newton actuators, BAM
actuator, contact sensor, frame transformer, ray
caster, IMU, cloner. Tests that need Isaac Sim (renderers, deformable
object, `test_newton_solver_reset`) were not run
locally.

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

4 participants