Repository navigation
Conversation
This was referenced Oct 18, 2026
StafaH
added a commit
that referenced
this pull request
Oct 19, 2026
# Description First PR of the Newton manager redesign series, split out of the draft #8218 (reference implementation and measurements). Overview of the whole redesign, with API examples: #8218 (comment). This PR changes one contract: **physics managers are instances**. On develop, `PhysicsManager` and its subclasses keep all simulation state in class variables and expose classmethods, so a process can hold only one simulation, and every consumer reaches the backend through a global (`NewtonManager.get_model()`, `PhysxManager.get_physics_sim_view()`, ...). Here: - `SimulationContext` constructs the manager selected by `cfg.physics.class_type` and owns it as `sim.backend_manager` (renamed from `sim.physics_manager`, which stays as a deprecated alias). Its runtime methods (`reset`, `step`, `forward`, `register_callback`, getters, ...) are instance methods, and its state (`_sim`, `_cfg`, `_device`, `_sim_time`, callbacks, `views`) is per instance. - Assets and sensors resolve the context and its manager once (`self._sim`, `self._backend_manager`); their data classes receive the manager at construction. MDP terms use `env.sim.backend_manager`. - `PhysicsManager.backend_name` (`"physx"`, `"ovphysx"`, `"newton"`) replaces class-name checks in the factories. - `views` is keyed by prim path per manager, instead of `(manager class, path)` in one process-wide dict. - PhysX, OVPhysX and Newton managers (and the Newton solver managers, couplers, and task-local managers) are converted mechanically. Class-level factory hooks used before a manager exists stay classmethods (`_prepare_stage_creation`, `fix_articulation_root`, `setup_deformable_body`, Newton `create_builder` and solver construction). Newton solver construction now receives the determinism mode as an argument instead of reading class state. No behavior changes otherwise; the Newton manager's internals are restructured in [2/N]. ## Series | PR | Scope | |---|---| | **[1/N] #8711 (this)** | Physics managers become instances | | [2/N] #8712 | Newton backend as data, stateless solver adapters, named step callbacks, one step graph | | [3/N] | Environment control inside the Newton step (actions, actuators, decimation loop in one graph) | | [4/N] | Mask-based resets: assets, scene, sensors, actuators | | [5/N] | Mask-based resets: managers, MDP and task terms (sync-free `env.step`) | | [6/N] | MDP2 physics contract: outer capture (`prepare`/`record_step`), world-masked commits, heterogeneous worlds | | [7/N] | Captured environment step | The split order and scope will change while the design is reviewed. ## Type of change - Breaking change, with deprecation paths for the common entry points. Migration below and in the changelog fragments. ## Migration Deprecated (still works, warns with `DeprecationWarning`): | Before | Now | |---|---| | `PhysxManager.get_physics_sim_view()`, `NewtonManager.get_model()`, `Manager.register_callback(fn, event)`, ... (class-level runtime calls and state) | `sim.backend_manager.get_physics_sim_view()`, `sim.backend_manager.get_model()`, ... (assets and sensors: `self._backend_manager`). Class-level access forwards to the active simulation's manager. | | `sim.physics_manager` | `sim.backend_manager` | | `RigidObjectData(view, device)` (PhysX, OVPhysX, Newton data classes) | `RigidObjectData(view, device, backend_manager=manager)` | | `profile_physics_steps(ManagerClass)` / lazy class reference | `profile_physics_steps(sim.backend_manager)` | | `PhysicsManager.safe_callback_invoke(..., physics_manager=m)` | `PhysicsManager.safe_callback_invoke(..., backend_manager=m)` | | `ParticleSurfaceRenderer(visualizers, surface, ...)` | `ParticleSurfaceRenderer(visualizers, surface, ..., backend_manager=sim.backend_manager)` | Breaking (no shim): | Before | Now | |---|---| | `sim.physics_manager is NewtonManager`, `sim.physics_manager.__name__` | `isinstance(sim.backend_manager, NewtonManager)`, `sim.backend_manager.backend_name` | | `Manager.views[(Manager, path)]` | `manager.views[path]` | | `InteractiveScene.physics_backend == "newtonmjwarpmanager"` (lowercased class name) | `scene.physics_backend == "newton"` (backend key) | | Manager subclasses overriding runtime hooks as classmethods (`_build_solver`, `_solver_specific_clear`, ...) | override them as instance methods | | Newton `_create_solver(model, solver_cfg)`, `_filter_solver_kwargs(solver_cls, solver_cfg)` reading the determinism mode from class state | `_create_solver(model, solver_cfg, deterministic_mode)`, `_filter_solver_kwargs(solver_cls, solver_cfg, deterministic_mode)` | ## Testing Each test file in its own process, without Isaac Sim (Kit): - All Newton physics, asset, sensor, env, cloner, controller and renderer tests; the asset contract suites on all three backends (articulation 487 passed, rigid object 231 passed); core sim, benchmark and backend-utility tests; all OVPhysX tests (30 files); contrib coupling and custom-coupling tests; the Newton contrib task tests (Franka pour, UR10 particle push); visualizer adapter tests. - New tests for the deprecation paths: class-level forwarding (methods and `views`), the `sim.physics_manager` alias, data-class fallback, profiler class input, and the OVPhysX exit hook being dropped on close. - Remaining failures also fail on develop `0ab97e9c8` (Kit launcher tests, `test_api.py` without `rl_games`/`sb3`, `test_rendering_franka_soft_kitless.py`, `test_xr_camera_feed_presets.py`) or need extras not installed here (`rerun`). - Not runnable here (need Isaac Sim): the PhysX asset, sensor and env tests, and Kit-dependent sim tests. The PhysX consumer changes are the same mechanical substitution and are lint-checked. ## 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
NewtonBackend holds everything bound to one finalized Newton model (state, control, solver, contacts, sensors, actuators, step callbacks and the compiled step). The functions in isaaclab_newton.physics.newton_backend take it explicitly, so independent backends with different solvers can be built and stepped side by side. Solver-specific manager subclasses become stateless NewtonSolver adapters selected by solver_cfg.class_type; NewtonManager is a thin shell that owns its builder and backend, initializes in one pass, and can be constructed standalone. Every step launches one StepGraph whose graphable segments replay from CUDA graphs, with eager islands for non-capturable work. Consumers register named step callbacks and read backend fields; the old getters, cl_register_site, activate_newton_actuator_path and register_pre_actuator_callback are deprecated. The contrib couplers, task-local solvers and examples become adapters. Develop behavior is kept: post-actuator callbacks run every physics step, the decimation loop folds only when Newton actuators run inside the step, MPM still authors its scene settings, and VBD publishes joint state.
StafaH
force-pushed
the
newton/redesign-2-newton-backend
branch
from
October 19, 2026 02:05
8585da2 to
dcd1a55
Compare
This was referenced Oct 19, 2026
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Second PR of the Newton manager redesign series (overview with API examples:
#8218 (comment)). Follows [1/N] #8711 (merged), which made
physics managers instances owned by the simulation as
sim.backend_manager.This PR restructures the Newton manager around one data object and stateless solver adapters:
NewtonBackendis the data for one finalizednewton.Model: state, control, solver, contacts, sensors,actuators, step callbacks, reset masks and the compiled step. Newton's
Modelstays the immutable description(like
mjModel); the backend is the mutable data (likemjData). A hard reset closes it and finalizes a new one.isaaclab_newton.physics.newton_backend:init_solver,forward,invalidate_fk,mark_model_changed,register_step_callback,prepare,step,run_query, ...), in the styleof
mj_step(m, d). They read no class or module state, so independent backends with different solvers can bebuilt and stepped side by side.
NewtonSolver:MJWarpSolverAdapter,FeatherstoneSolverAdapter,XPBDSolverAdapter,VBDSolverAdapter,KaminoSolverAdapter,MPMSolverAdapter, and the contrib couplers),selected by
solver_cfg.class_type. They replace the per-solverNewtonManagersubclasses;NewtonCfg.class_typeis
NewtonManager(or a downstream subclass) independently of the solver.NewtonManageris a thin shell that owns its builder and backend and adapts the functional core to the IsaacLab lifecycle. Managers can be constructed standalone (
NewtonManager(builder, cfg, dt=..., device=...)) and do notshare state.
step()launches oneStepGraphcovering 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; non-capturable work (TorchScript/LSTMactuators, eager callbacks) runs in place between segments. Consumers register with named methods
(
register_pre_step_callback,register_control_callback,register_post_actuator_callback,register_state_force_callback,register_post_step_callback).reset()dispatchesMODEL_INIT, finalizes, dispatchesPHYSICS_READY(consumers bind),then constructs the solver and contacts (
init_solver).Behavior is otherwise unchanged: the environment still decides the decimation loop as on develop (the Newton step folds
it only when Newton actuators run inside the step), and resets, MDP terms and graph-capture of the environment step are
untouched (later PRs).
Type of change
NewtonManager.get_model()/get_state_0()/... (readmanager.backend.*),cl_register_site,activate_newton_actuator_path,register_pre_actuator_callback.Migration
NewtonMJWarpManager,NewtonVBDManager, ... (manager subclasses)MJWarpSolverAdapter,VBDSolverAdapter, ... (same modules); custom solvers subclassNewtonSolverand implementcreate_solver(model, deterministic_mode)manager.get_model(),_solver,_contacts,_use_single_state, ...manager.backend.model,.solver,.contacts,.solver_adapter.single_state, ...sim.get_or_create_backend(NewtonBuilderCfg(...))under Newton physicsget_newton_builder(sim)/get_newton_backend(sim)register_pre_actuator_callback(fn),unregister_post_step_callback(fn)register_control_callback(fn),unregister_step_callback(handle)cl_register_site,activate_newton_actuator_pathregister_site,activate_actuatorsadd_frame_transform_sensor(...);add_imu_sensor/add_contact_sensorreturning keysSensorFrameTransform; both return the Newton sensorNewtonQueries.run_query,.capture_graphnewton_backend.run_query,.capture_graphNewtonCouplerManager,NewtonCoupledMJWarpVBDManagerCouplerSolverAdapter,CoupledMJWarpVBDSolverAdapterTesting
Each test file in its own process, without Isaac Sim (Kit), compared with develop after [1/N]:
and UR10 particle push with the MPM coupler, G1 granular terrain, shoelace) and all 31 OVPhysX environments run.
test_two_backends.py: backends with different solvers steppedside by side, eager and captured, and independent managers), assets, sensors, cloner, renderers, views, VBD, MPM;
asset contract suites on all backends; contrib coupling; visualizers; Newton task tests.
and Kit-only tests.
Kept from develop on purpose: post-actuator callbacks run every physics step (the BAM servo publishes friction per
step); the decimation loop folds only when Newton actuators run inside the step; MPM still authors its scene settings
on the USD physics scene; VBD publishes standalone joint state after each physics step (
finish_stepadapter hook).Checklist
pre-commitchecks with./isaaclab.sh --format