Repository navigation
Add opt-in shared OVStage physics and rendering - #8279
Conversation
|
There was a problem hiding this comment.
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
OvstageBackendownership and engine-level render-product registry fit the intended shared-resource model. However,OvPhysxManager._prepare_physx_for_stage_reusenow closes OVRTX renderer wrappers, detaches native renderer engines, and directly updatesOVRTXBackend.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 byOvstageBackend.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
OvstageBackendownership 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 theprepare_camerasinvocation 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_keybecoming optional andOvPhysxBackendCfg.stage_cfgbeing added are compatible extensions for the shared-resource path. The existingBaseRenderer.prepare_camerasextension 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:
Camerachanges the timing and arguments of the existing renderer-facingprepare_camerashook 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.sceneis 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 selectsPopulationDomain.RENDERING, alongside the new shared-stageALLassertion; and make the shared-scene gravity test assert an observable transient pose or velocity that distinguishes the-5and-10updates. 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.
e731954 to
7444780
Compare
|
run-ci |
7444780 to
53d7696
Compare
|
run-ci |
|
run-ci |
|
run-ci |
|
run-ci |
|
run-ci |
|
run-ci |
|
|
||
| # 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 |
There was a problem hiding this comment.
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"])() |
| @@ -1,37 +0,0 @@ | |||
| # Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). | |||
There was a problem hiding this comment.
the fact this file ever existed is alarming....
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 ofISAAC_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.
spawn=None). Renderers consume the prepared configuration during normal initialization. The redundantprepare_cameras()phase is removed: custom renderer runtime setup belongs increate_render_data(), with the stage available throughself._sim.stage. Author PPISP attributes before constructing the sensor.OvstageBackendfor 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.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:c9a40a1de, separate OVPhysX + OVStage rendering0018ae99d, separate OVPhysX + OVStage renderingeee513324, shared OVStageHistorical 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 withAddAppliedSchema(). 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
373c7c4e1passed 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 andgit diff --checkpassed. Documentation builds are left to CI. These correctness checks do not establish that the historical sharing performance issues are resolved.Checklist
uv run isaaclab --formatCONTRIBUTORS.md