Skip to content

[Startup] Avoid replicated Shadow Hand camera USD work - #7036

Open
StafaH wants to merge 1 commit into
isaac-sim:developfrom
StafaH:mh/startup-reorient-replicate-session
Open

[Startup] Avoid replicated Shadow Hand camera USD work#7036
StafaH wants to merge 1 commit into
isaac-sim:developfrom
StafaH:mh/startup-reorient-replicate-session

Conversation

@StafaH

@StafaH StafaH commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Spawns the Shadow Hand robot, cube, and tiled camera only under /World/envs/env_0 through each asset spawner spawn_path. The asset prim_path remains a regex for runtime views, and the existing scene clone plan owns replication to the remaining environments.

This keeps prototype-spawn ownership in task configuration and avoids task-side config rewriting or global spawner changes.

The following 4,096-environment measurements exclude omni.client.stat asset-resolution overhead. Hub failed to launch on the benchmark machine, causing an unrelated approximately 12.7-second CloudFront metadata lookup in both runs.

Metric Base (d00e811e) Config fix (ce4a492) Improvement
Scene creation, excluding asset stat 23.42 s 4.23 s 19.19 s (81.9%)
Simulation start 19.48 s 13.88 s 5.60 s (28.7%)
Environment creation, excluding asset stat 45.15 s 20.35 s 24.80 s (54.9%)

For reproducibility, the raw wall-clock values were 36.11 s → 16.90 s for scene creation and 57.84 s → 33.03 s for environment creation. The profiled omni.client.stat time was 12.69 s in the base run and 12.68 s in the fixed run.

Measured on the same RTX 5090 / Threadripper PRO 7965WX machine with warm local asset and kernel caches:

uv run --no-sync --frozen isaaclab benchmark startup \
  --task IsaacContrib-Reorient-Cube-Shadow-Camera-Benchmark-Direct \
  --num_envs 4096 \
  physics=newton_mjwarp \
  renderer=newton_renderer \
  --benchmark_formatter summary

Validation:

  • Completed environment startup, reset, and first simulation step.
  • Passed ./isaaclab.sh -f.

@StafaH
StafaH requested a review from a team August 12, 2026 06:57
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Aug 12, 2026
@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR reduces Shadow Hand startup work by constructing assets inside ReplicateSession, allowing pure headless Newton Warp runs to consume clone prototypes directly, and avoiding model-wide camera frame validation scans.

  • Adds conditional suppression of automatic concrete USD replication for headless Newton Warp rendering.
  • Changes backend USD replication to use compact internal references while preserving copy behavior for standalone replication.
  • Resolves camera prototypes from clone plans and reuses prototype camera schemas and intrinsics.
  • Migrates reorientation scene setup to ReplicateSession and adds an optional Newton frame-validation fast path.

Confidence Score: 4/5

The PR should not merge until explicitly configured USD replication remains honored on the headless Newton Warp path.

The optimization conflates automatic and explicit UsdReplicateContext entries, silently overriding a supported configuration that requests concrete USD clones.

Files Needing Attention: source/isaaclab/isaaclab/cloner/replicate_session.py

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/cloner/replicate_session.py Adds automatic USD-consumer detection, but incorrectly suppresses explicitly requested UsdReplicateContext entries on the optimized path.
source/isaaclab/isaaclab/cloner/usd.py Changes backend clones to internal USD references while retaining CopySpec semantics for standalone usd_replicate calls.
source/isaaclab/isaaclab/sensors/camera/camera.py Resolves cameras through clone prototypes and reuses source camera schemas and intrinsics for Newton rendering.
source/isaaclab_newton/isaaclab_newton/sim/views/newton_site_frame_view.py Adds an optional switch to skip model-wide body and shape label validation for already validated camera prims.
source/isaaclab_tasks/isaaclab_tasks/core/reorient/reorient_direct_env.py Moves reorientation asset construction into ReplicateSession while preserving ground setup and PhysX collision filtering.
source/isaaclab_tasks/isaaclab_tasks/core/reorient/config/shadow_hand/shadow_hand_direct_camera_env.py Moves Shadow Hand camera scene construction into a single ReplicateSession to avoid eager per-environment authoring.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[ReplicateSession queues assets and camera] --> B{Headless Newton with only newton_warp?}
  B -->|No| C[Compose concrete USD destinations]
  B -->|Yes| D[Build Newton model and publish clone plan]
  D --> E[Camera resolves prototype paths from clone plan]
  E --> F[Newton renderer creates per-environment views]
Loading

Reviews (1): Last reviewed commit: "Avoid redundant replicated camera USD wo..." | Re-trigger Greptile

Comment on lines +124 to +125
if replicate_physics and not automatic_usd_replication and renderer_type == "newton_warp":
contexts = [context for context in contexts if context is not UsdReplicateContext]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Explicit USD replication is discarded

When a headless Newton Warp configuration explicitly includes UsdReplicateContext in cloning_contexts, this filter removes that context along with automatically selected contexts, causing the requested concrete per-environment USD prims to remain unauthored for stage-based consumers.

