Repository navigation
[4A/10] Key native resources by cfg and centralize ownership - #7899
Conversation
|
run-ci |
|
Added matched startup and steady-state FPS benchmarks to the description and marked ready for review. Kuka Camera, 4,096 envs, GPU 0; two samples per side, first 50 steps excluded and next 200 timed. Newton renderer: PR/develop 28.30/29.97 s and 78,624/76,593 env FPS. OVRTX: 45.35/45.87 s and 45,528/46,402 env FPS (1.9% lower FPS in this small sample, explicitly reported). The Isaac PhysX→Isaac RTX smoke also passed on retry. Visualizer CI remains unresolved: one stale factory-identity assertion and three tiled-image mismatches, detailed in the description. No production changes, golden replacements, or threshold relaxations were made for this benchmark pass. |
|
| sim_utils.SimulationContext.instance().physics_manager.pre_render() | ||
| for _cfg, renderer in self._renderer_entries: | ||
| renderer.update_transforms() | ||
| renderer.update_geometries() |
There was a problem hiding this comment.
Removing the per-physics-step guard makes every camera fetch synchronize the full set of registered renderers again. Eager scene updates can also perform this synchronization before the camera fetches. SDP deduplicates transform conversions, but it does not prevent renderer geometry work—such as OVRTX deformable copies—from repeating for every camera in the same physics step. This is a non-blocking performance concern for multi-camera scenes; preserve same-step dirty-publication handling without rerunning every renderer update per camera.
Knowledge Base Used:
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!
There was a problem hiding this comment.
Isaac Lab Review Bot
The SDP publication cutover and clone-context ownership model are coherent, but three actionable issues remain: removed public NewtonManager methods lack deprecation or migration support, OVPhysX now passes a shape-incompatible alias to native binding reads, and PhysX dirty-state invalidation does not survive CUDA graph replay.
- Design and architecture: Building shared Newton render resources from the clone plan and owning them in NewtonReplicateContext removes the lazy stage-walking shadow model cleanly. However, the publication architecture relies on host-side dirty latches, which do not capture replayed device-side writes without an explicit graph-aware invalidation mechanism.
- API: The new SceneDataPublication and request_transforms contract is documented and changelogged. The deletion of the public NewtonManager.update_visualization_state and sync_transforms_to_usd classmethods nevertheless violates the repository requirement for prior deprecation and migration guidance; compatibility shims or an explicit supported migration are needed.
- Implementation: OVPhysX previously required binding-shaped float32 destinations, but now supplies a one-dimensional transformf alias to read_into; the alias should retain the binding's (N, 7) float32 shape while sharing storage. PhysX mask writers also set the dirty latch only in Python during graph capture, so later graph replays can leave SDP conversions and pre-render kinematics stale; this needs graph-replay-aware invalidation analogous to the Newton path.
Minor fixes needed. Posted 3 actionable findings inline.
Automated review; human maintainers own approval decisions.
| Changed | ||
| ^^^^^^^ | ||
|
|
||
| * Shared Newton model, state, and scene-query resources through the simulation backend registry. |
There was a problem hiding this comment.
🟡 Warning · Api — Removed public NewtonManager methods undocumented
NewtonManager.update_visualization_state and sync_transforms_to_usd are public classmethods on an exported class and are deleted here, yet this fragment states physics accessors remained supported and gives no migration path. Repository rules require a deprecation and migration guidance for removed public APIs. Either keep deprecated shims delegating to NewtonReplicateContext.update_transforms / UsdReplicateContext._update_fabric, or document the removal and replacement here.
| poses = wp.empty(total_count, dtype=wp.transformf, device=device) | ||
| self._transform_publication.data.transforms = poses | ||
| for entry in self._rigid_bindings: | ||
| entry["pose_buf"] = wp.array( |
There was a problem hiding this comment.
🟡 Warning · Implementation — Binding read alias changes shape and dtype
The deleted docstring stated the staging/merged split existed because the wheel writes into dst only when dst.shape == binding.shape, so a slice of the merged buffer cannot be read into directly. This alias is (row_count,) transformf while the binding is (N, 7) float32, and read_into is the same call the old code used with the matching staging buffer. Alias each binding as (row_count, 7) float32 over the same storage.
| @property | ||
| def transform_publication(self) -> SceneDataPublication: | ||
| """Publish native rigid-body poses [m, xyzw] and their dirty latch.""" | ||
| if self._transform_publication.dirty and (view := self.get_rigid_body_view()): |
There was a problem hiding this comment.
🟡 Warning · Implementation — Host dirty latch misses graph-replayed writes
Transforms were previously re-gathered on every read; they are now gated on a Python boolean set by the asset writers. The mask writers are documented as the graphed-pipeline path, so their assignment runs at capture time only, and a replayed pose or joint write followed by a render leaves both the cached transforms and pre_render's kinematics refresh skipped. Newton handles this with _transforms_may_change_on_graph_replay; OVPhysX shares the same gap.
|
run-ci |
|
run-ci |
553575b to
6026bdb
Compare
|
run-ci |
|
run-ci |
StafaH
left a comment
There was a problem hiding this comment.
I like this. Looks good first step Config equality part feels fragile. Clearing based on config argument seems odd. Maybe might need a hash key or something, and making sure we can clear one backend while not clearing another identical backend (if two were made using same initial config?
Agent says:
I like moving native-resource ownership into SimulationContext, but config equality—or making configs hashable—does not seem like the right resource identity. These configs are mutable and may contain nested or borrowed native objects, so their hash could be unstable or unavailable. More importantly, equal configuration does not imply shared ownership.
For example, two OVRTXRenderer instances with equal configs would receive the same backend. This prevents intentionally creating two independent OVRTX backends, and closing either renderer would destroy the backend still used by the other.
Could the registry instead be a simple lifetime owner? create_backend(cfg) would always create and register a backend, while clear_backend(backend) would remove it by object identity. Components that need sharing can explicitly pass the same backend reference.
|
|
||
| ``SimulationContext.get_or_create_backend(backend_cfg)`` owns native resources | ||
| by configuration values. Equal configurations of the same concrete type share | ||
| one resource; a cache miss constructs ``backend_cfg.class_type(backend_cfg)``. |
There was a problem hiding this comment.
Based on offline discussions, in the future this would be backend = instantiate(backend_cfg) which I think looks better, or at the very least backend_cfg.build()
There was a problem hiding this comment.
ill do a global change for this
There was a problem hiding this comment.
For 4A we are keeping the agreed config-based get-or-create sharing contract: equal finalized cfgs share a native resource, and a cache miss constructs exactly cfg.class_type(cfg). Configs remain declarative and read-only after registration. A generic instantiation API is outside this ownership change; no cfg.build() method or config hashing is introduced. Teardown now uses backend object identity independently of the creation/reuse contract.
| :class:`~isaaclab.sim.BackendCfg` describes native construction inputs, while | ||
| ``PhysicsCfg`` selects a physics manager. Finalize configurations before | ||
| registration and treat them, including nested values, as read-only afterward. | ||
| Use a new configuration for different settings. ``clear_backend(backend_cfg)`` |
There was a problem hiding this comment.
This part seems odd, why would we pass a config to clean_backend rather than the backend object itself?
There was a problem hiding this comment.
Addressed in c3d1e92: teardown is now sim.close_backend(backend), selecting the exact object with is, rather than comparing configurations. All four native owners implement close(), and their redundant stored cfg fields are removed. A failed release retains the registry entry for retry; a stale handle cannot close a replacement created from the same cfg. OVRTX renderer closure now releases only its own bindings, leaving the shared native engine owned by the registry until simulation teardown. Existing tests cover these cases, including equal-cfg borrowers.
|
run-ci |
Include the complete ownership, cfg identity, lifecycle, tests, and migration documentation change. Preserve the release branch's OVRTX mapping API and its documentation and regression tests when resolving the two cherry-pick conflicts. (cherry picked from commit c90c3a1)
…7530, #7899) (#7926) ## Description Backports the two changes merged into `develop` since September 19 that are still missing from `release/3.0.0`: | Source PR | Change | Source commit | | --- | --- | --- | | #7530 | Validate camera outputs against renderer capabilities before simulator startup | `31d1c53510490c76841e9c35a329574b357d9900` | | #7899 | Share native resources by construction cfg and centralize ownership and teardown | `c90c3a1097a0a669a823b880b1c8d0654d7fd267` | Includes the original regression tests, API documentation, and changelog fragments. #7530 applied without changes. #7899 required two conflict resolutions to retain the release branch's OVRTX mapping API, documentation, and tests. Of its 62 files, 59 match the merged source exactly; the other three retain those existing release additions. Release versions, lockfile entries, compiled changelogs, and documentation routing are preserved. ## Audit Checked all **33 PRs** merged from September 19, 2026 00:00 America/Los_Angeles through `develop` commit `c90c3a1097` (September 20, 21:29 Pacific), against release base `75e9c8ce12`. **31 are already backported; the remaining two are included here.** Git first-parent history and GitHub's merged PR list agree. Automatic changelog/version compilation remains branch-specific. <details> <summary>31 PRs already recorded in release</summary> | Source PRs | Existing release commit | | --- | --- | | #7777, #7608, #7895, #7872, #7831, #7834, #7838, #7840, #7903, #7674 | [`ff22c52891`](ff22c52) | | #7886 | [`41bfaee5f0`](41bfaee) | | #7042 | [`970d21ef48`](970d21e) | | #7905 | [`f0563d1f9e`](f0563d1) | | #7604 | [`dca7cfe984`](dca7cfe) | | #7610, #7603 | [`5dd2220243`](5dd2220) | | #7839 | [`b8b93bb96e`](b8b93bb) | | #6851 | [`baa025ad90`](baa025a) | | #7250 | [`f86b33e6b1`](f86b33e) | | #7910 | [`24f7b4842b`](24f7b48) | | #7810 | [`9738e096c8`](9738e09) | | #7832 | [`be270ed88b`](be270ed) | | #4679 | [`80157aa22d`](80157aa) | | #7914 | [`01b59b5a22`](01b59b5) | | #7502 | [`db7db61f60`](db7db61) | | #7918 | [`bca9dba8bb`](bca9dba) | | #7919 | [`ef1514c97c`](ef1514c) | | #7922 | [`7d6979a19e`](7d6979a) | | #7923 | [`a1dd560b98`](a1dd560) | | #7924 | [`892e51dc1d`](892e51d) | | #7925 | [`75e9c8ce12`](75e9c8c) | </details> ## Validation **745 tests passed** on the combined backport: - Core registry, configclass, replication, camera contracts, and task presets: 158 passed. - Newton manager/model/reset and coupling suites: 299 passed. - OVPhysX/OVRTX lifecycle, scene data, bindings, and material contracts: 141 passed on CPU. - Clone-plan algebra: 83 passed. - All 8 OV CUDA cases skipped in the CPU run: 8 passed on GPU. - OVPhysX ray-caster regression: 1 passed. - Kit simulation-context and PhysX scene-data tests: 54 passed. - Newton solver reset integration: 1 passed. The registry-identity and borrowed-config-field regressions both fail with the pre-backport implementations and pass with this change. Backport file-scope validation, source-file comparison, `git diff --check`, and `uv run isaaclab -f` passed. Local validation used PyTorch 2.12.0/CUDA 13.0, Isaac Sim 6.0.1.0, Newton 1.6.0rc1, and an RTX 5090. Existing deprecation/runtime warnings occurred. Full Docker CI is requested separately against the pinned environment; local checks do not claim a startup or runtime speedup. ## Checklist - [x] Read the contribution guidelines and ran formatting/changelog checks. - [x] Included source tests, documentation, and changelog fragments. - [x] Verified regression behavior and preserved release-specific changes. - [x] Recorded source commit hashes and audited the requested merge window. --------- Co-authored-by: Antoine RICHARD <[email protected]> Co-authored-by: ooctipus <[email protected]>
Route camera calibration binding, updates, and cleanup through the native backend introduced by isaac-sim#7899. Update the existing camera isolation test to enforce that ownership.
…7929) # Description Follow-up to #7899 (4A). This is the clone-lifecycle step, not the SDP transport cutover. The intended order is: ```text Construct consumers from cfg → build one clone plan → clone representations → allocate native models → initialize consumer bindings ``` ## Before and after The snippets below are shortened excerpts. Unrelated bookkeeping and arguments are omitted; they illustrate the lifecycle, not complete standalone programs. ### 1. Construct consumers before cloning; initialize them afterward **Before:** visualizers were constructed when they were initialized, too late for their constructors to participate in clone planning. ```python # Construction and binding happened together during visualizer initialization. visualizer = cfg.class_type(cfg) visualizer.initialize(self._scene_data_provider) ``` **After:** construct the configured consumers early, then bind the same objects to the completed scene later. ```python # Before cloning: record what each viewer needs and construct it from cfg. for cfg in self._resolve_visualizer_cfgs(): self._render_context.clone_contexts.update(cfg.cloning_contexts) self._pending_visualizers.append(cfg.class_type(cfg)) # Once cloned native resources are available: bind the objects we already constructed. for visualizer in tuple(self._pending_visualizers): visualizer.initialize(self._scene_data_provider) self._pending_visualizers.remove(visualizer) self._visualizers.append(visualizer) ``` Camera renderers also register during cfg processing, before the plan is built: ```python # A camera's renderer must declare its requirements before we clone its scene. for cfg in asset_cfgs: if isinstance(cfg, CameraCfg): sim.get_or_create_backend(cfg.renderer_cfg) ``` Renderer acquisition now uses the same cfg-based registry as native resources: ```python # Before: a renderer-specific factory and cache, separate from native ownership. renderer = sim.render_context.get_renderer(renderer_cfg) # After: one simulation-owned registry constructs cfg.class_type(cfg) on a miss. renderer = sim.get_or_create_backend(renderer_cfg) ``` `RenderContext` reads renderer entries from that registry and coordinates initialization, stage preparation, and updates. It neither caches nor closes renderer instances. Shutdown releases camera data, material writers, renderer bindings, visualizers, then native resources; it does not rely on registration order to determine dependencies. ### 2. Declare required representations in cfg and route them through the same plan **Before:** `InteractiveScene` inferred stage/model requirements from renderer and viewer type names after the sensors existed. ```python # These flags describe what is needed, but do not route asset rows to clone contexts. for type_name in requested_viz_types.union(cam_types): requires_stage, requires_model = REQUIRES_STAGE_AND_MODEL[type_name] self.sim.requires_usd_stage |= requires_stage self.sim.requires_newton_model |= requires_model ``` **After:** renderer and visualizer cfgs explicitly declare the contexts that build their representations. ```python class NewtonWarpRendererCfg(RendererCfg): # This camera renderer needs a Newton representation of the declared scene. cloning_contexts = ("isaaclab_newton.cloner:NewtonReplicateContext",) class NewtonVisualizerCfg(VisualizerCfg): # The viewer requests the same context, not a separate cloning pass. cloning_contexts = ("isaaclab_newton.cloner:NewtonReplicateContext",) ``` ```python # Renderer registration collects the declared requirements before planning. self.clone_contexts.update(cfg.cloning_contexts) # The planner routes asset rows to those contexts alongside per-asset overrides. # Dispatch then gives every participating context the same plan (simplified). for context_type in plan.context_rows: sim.clone_contexts[context_type].replicate(plan) ``` When Newton is already the physics context, its renderer/viewer requirement uses that same context. There is no separate rendering clone lifecycle. Existing stage/model flags are not all removed by this PR. ### 3. Build the Newton representation during cloning, not from a getter **Before:** asking for the Newton model could build it by discovering and importing the completed USD stage, when another backend supplied physics. ```python @classmethod def get_model(cls): # A read could trigger scene discovery and native-model construction. cls._ensure_visualization_model() return None if cls.backend is None else cls.backend.model ``` **After:** physics and render-only Newton representations use the same import-and-replicate function. The plan supplies the routed prototypes and shared roots. Newton physics keeps its solver-specific defaults, sites, and hooks; foreign-physics rendering imports geometry without a Newton solver. There is no separate visualization-builder module. ```python # Both physics and rendering enter this same construction path. return _replicate_newton( self._sim.stage, plan, plan.context_rows[type(self)], self._sim, up_axis=self.up_axis ) ``` ```python # Inside the shared path: choose physics defaults or a plain geometry builder. create_builder = partial(manager_cls.create_builder if simulation else ModelBuilder, up_axis=up_axis) # Import each prototype once, then expand the same clone mapping in either mode. source_builders = build_source_builders(stage, sources, create_builder, schema_resolvers, ...) replicate_builder_mapping(...) # Uses the plan's routed mask, positions, env IDs, and destinations. # For foreign physics, allocate the resulting model only after physics is ready. backend_cfg = NewtonBackendCfg( builder=builder, device=sim.device, num_envs=len(plan.env_ids), simulation=False ) sim.physics_manager.register_callback( partial(NewtonManager._initialize_visualization_model, backend_cfg, geometry), PhysicsEvent.PHYSICS_READY, name="newton_visualization_model", wrap_weak_ref=False, ) ``` ```python # Inside that readiness callback: use the native-resource registry introduced in 4A. NewtonManager.backend = sim.get_or_create_backend(cfg) @classmethod def get_model(cls): # Reading the model no longer constructs anything or scans the stage. return None if cls.backend is None else cls.backend.model ``` This removes late full-stage reconstruction from this rendering path. It does **not** eliminate every geometry scan: deformable metadata is still inspected within the declared source/shared roots. ### 4. Make standalone demos declare what belongs to their scene **Before:** standalone demos could author geometry without a plan, relying on a Newton-backed viewer to discover it later. ```python scene_entities, scene_origins = design_scene() sim.reset() # A viewer could reconstruct its representation from the finished stage. ``` **After:** the quadruped demo declares its roots before authoring and asks the clone lifecycle to build the required representations before reset. ```python # This demo authors independent roots, so it uses a global-only plan. global_paths = ( "/World/defaultGroundPlane", "/World/Light", *(f"/World/Origin{i}" for i in range(1, 8)), ) plan = cloner.make_clone_plan((), 1, 0.0, global_paths=global_paths) sim.set_clone_plan(plan) # Author the declared scene, then build its rendering representations. scene_entities, scene_origins = design_scene() cloner.replicate(plan, replicate_physics=False) # Keep the existing native physics setup. sim.reset() ``` The same minimal migration covers the affected standalone demos and URDF/MJCF previews. `InteractiveScene` handles the ordering automatically; its callers do not need this explicit ceremony. ## Scope and size No new production classes or files. Production **−274 LOC**, tests **−99 LOC** against develop `eaab09fd0` after the conflict-resolution merge. The builder-consolidation follow-up alone removed **122 production lines**, including `visualization_builder.py` and two redundant helper layers. The renderer-registry follow-up removed another **21 production lines** and **93 test lines** while adding teardown-order and registration regressions. Config-keyed sharing now also owns renderer instances; supported native-model sharing cases are unchanged. Independently configured Newton models, singleton query routing, and SDP conversion/copy changes remain outside this PR. Performance samples below retain their explicitly pinned historical baselines; they were not rerun for this merge. ## Initial develop comparison Baseline: merged develop `c90c3a1097a0a669a823b880b1c8d0654d7fd267`. GPU 0, RTX 5090, `Isaac-Lift-KukaAllegro-Camera`, 4096 environments, seed 0, no interactive visualizer. One warm sample each, same installed dependencies/cache and resolved workload configuration. Startup includes imports, construction, reset, and first step. Runtime discards 25 steps, then measures 200 synchronized full environment steps, including actions, camera observations, and episode resets. | Physics → renderer | Startup 4B / develop | Runtime ms/step 4B / develop | Environment FPS 4B / develop | | --- | ---: | ---: | ---: | | Newton MJWarp → Newton | 28.34 / 28.33 s | 46.31 / 45.94 | 88,457 / 89,159 | | OVPhysX → Newton | 62.94 / 62.95 s | 163.02 / 160.83 | 25,126 / 25,468 | These samples preceded the builder-consolidation follow-up. Startup was effectively unchanged; runtime was 0.8% and 1.4% slower respectively, which a single pair cannot establish as significant. This measures incremental 4B, not the later full-refactor optimization stack. All 4096 camera outputs were finite and nonconstant. The separate follow-up check below compares consolidation against its immediate parent; do not combine timings across the two sessions. ### Builder-consolidation follow-up check GPU 0, same 4096-environment workload, seed, dependencies, `_isaac_sim` launcher, 25 discarded steps and 200 measured steps. One warm sample per revision/path. Before is this PR's previous head `2f75d462a8`; after is the consolidated pipeline committed as `b39adbd4d`. Resolved configurations were byte-identical. Earlier temporary-worktree measurements without the matching Isaac Sim launcher were discarded. | Physics → renderer | Startup after / before | Runtime ms/step after / before | Environment FPS after / before | | --- | ---: | ---: | ---: | | Newton MJWarp → Newton | 28.73 / 29.02 s | 50.32 / 48.14 | 81,395 / 85,090 | | OVPhysX → Newton | 68.33 / 65.56 s | 174.20 / 163.59 | 23,513 / 25,038 | These are **not a demonstrated no-regression result**: startup changed −1.0% / +4.2% and runtime +4.5% / +6.5%. There was no competing GPU 0 compute job, but host CPU activity was not isolated. One pair cannot establish whether those differences are repeatable. This follow-up changes construction only, not the stepping/render transport loop. All 4096 camera outputs passed the finite/nonconstant checks. ## Validation - Conflict resolution against develop `eaab09fd0`: preserved upstream MPM particle-range tracking in the shared clone path. 114 focused tests plus four subtests passed, including GPU 0 MPM initialization/reset and OVRTX cleanup checks. Formatting/changelog validation passed against the updated base. - Renderer-registry follow-up: 163 focused CPU tests and 11 profiler-target checks passed. Five regression cases failed when the prior registry methods were substituted: pre-construction global-setting validation and renderer-before-native teardown in both creation orders, with and without cleanup failures. - Builder-consolidation follow-up: 172 focused CPU tests (plus four subtests) and four solver-specific import cases passed, covering cloning, source geometry, renderer registration, visualizer lifecycle, native ownership, and SDP copy/remap behavior. - Regression checks failed on the pre-consolidation commit and passed here: omitted clone positions and excluded deformable rows beneath an overlapping shared root. Public direct replication kept its signature. - Standalone script contract checks passed (launch matrix not run in full). - GPU 0: Newton/OVPhysX → Newton camera smokes; OVPhysX → OVRTX camera smoke; OVPhysX camera + headless Newton GL shared one native model across an ordinary reset; migrated Isaac PhysX marker and OVPhysX deformable demos reached readiness and stepped. - After registry consolidation, repeated 16-environment GPU 0 Kuka camera checks for Newton → Newton, OVPhysX → OVRTX, and OVPhysX → Newton camera + headless Newton GL. All passed, including valid images, model sharing/reset, and teardown. These are correctness smokes, not new matched performance samples. - `uv run --no-sync isaaclab -f` passed, with changelog validation pinned to the actual upstream baseline. After registry consolidation, the full isolated documentation build (`uv run --no-sync isaaclab -d`, using the branch's docs-enabled `dev` extra) passed with warnings treated as errors. The pre-existing forced native-rewarm issue, where some consumers retain old model bindings after STOP/recreation, is not claimed fixed here. Ordinary reset and first initialization are covered. ## Type of change - Refactor and lifecycle correction. - Breaking behavior for external standalone foreign-physics rendering workflows that never declared a plan: declare source/shared roots before cloning. Maintained affected demos are migrated; the cloning guide includes the standalone pattern. - Removed `RenderContext.get_renderer`: use `sim.get_or_create_backend(renderer_cfg)`. Use `sim.render_context` for orchestration; its constructor now takes the shared registry. ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## Checklist - [x] Contribution guidelines read. - [x] Pre-commit checks passed. - [x] Documentation and per-package changelog fragments updated. - [x] Focused tests and GPU smoke checks completed. - [x] Contributor already listed.
…7929) # Description Follow-up to #7899 (4A). This is the clone-lifecycle step, not the SDP transport cutover. The intended order is: ```text Construct consumers from cfg → build one clone plan → clone representations → allocate native models → initialize consumer bindings ``` ## Before and after The snippets below are shortened excerpts. Unrelated bookkeeping and arguments are omitted; they illustrate the lifecycle, not complete standalone programs. ### 1. Construct consumers before cloning; initialize them afterward **Before:** visualizers were constructed when they were initialized, too late for their constructors to participate in clone planning. ```python # Construction and binding happened together during visualizer initialization. visualizer = cfg.class_type(cfg) visualizer.initialize(self._scene_data_provider) ``` **After:** construct the configured consumers early, then bind the same objects to the completed scene later. ```python # Before cloning: record what each viewer needs and construct it from cfg. for cfg in self._resolve_visualizer_cfgs(): self._render_context.clone_contexts.update(cfg.cloning_contexts) self._pending_visualizers.append(cfg.class_type(cfg)) # Once cloned native resources are available: bind the objects we already constructed. for visualizer in tuple(self._pending_visualizers): visualizer.initialize(self._scene_data_provider) self._pending_visualizers.remove(visualizer) self._visualizers.append(visualizer) ``` Camera renderers also register during cfg processing, before the plan is built: ```python # A camera's renderer must declare its requirements before we clone its scene. for cfg in asset_cfgs: if isinstance(cfg, CameraCfg): sim.get_or_create_backend(cfg.renderer_cfg) ``` Renderer acquisition now uses the same cfg-based registry as native resources: ```python # Before: a renderer-specific factory and cache, separate from native ownership. renderer = sim.render_context.get_renderer(renderer_cfg) # After: one simulation-owned registry constructs cfg.class_type(cfg) on a miss. renderer = sim.get_or_create_backend(renderer_cfg) ``` `RenderContext` reads renderer entries from that registry and coordinates initialization, stage preparation, and updates. It neither caches nor closes renderer instances. Shutdown releases camera data, material writers, renderer bindings, visualizers, then native resources; it does not rely on registration order to determine dependencies. ### 2. Declare required representations in cfg and route them through the same plan **Before:** `InteractiveScene` inferred stage/model requirements from renderer and viewer type names after the sensors existed. ```python # These flags describe what is needed, but do not route asset rows to clone contexts. for type_name in requested_viz_types.union(cam_types): requires_stage, requires_model = REQUIRES_STAGE_AND_MODEL[type_name] self.sim.requires_usd_stage |= requires_stage self.sim.requires_newton_model |= requires_model ``` **After:** renderer and visualizer cfgs explicitly declare the contexts that build their representations. ```python class NewtonWarpRendererCfg(RendererCfg): # This camera renderer needs a Newton representation of the declared scene. cloning_contexts = ("isaaclab_newton.cloner:NewtonReplicateContext",) class NewtonVisualizerCfg(VisualizerCfg): # The viewer requests the same context, not a separate cloning pass. cloning_contexts = ("isaaclab_newton.cloner:NewtonReplicateContext",) ``` ```python # Renderer registration collects the declared requirements before planning. self.clone_contexts.update(cfg.cloning_contexts) # The planner routes asset rows to those contexts alongside per-asset overrides. # Dispatch then gives every participating context the same plan (simplified). for context_type in plan.context_rows: sim.clone_contexts[context_type].replicate(plan) ``` When Newton is already the physics context, its renderer/viewer requirement uses that same context. There is no separate rendering clone lifecycle. Existing stage/model flags are not all removed by this PR. ### 3. Build the Newton representation during cloning, not from a getter **Before:** asking for the Newton model could build it by discovering and importing the completed USD stage, when another backend supplied physics. ```python @classmethod def get_model(cls): # A read could trigger scene discovery and native-model construction. cls._ensure_visualization_model() return None if cls.backend is None else cls.backend.model ``` **After:** physics and render-only Newton representations use the same import-and-replicate function. The plan supplies the routed prototypes and shared roots. Newton physics keeps its solver-specific defaults, sites, and hooks; foreign-physics rendering imports geometry without a Newton solver. There is no separate visualization-builder module. ```python # Both physics and rendering enter this same construction path. return _replicate_newton( self._sim.stage, plan, plan.context_rows[type(self)], self._sim, up_axis=self.up_axis ) ``` ```python # Inside the shared path: choose physics defaults or a plain geometry builder. create_builder = partial(manager_cls.create_builder if simulation else ModelBuilder, up_axis=up_axis) # Import each prototype once, then expand the same clone mapping in either mode. source_builders = build_source_builders(stage, sources, create_builder, schema_resolvers, ...) replicate_builder_mapping(...) # Uses the plan's routed mask, positions, env IDs, and destinations. # For foreign physics, allocate the resulting model only after physics is ready. backend_cfg = NewtonBackendCfg( builder=builder, device=sim.device, num_envs=len(plan.env_ids), simulation=False ) sim.physics_manager.register_callback( partial(NewtonManager._initialize_visualization_model, backend_cfg, geometry), PhysicsEvent.PHYSICS_READY, name="newton_visualization_model", wrap_weak_ref=False, ) ``` ```python # Inside that readiness callback: use the native-resource registry introduced in 4A. NewtonManager.backend = sim.get_or_create_backend(cfg) @classmethod def get_model(cls): # Reading the model no longer constructs anything or scans the stage. return None if cls.backend is None else cls.backend.model ``` This removes late full-stage reconstruction from this rendering path. It does **not** eliminate every geometry scan: deformable metadata is still inspected within the declared source/shared roots. ### 4. Make standalone demos declare what belongs to their scene **Before:** standalone demos could author geometry without a plan, relying on a Newton-backed viewer to discover it later. ```python scene_entities, scene_origins = design_scene() sim.reset() # A viewer could reconstruct its representation from the finished stage. ``` **After:** the quadruped demo declares its roots before authoring and asks the clone lifecycle to build the required representations before reset. ```python # This demo authors independent roots, so it uses a global-only plan. global_paths = ( "/World/defaultGroundPlane", "/World/Light", *(f"/World/Origin{i}" for i in range(1, 8)), ) plan = cloner.make_clone_plan((), 1, 0.0, global_paths=global_paths) sim.set_clone_plan(plan) # Author the declared scene, then build its rendering representations. scene_entities, scene_origins = design_scene() cloner.replicate(plan, replicate_physics=False) # Keep the existing native physics setup. sim.reset() ``` The same minimal migration covers the affected standalone demos and URDF/MJCF previews. `InteractiveScene` handles the ordering automatically; its callers do not need this explicit ceremony. ## Scope and size No new production classes or files. Production **−274 LOC**, tests **−99 LOC** against develop `eaab09fd0` after the conflict-resolution merge. The builder-consolidation follow-up alone removed **122 production lines**, including `visualization_builder.py` and two redundant helper layers. The renderer-registry follow-up removed another **21 production lines** and **93 test lines** while adding teardown-order and registration regressions. Config-keyed sharing now also owns renderer instances; supported native-model sharing cases are unchanged. Independently configured Newton models, singleton query routing, and SDP conversion/copy changes remain outside this PR. Performance samples below retain their explicitly pinned historical baselines; they were not rerun for this merge. ## Initial develop comparison Baseline: merged develop `c90c3a1097a0a669a823b880b1c8d0654d7fd267`. GPU 0, RTX 5090, `Isaac-Lift-KukaAllegro-Camera`, 4096 environments, seed 0, no interactive visualizer. One warm sample each, same installed dependencies/cache and resolved workload configuration. Startup includes imports, construction, reset, and first step. Runtime discards 25 steps, then measures 200 synchronized full environment steps, including actions, camera observations, and episode resets. | Physics → renderer | Startup 4B / develop | Runtime ms/step 4B / develop | Environment FPS 4B / develop | | --- | ---: | ---: | ---: | | Newton MJWarp → Newton | 28.34 / 28.33 s | 46.31 / 45.94 | 88,457 / 89,159 | | OVPhysX → Newton | 62.94 / 62.95 s | 163.02 / 160.83 | 25,126 / 25,468 | These samples preceded the builder-consolidation follow-up. Startup was effectively unchanged; runtime was 0.8% and 1.4% slower respectively, which a single pair cannot establish as significant. This measures incremental 4B, not the later full-refactor optimization stack. All 4096 camera outputs were finite and nonconstant. The separate follow-up check below compares consolidation against its immediate parent; do not combine timings across the two sessions. ### Builder-consolidation follow-up check GPU 0, same 4096-environment workload, seed, dependencies, `_isaac_sim` launcher, 25 discarded steps and 200 measured steps. One warm sample per revision/path. Before is this PR's previous head `2f75d462a8`; after is the consolidated pipeline committed as `b39adbd4d`. Resolved configurations were byte-identical. Earlier temporary-worktree measurements without the matching Isaac Sim launcher were discarded. | Physics → renderer | Startup after / before | Runtime ms/step after / before | Environment FPS after / before | | --- | ---: | ---: | ---: | | Newton MJWarp → Newton | 28.73 / 29.02 s | 50.32 / 48.14 | 81,395 / 85,090 | | OVPhysX → Newton | 68.33 / 65.56 s | 174.20 / 163.59 | 23,513 / 25,038 | These are **not a demonstrated no-regression result**: startup changed −1.0% / +4.2% and runtime +4.5% / +6.5%. There was no competing GPU 0 compute job, but host CPU activity was not isolated. One pair cannot establish whether those differences are repeatable. This follow-up changes construction only, not the stepping/render transport loop. All 4096 camera outputs passed the finite/nonconstant checks. ## Validation - Conflict resolution against develop `eaab09fd0`: preserved upstream MPM particle-range tracking in the shared clone path. 114 focused tests plus four subtests passed, including GPU 0 MPM initialization/reset and OVRTX cleanup checks. Formatting/changelog validation passed against the updated base. - Renderer-registry follow-up: 163 focused CPU tests and 11 profiler-target checks passed. Five regression cases failed when the prior registry methods were substituted: pre-construction global-setting validation and renderer-before-native teardown in both creation orders, with and without cleanup failures. - Builder-consolidation follow-up: 172 focused CPU tests (plus four subtests) and four solver-specific import cases passed, covering cloning, source geometry, renderer registration, visualizer lifecycle, native ownership, and SDP copy/remap behavior. - Regression checks failed on the pre-consolidation commit and passed here: omitted clone positions and excluded deformable rows beneath an overlapping shared root. Public direct replication kept its signature. - Standalone script contract checks passed (launch matrix not run in full). - GPU 0: Newton/OVPhysX → Newton camera smokes; OVPhysX → OVRTX camera smoke; OVPhysX camera + headless Newton GL shared one native model across an ordinary reset; migrated Isaac PhysX marker and OVPhysX deformable demos reached readiness and stepped. - After registry consolidation, repeated 16-environment GPU 0 Kuka camera checks for Newton → Newton, OVPhysX → OVRTX, and OVPhysX → Newton camera + headless Newton GL. All passed, including valid images, model sharing/reset, and teardown. These are correctness smokes, not new matched performance samples. - `uv run --no-sync isaaclab -f` passed, with changelog validation pinned to the actual upstream baseline. After registry consolidation, the full isolated documentation build (`uv run --no-sync isaaclab -d`, using the branch's docs-enabled `dev` extra) passed with warnings treated as errors. The pre-existing forced native-rewarm issue, where some consumers retain old model bindings after STOP/recreation, is not claimed fixed here. Ordinary reset and first initialization are covered. ## Type of change - Refactor and lifecycle correction. - Breaking behavior for external standalone foreign-physics rendering workflows that never declared a plan: declare source/shared roots before cloning. Maintained affected demos are migrated; the cloning guide includes the standalone pattern. - Removed `RenderContext.get_renderer`: use `sim.get_or_create_backend(renderer_cfg)`. Use `sim.render_context` for orchestration; its constructor now takes the shared registry. ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## Checklist - [x] Contribution guidelines read. - [x] Pre-commit checks passed. - [x] Documentation and per-package changelog fragments updated. - [x] Focused tests and GPU smoke checks completed. - [x] Contributor already listed. (cherry picked from commit 335a87b)
…ng docs (#7957) Backports the three changes from the September 20–23 `develop` audit that are missing from `release/3.0.0`, alongside the existing cloning-guide backport: - #7722 (`4cf439dfeb`): reject a second `SimulationContext` construction instead of silently discarding its configuration. Includes the original fixture cleanup and regression coverage. - #7893 (`22fcd71bc4`): validate DelayBuffer lag values before mutating its live configuration. - #7947 (`6e9ef17f59`): make `v3.0.0-EA` the default documentation version in deployment and local multi-version builds. - #7129 (`354168560f`): clarify that `replicate_physics=False` skips the active physics context while other declared replication contexts still run. **Compatibility:** repeated `SimulationContext(...)` calls now raise. Retrieve the live context with `SimulationContext.instance()`, or call `clear_instance()` before constructing a replacement. The original major changelog fragment includes this migration. The runtime and test files match current `develop`. The docs-default backport adapts the release branch's existing redirect template, validates the target page, and preserves explicit overrides. The cloning-guide backport preserves the current release APIs; its obsolete sections were already removed. ## Release audit Checked all **35 PRs** merged into `develop` from **2026-09-20 16:43:18 UTC** through `cff81e8473` (September 23), against release head `5d3e0b695e`. **32 are already covered; the remaining three are included here.** Git history, patch equivalence, GitHub's merged PR list, and remaining file differences were checked. Branch-specific version/changelog compilation and existing release-only changes are preserved. <details> <summary>Already covered PRs</summary> 26 have an equivalent patch in release: #7919, #7922, #7923, #7924, #7925, #6758, #7928, #7902, #7927, #7891, #7931, #7691, #7861, #7929, #7916, #7939, #4609, #7942, #7940, #7948, #7937, #7955, #7960, #7961, #7970, #7958. Six were squash-merged or adapted: #7530 and #7899 in #7926; #7637 in #7933; #7860 in #7936; #7954 and #7950 in #7964. Their implementation differences were checked against the current release tree. </details> ## Validation - **276 tests passed**: SimulationContext (51, including CPU/CUDA), headless context construction (15), nine schema/fragment suites (165), four manager suites (38), and DelayBuffer (7). - Both backported regressions reproduce with the original release implementations. - Docs redirect recipe: local/deployment EA defaults, explicit override, and missing-target rejection passed with a stubbed Sphinx builder. - All 22 changed files match the intended backport scope; `uv run isaaclab -f` and `git diff --check` passed. - Fresh Sphinx validation (`-b dummy -W --keep-going`): passed without warnings, excluding static assets as the HTML builder does. Full HTML documentation CI is running. Local runtime validation used PyTorch 2.12.0, CUDA 13.0, Isaac Sim 6.0.1.0, and an RTX 5090. Existing runtime/deprecation warnings occurred; the CI jobs validate the pinned environments. The previous [docs CI failure](https://github.com/isaac-sim/IsaacLab/actions/runs/35795116307/job/106972539281) was an external connection reset fetching the Omniverse intersphinx inventory, producing one warning under `-W`. That URL returned HTTP 200 when rechecked. This update starts a fresh docs build. --------- Co-authored-by: hujc <[email protected]> Co-authored-by: Zihan Xu <[email protected]>
Description
4A covers cfg-only registry identity and minimal native ownership for PhysX, OVPhysX, Newton, and camera OVRTX. Consumer wiring, query orchestration, and atomic SDP transport remain separate changes.
backend = sim.get_or_create_backend(backend_cfg). Equal cfgs of the same concrete type share a resource; a cache miss calls exactlybackend_cfg.class_type(backend_cfg). Constructor failures leave nothing registered. Removed separate backend types, constructor args/kwargs, and type-only registration.sim.close_backend(backend), selecting the exact registered object withis, without comparing or hashing cfgs. Resources implementclose(); a failed native release retains ownership for retry.PhysxBackendCfg,OvPhysxBackendCfg,NewtonBackendCfg, andOVRTXBackendCfg. Existing physics cfgs continue to select managers; they are not repurposed as native-resource cfgs. Preserved@configclassand"{DIR}"declarations.close()releases only its own camera/query bindings and buffers; the registry closes the shared engine after all renderers and visualizers. Native destruction precedes detached-stage release, including cleanup before attachment. Existing scene export/population is unchanged.backendon managers/renderers, without private aliases or new accessors. The registry remains the owner; native handle access does not replace SDP transport.field(metadata={"copy": False}), so a populated Newton builder is not deep-copied by configclass. Ordinary configuration fields keep their existing independent-copy behavior.sim.clone_contexts[Context] = Context(...). They are plan participants, not native resource owners. Clone routing andreplicate_physics=Falsebehavior are unchanged.cfgfield from all four native resource classes; the registry already retains construction cfgs. Creation still uses config-based get-or-create sharing and exactlycfg.class_type(cfg), without a hash key,cfg.build(), or a new instantiation helper.Native owners remain in existing manager/renderer modules. No new production modules, dependency/lockfile changes, consumer cfg fields, or SDP transport changes. Rerun/Viser keep their lightweight session/server ownership and borrow Newton's model; they do not gain wrapper backend classes. Newton RTX's upstream viewer still owns its private OVRTX engine, which cannot yet be injected through its public API.
Review size: 62 files, +1,290 / −1,141 lines (+149 net). Production Python is now −14 net; tests: +61; exports/documentation/release notes: +102. The identity-close review follow-up removed six production lines and extended existing tests for stale handles, value-equal but distinct resource objects, retry, and equal-cfg OVRTX borrowers. Much of the remaining Newton/OVRTX diff mechanically redirects existing handle access to its single owner. The wider previous version remains preserved at
553575bfafor subsequent work, not part of this diff.Validation
The Newton/OVRTX ownership follow-up additionally passed:
The first legacy OVRTX attempt was stopped after a prolonged first render. Its traced retry completed in 51 s; the native first frame during reset accounts for most of that time and is outside the maintained runtime tool's displayed startup counters. Those camera smoke numbers are not used as startup comparisons.
The public
backendand cleanup follow-up reran 53 configclass/registry lifecycle checks, 200 Newton/shadow/coupling CPU checks, 137 OVPhysX/OVRTX CPU checks (8 CUDA-only skips), 54 Kit/PhysX checks, and 12 Newton GPU reset checks. GPU-0 camera smoke runs again covered Newton→OVRTX in legacy and ovstage modes and OVPhysX→Newton renderer. Formatting/changelog checks and the warning-as-error documentation build also passed. No additional startup/runtime comparison is claimed for this follow-up; the measurements below identify the exact earlier revisions.CI at
89355ab19completed with one failure: an OVPhysX ray-caster test replacedsys.modules, but the earlier view import had already cached the actual enum module on its package. The real binding request was correct.b7b8a2196removed that unnecessary mock and used the real enum, reducing the test by three lines without changing production code. The original test failed with this PR's manager and passed with the base manager; the corrected test passed locally. Formatting/changelog checks passed. The freshrun-cicompleted onb7b8a2196: 47 checks passed, 6 skipped, no failures or pending checks, including the corrected OV test and contrib environments. Docker + Tests run.The subsequent object-identity-close review (
c3d1e92c1) passed 53 core/config tests, 36 Newton CPU lifecycle checks, 95 OV CPU lifecycle/renderer checks (2 CUDA-only skips), 54 Kit/PhysX checks, and 12 Newton GPU reset checks. Both OVRTX transport modes completed live GPU-0 rendering and shutdown. The new ownership assertions failed before the fix and passed afterward. Formatting/changelog checks and strict docs builds passed. Full CI on this latest follow-up is pending; the green CI result above applies tob7b8a2196.Matched warm startup and runtime
Isaac-Cartpole-Direct, 4,096 environments, seed 0, GPU 0 (RTX 5090), no renderer or interactive visualizer. The PhysX/OVPhysX samples below were collected at6026bdb6eversus exact develop basef75767005f; they were not remeasured for the Newton/OVRTX follow-up.Each backend/checkout had a separate cache warm-up process. Isaac PhysX received one reverse-order confirmation because the first pair showed slower runtime. Startup measures script entry through reset and the first completed step, including imports/configuration/application launch; outer uv/CLI bootstrap is excluded. Runtime discards 50 steps and measures 200 full environment steps with GPU synchronization around the block. Environment FPS means environment transitions per second, including action sampling, observations, and automatic resets.
Both tracked checkouts were clean. Resolved cfgs and dependency versions matched; loaded source paths were checked. Both used the same Python environment and Isaac Sim installation. One-second monitoring found no competing GPU-0 compute process. Documentation generation finished before measured samples.
Interpretation: Isaac PhysX startup was lower in both pairs, but its runtime difference reversed sign (+7.9%, then −3.2%). OVPhysX startup was +3.5% and runtime −3.3% in its single pair. These short samples do not establish a speedup or a reproducible runtime regression. No cold-start claim is made.
Local raw measurements, cfgs, invocation records and GPU monitoring:
/tmp/pr4a-ownership-benchmark-20260920/. No benchmark tooling is committed. Earlier timings from the wider PR do not describe this narrowed change.Newton ownership follow-up
One warm matched sample of the tree committed as
d0d2e98a5, after a separate process warm-up on each checkout, with the same 4,096-env task, seed, GPU, Python/dependencies, 50 discarded steps and 200 measured steps. Resolved cfg files matched exactly and imported source paths were verified. The pre-commit working-tree diff is recorded with the measurement.f75767005fStartup was unchanged in this sample; runtime was 3.9% slower. This short single pair does not establish a reproducible regression or speedup. These measurements are not the future full-refactor performance claims. Raw results:
/tmp/pr4a-native-owners-newton-{current,base}-sample/.Checklist