Skip to content

Add opt-in shared OVStage physics and rendering - #8279

Merged
ooctipus merged 8 commits into
isaac-sim:developfrom
ooctipus:shared-ovstage-physics-rendering
Oct 17, 2026
Merged

ooctipus merged 8 commits into
isaac-sim:developfrom
ooctipus:shared-ovstage-physics-rendering

Conversation

@ooctipus

@ooctipus ooctipus commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Adds opt-in sharing of one simulation-owned OVStage between OVPhysX and OVRTX. Clone preparation combines their asset routes, populates both USD domains, and clones once. The default paths remain separate.

Enable sharing with ISAAC_LAB_SHARE_OVSTAGE=1. This requires OVPhysX and selects OVStage rendering regardless of ISAAC_LAB_OVRTX_USE_OVSTAGE. Configure cameras and flags before the first reset.

Without flags, OVPhysX keeps separate physics and rendering stages; Newton uses native OVRTX cloning. The RTX flag alone selects independent OVStage rendering.

  • Camera construction resolves PPISP and authors RTX exposure settings before cloning or importing the scene, including existing cameras (spawn=None). Renderers consume the prepared configuration during normal initialization. The redundant prepare_cameras() phase is removed: custom renderer runtime setup belongs in create_render_data(), with the stage available through self._sim.stage. Author PPISP attributes before constructing the sensor.
  • Shared-stage cameras borrow one OVRTX engine; native logging and transform-cache settings must agree. Rendering reuses the populated scene without another USD export unless a debug dump was requested.
  • Private and shared physics stages use OvstageBackend for population, queries, write ordinals and cleanup. OvPhysxBackend.load() owns detach, rebuild and attach; the manager no longer implements separate stage setup or an ordinal counter. Physics owns private stages and borrows shared ones.
  • Full-stage physics imports are rejected before population because prototype-only cloning would discard authored environment overrides. Disable sharing for those scenes.
  • Native setup imports its dependencies directly and registers the schema paths selected by the existing SDK compatibility layer. Binding cleanup uses the renderer’s resource stack and propagates failures after releasing resources.

Includes the merged #8232 foundation through the base branch; this diff contains only the sharing feature.

Performance: sharing remains opt-in

Kuka Allegro Lift camera, OVPhysX 0.6.3, OVRTX 0.5.0.377615, OVStage 0.2.0.377349, RTX 5090, single_camera,rgb64:

Measured revision / cloning Startup, 128 envs Startup, 1,024 envs Step, 1,024 envs
Develop c9a40a1de, separate OVPhysX + OVStage rendering 24.1 s 70.1 s 80.4 ms
Foundation 0018ae99d, separate OVPhysX + OVStage rendering 22.0 s 70.8 s 81.3 ms
Shared feature eee513324, shared OVStage 51.7 s Stopped at a 180 s process limit before the first image Unavailable

Historical diagnostic runs, one process per configuration. Step time is the median of 60 synchronized steps after 15 warmups. Startup covers environment construction, reset and first image, excluding imports; the process limit includes imports. These runs predate flag separation and were not repeated for this cleanup.

At 128 environments, the physics pose binding used by rendering took 31.14 s with sharing versus 0.63 s without it. The 1,024-environment shared run was still creating physics tensor bindings when stopped. Sharing remains opt-in until upstream cold-binding and shared-stage update performance are fixed and validated; no SDK fix or speedup is assumed.

Validation

48 focused cases passed for 2a9784981: camera construction/output contracts, PPISP configuration, exposure and GPU kernels, Newton lens distortion, Newton and Kit RTX PPISP rendering, and shared OVStage rendering/reset. Existing tests now cover pipeline reuse across image resolutions and preservation of USD schema list edits. The schema-edit regression fails against the old manual metadata merger and passes with AddAppliedSchema(). The earlier construction regression also fails with the pre-fix constructor.

The follow-up removed another 117 production lines net (98 net including tests and changelogs): the extra camera preparation phase, cached stage alias, two controller helpers, repeated normalization after USD discovery, and generic exposure conversion/schema merging. Standalone pipeline normalization is retained for callers passing partial configurations.