Knowledge Base Used: IsaacLab Core Simulation Layer

@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 startup optimization and ReplicateSession migration are coherent, but two cloner API contracts need correction: explicitly requested USD replication is suppressed for Newton Warp cameras, and UsdReplicateContext(stage) now defaults to reference composition instead of copy-spec semantics.

  • Design and architecture: Using clone-plan prototypes for headless Newton cameras is consistent with the optimization goal. However, the dispatch layer must preserve explicit cloning contexts as an override, and reference-based replication should be an explicit backend choice rather than an implicit default for every direct context user.
  • API: The filter in replicate() contradicts the documented guarantee that explicit contexts are honored by removing a caller-supplied UsdReplicateContext. Separately, changing the default UsdReplicateContext behavior from independent copied specs to live internal references materially changes existing callers, while usd_replicate() explicitly retains the previous behavior.
  • Implementation: The reorientation environments correctly move asset construction into ReplicateSession, and the camera/Newton paths consistently consume clone-plan prototypes. Before merge, retain caller-provided USD contexts and either preserve copy-spec behavior as the UsdReplicateContext default or provide the required compatibility and migration treatment for the semantic change.

Minor fixes needed. Posted 2 actionable findings inline.

Automated review; human maintainers own approval decisions.

@@ -87,10 +120,13 @@ def replicate(plan: ClonePlan, *, stage: Usd.Stage, replicate_physics: bool = Tr
contexts = [backend_physics_ctx] if backend_physics_ctx else []
else:
contexts = [string_to_callable(c) if isinstance(c, str) else c for c in cfg.cloning_contexts]
renderer_type = getattr(getattr(cfg, "renderer_cfg", None), "renderer_type", None)
if replicate_physics and not automatic_usd_replication and renderer_type == "newton_warp":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Api — Explicit UsdReplicateContext silently dropped

When cloning_contexts is unset, contexts holds only the physics context, so this filter can only strip a UsdReplicateContext the caller listed explicitly. That contradicts the docstring retained at line 85 ("Explicit contexts are honored") and leaves no way to request concrete USD destinations in a headless Newton camera run. Gate only the automatic setdefault at line 129 and leave caller-provided contexts intact.

Comment thread source/isaaclab/isaaclab/cloner/usd.py Outdated

replicate_priority = 100

def __init__(self, stage: Usd.Stage):
def __init__(self, stage: Usd.Stage, *, use_references: bool = True):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Warning · Api — Public context default flips to references

UsdReplicateContext(stage) previously authored an independent Sdf.CopySpec per destination; it now composes internal references, so destination specs no longer carry copied properties and later source-layer edits propagate to clones. usd_replicate opting out with use_references=False shows the semantics differ materially. Keep use_references=False as the default and opt in at the backend dispatch site, or document the change and migration in the changelog fragment.

Spawn the Shadow Hand, cube, and camera only in the source environment so the existing clone plan owns replication. Keep regex prim paths for runtime views while avoiding redundant USD authoring at large environment counts.
@ooctipus
ooctipus force-pushed the mh/startup-reorient-replicate-session branch from 96e5315 to ce4a492 Compare August 13, 2026 10:41
@ooctipus

ooctipus commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Reworked the fix so prototype-spawn ownership stays in the task configuration.

The Shadow Hand robot, cube, and tiled camera retain their regex prim_path for runtime views, while their spawner spawn_path points to /World/envs/env_0. The existing scene clone plan then replicates that single authored prototype to the remaining environments. This removes task-side config rewriting and avoids changing global spawner behavior.

These are fresh measurements from the replacement implementation, not the measurements previously reported on this PR. Both runs used the same RTX 5090 / Threadripper PRO 7965WX machine, 4,096 environments, and warm local asset and kernel caches.

Hub failed to launch on this machine and added an unrelated approximately 12.7-second CloudFront metadata lookup through omni.client.stat in both runs. The primary table excludes that measured external asset-resolution overhead:

Metric Fresh base run (d00e811e) Fresh config-fix run (ce4a492) Improvement
Scene creation, excluding asset stat 23.42 s 4.23 s 19.19 s (81.9%)
Simulation start 19.48 s 13.88 s 5.60 s (28.7%)
Environment creation, excluding asset stat 45.15 s 20.35 s 24.80 s (54.9%)

Raw wall-clock values were 36.11 s → 16.90 s for scene creation and 57.84 s → 33.03 s for environment creation. Profiled omni.client.stat time was 12.69 s in the base run and 12.68 s in the fixed run.

Run provenance:

  • Base report timestamp: 2026-08-13T02:22:11
  • Config-fix report timestamp: 2026-08-13T03:35:01
  • Command: uv run --no-sync --frozen isaaclab benchmark startup --task IsaacContrib-Reorient-Cube-Shadow-Camera-Benchmark-Direct --num_envs 4096 physics=newton_mjwarp renderer=newton_renderer --benchmark_formatter summary

The fixed run completed environment startup, reset, and the first simulation step. The full ./isaaclab.sh -f pre-commit suite also passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants