Skip to content

Improve Startup Time - Newton Batched Model Builder#6430

Draft
StafaH wants to merge 6 commits into
isaac-sim:developfrom
StafaH:mh/batched_model_builder
Draft

Improve Startup Time - Newton Batched Model Builder#6430
StafaH wants to merge 6 commits into
isaac-sim:developfrom
StafaH:mh/batched_model_builder

Conversation

@StafaH

@StafaH StafaH commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

StafaH added 6 commits July 7, 2026 18:51
Replicating environments into the Newton model previously called
ModelBuilder.add_builder once per environment and then rewrote entity
labels in a second pass over the whole builder. Both steps are Python
loops whose cost grows superlinearly with the environment count and
dominate startup time for large scenes.

Add BatchedModelBuilder and replicate_builder_mapping_batched, which
consume the same clone-plan mapping inputs but append all worlds in one
vectorized pass over cached per-source arrays, writing final
per-environment labels directly so no rename pass is needed. Homogeneous
and heterogeneous clone plans are supported; scenes with per-world
builder hooks (e.g. MPM/deformable objects) fall back to the legacy path
with a warning.

The batched path is opt-in via NewtonCfg.use_batched_model_builder (or
the explicit newton_physics_replicate_batched entry point); the legacy
path remains the default and existing callers are unchanged. Also add
compare_builder_states/compare_finalized_models for validating that two
builders or finalized models are equivalent.

For Isaac-Lift-KukaAllegro-Camera at 4096 envs, scene creation drops
from 14.1s to 5.4s (replication itself from ~11s to ~1s).
Compare the legacy replicate+rename path against the batched path on
identical inputs: builder state (all fields, exact), finalized models,
site maps, world transforms, and Fabric body bindings. Covers a single
world, many homogeneous worlds, heterogeneous variant mappings,
multi-row worlds, worlds without rows, env-root and injected source
sites, destination builders with pre-existing global entities, and an
end-to-end Isaac-Lift-KukaAllegro-Camera scene with the newton_mjwarp
preset. Also verifies the vectorized float32 transform composition is
bitwise-identical to Warp's builtins.
benchmark_model_builder.py times build, finalize, and total time for the
legacy and batched Newton replication paths across configurable tasks
and world counts, printing a comparison table with per-row speedups and
writing JSON/CSV. Each task runs in its own subprocess (Isaac Sim can
launch once per process); --verify cross-checks that both paths produce
equivalent builders.
replicate_builder_mapping built the per-label site map via setdefault,
whose default argument allocates a num_worlds list on every call - once
per (world, site label) - making startup quadratic in the environment
count when sites are registered. Precompute the map for all labels once.

Also pass the configured physics device to wp.ScopedCapture so CUDA
graph capture does not select the default GPU on multi-GPU machines.
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jul 8, 2026
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.

1 participant