The preceding 373c7c4e1 passed 196 focused lifecycle, SDP, renderer, native-view, SDK compatibility, material and shared-stage cases. Test files ran in separate processes; native GPU checks used GPU0 with OVPhysX 0.6.4, OVRTX 0.5.1, and OVStage 0.2.1.

The integration tests cover contact isolation, calibration, shared-engine submission, gravity changes, soft reset, forced reload and USD debug dumps. Schema tests retain host-plugin conflict coverage; version selection is covered at its existing compatibility boundary. The existing renderer lifetime test now verifies failure propagation and complete cleanup, and fails for the intended reason when the previous shutdown implementation is restored.

uv run isaaclab -f, changelog validation and git diff --check passed. Documentation builds are left to CI. These correctness checks do not establish that the historical sharing performance issues are resolved.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings (native runs include existing SDK and Torch warnings)
  • I have validated the changed behavior with focused coverage
  • I have added changelog fragments for the changed packages
  • My name already exists in CONTRIBUTORS.md

@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Oct 2, 2026
@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[High impact] Refactors clone-context lifecycle and physics/rendering stage routing.

The PR should not merge until shared mode honors full-stage requests or explicitly rejects them.

Findings

  1. P1 Full-stage requests are ignored ▶
  2. P2 Sharing flags override test variants ▶

Summary

The PR adds opt-in physics and rendering on one simulation-owned OVStage.

  • OVPhysX and OVRTX can share one simulation-owned OVStage.
  • Clone backends prepare their routes before they create or use native resources.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Clone preparation] --> B{Sharing enabled?}
    B -->|No| C[Native physics cloning]
    B -->|No| D[Independent rendering stage]
    B -->|Yes| E[Combine physics and rendering routes]
    E --> F[Populate and clone one OVStage]
    F --> G[Attach physics]
    F --> H[Attach renderer]
Loading

Reviews (2) · Last reviewed commit: "Simplify OVStage clone selection flags" · Reviewed by Greptile

@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

The opt-in shared OVStage path is coherently integrated across cloning, physics, rendering, and documentation, but it changes the established camera-preparation hook to run with a pre-clone render spec, crosses the physics/rendering lifecycle boundary during stage reuse, retains a dead commented switch as documented behavior, and leaves two important test contracts insufficiently asserted.

  • Design and architecture: The shared OvstageBackend ownership and engine-level render-product registry fit the intended shared-resource model. However, OvPhysxManager._prepare_physx_for_stage_reuse now closes OVRTX renderer wrappers, detaches native renderer engines, and directly updates OVRTXBackend.attached. This gives physics ownership of renderer lifecycle state and violates the repository rule to keep physics and rendering responsibilities separate. Detachment should be owned by OvstageBackend.reset, the renderer backend, or the existing lifecycle-event boundary.
  • Scope and complexity: The feature spans several independently reviewable ownership boundaries despite remaining below the large-PR thresholds. Suggested PR breakdown: 1. Add shared clone-route and OvstageBackend ownership selection, validated through route/domain and resource-identity tests. 2. Add OVPhysX shared-stage attachment, gravity ordinals, and forced-reload lifecycle behavior, validated without renderer-owned teardown logic. 3. Add early camera authoring and define the prepare_cameras invocation contract, with pre-clone and post-clone renderer-extension tests. 4. Add shared OVRTX engine/product submission behavior and its focused renderer tests, followed by documentation and changelog updates.
  • API: OVRTXBackendCfg.scene_key becoming optional and OvPhysxBackendCfg.stage_cfg being added are compatible extensions for the shared-resource path. The existing BaseRenderer.prepare_cameras extension hook is not preserved equivalently: cameras constructed with a simulation now invoke it only during construction, using pre-clone paths alongside clone-plan instance counts, and skip the previous post-clone invocation. Preserve the established final-spec hook and introduce a distinct early-authoring hook if shared-stage population needs an earlier phase.
  • Compatibility and deprecation: Breaking changes: Camera changes the timing and arguments of the existing renderer-facing prepare_cameras hook without a transition path. It now receives a pre-clone path set with clone-plan-derived instance and view counts, while the former post-clone call is omitted for normal camera construction. Existing renderer extensions expecting the finalized camera path set can therefore observe a different contract. The environment-variable opt-in remains disabled by default, and the new configuration fields otherwise retain compatible defaults.
  • Implementation: The gravity commit path, shared-stage export and attachment, guarded stage destruction, and engine-wide product submission were traced. The required implementation correction is to remove OVRTX lifecycle manipulation from _prepare_physx_for_stage_reuse: physics should request shared-stage reset or dispatch the appropriate lifecycle event, while the renderer or stage owner closes bindings, detaches the native engine, and updates its own attachment state. Camera early authoring must likewise use a contract distinct from the finalized render specification.
  • Style consistency: The commented-out use_ovstage |= ... expression is dead executable text, and the public cloner documentation explicitly advertises that source comment as a switch. Delete the commented statement and the documentation sentence that points to it. The useful current limitation—automatic sharing remains deferred because OVPhysX 0.6.3 has cold-binding and path-lookup limitations—can remain as concise rationale.
  • Test quality: The fixture update for OvPhysxBackend.scene is a necessary mechanical adjustment, and extending the existing renderer contract matrix is preferable to duplicating it. Two gaps need correction: retain an assertion that the (use_ovstage=True, with_physics=False) route selects PopulationDomain.RENDERING, alongside the new shared-stage ALL assertion; and make the shared-scene gravity test assert an observable transient pose or velocity that distinguishes the -5 and -10 updates. As written, the resting poses and finite-depth checks can pass if those mid-run gravity updates are dropped.

Significant concerns. Posted 5 actionable findings inline.

Automated review; human maintainers own approval decisions.

@ooctipus
ooctipus requested a review from hujc7 as a code owner October 2, 2026 22:58
@ooctipus
ooctipus changed the base branch from ooctipus/ov-clone-foundation to develop October 8, 2026 00:14
@ooctipus
ooctipus requested a review from fatimaanes as a code owner October 8, 2026 00:14
@ooctipus
ooctipus requested a review from a team October 8, 2026 00:14
@ooctipus ooctipus closed this Oct 14, 2026
@ooctipus
ooctipus deleted the shared-ovstage-physics-rendering branch October 14, 2026 14:28
@ooctipus
ooctipus restored the shared-ovstage-physics-rendering branch October 14, 2026 15:04
@ooctipus ooctipus reopened this Oct 14, 2026
Comment thread source/isaaclab_tasks/test/conftest.py Resolved
@ooctipus
ooctipus force-pushed the shared-ovstage-physics-rendering branch from e731954 to 7444780 Compare October 16, 2026 03:21
@ooctipus

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 16, 2026
@ooctipus
ooctipus force-pushed the shared-ovstage-physics-rendering branch from 7444780 to 53d7696 Compare October 16, 2026 03:53
@isaaclab-bot isaaclab-bot Bot removed the ci:run-docker Trigger the on-demand Docker and GPU CI workflow label Oct 17, 2026
@ooctipus

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 17, 2026
@ooctipus

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 17, 2026
@ooctipus

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 17, 2026
@ooctipus

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 17, 2026
@ooctipus

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 17, 2026
@ooctipus

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 17, 2026

# Complete camera authoring before cloning or importing the scene into a native backend.
if self.cfg.isp_cfg is not None:
from isaaclab_ppisp import apply_rtx_exposure_overrides, resolve_and_normalize

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can allow this inline import here, but theres another PR that removes isaaclab_ppisp so this will change/conflict with there


# Native metadata and bindings must see the newly attached bodies, including on CPU.
cls._warmup_physx(cls.backend.physx)
getattr(cls.backend.physx, OVPHYSX_LIFECYCLE_ENTRY_POINTS["warmup"])()

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.

Let's not use getattr

@@ -1,37 +0,0 @@
# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).

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.

the fact this file ever existed is alarming....

@ooctipus
ooctipus merged commit 7860b47 into isaac-sim:develop Oct 17, 2026
59 checks passed
@ooctipus
ooctipus deleted the shared-ovstage-physics-rendering branch October 17, 2026 05:42
@ooctipus ooctipus mentioned this pull request Oct 19, 2026
6 of 8 tasks
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.

2 participants