Skip to content

Filter immovable collision pairs and tighten MJWarp capacities in NIST - #9202

Merged
kellyguo11 merged 1 commit into
isaac-sim:mainfrom
mehdiataei:mataei/nist-newton-perf
Nov 24, 2026
Merged

kellyguo11 merged 1 commit into
isaac-sim:mainfrom
mehdiataei:mataei/nist-newton-perf

Conversation

@mehdiataei

Copy link
Copy Markdown
Contributor

Description

Improves 4,096-env IsaacContrib-NIST-Franka (20-variant) PPO training throughput by ~31% (1.31x) with exact dynamic physics and zero solver overflows via two targeted changes:

  1. Expose include_static_kinematic_pairs on NewtonCollisionPipelineCfg and disable it in NISTEnvCfg

    • Newton's CollisionPipeline already supports include_static_kinematic_pairs: bool = True to filter static–kinematic and kinematic–kinematic pairs in the broadphase, but NewtonCollisionPipelineCfg did not yet expose it.
    • In NISTEnvCfg, ground is static while table, nistboard, and fixed_asset (bolts/sockets/gear bases) are kinematic (kinematic_enabled=True). Because they rest against each other (ground ↔ table, table ↔ nistboard, nistboard ↔ fixed_asset, table ↔ fixed_asset), Newton's 256³ SDF narrowphase was generating ~63% of all scene contacts (311.7k total vs 114.1k dynamic) that MuJoCo Warp immediately discards because two immovable bodies cannot exert constraint impulses on each other.
    • Setting include_static_kinematic_pairs=False in NISTEnvCfg removes only immovable-vs-immovable pairs while keeping 100% of dynamic contacts untouched — including the assembly_contact sensor between the dynamic HeldAsset and kinematic FixedAsset. The default remains True on NewtonCollisionPipelineCfg, so no other task changes behavior.
  2. Right-size MJWarp solver capacities in NISTEnvCfg (njmax: 3000 → 1024, nconmax: 600 → 256)

    • Across all 20 variants (all 140/140 reset-accumulator cells, including gear meshes, full 8,192-state precollection, and 5 PPO rollout iterations at 4,096 envs), measured runtime peaks were nefc_peak = 283 (max 311 across runs) and nacon_per_world_peak = 165, with overflow_max = 0.
    • njmax=1024, nconmax=256 matches pyramidal friction cone scaling (4 × 256 = 1024) with ~3.3–3.6× headroom on constraint rows and ~1.55× headroom on per-world contacts while significantly reducing MJWarp solver memory bandwidth.

Benchmark (IsaacContrib-NIST-Franka, 4,096 envs, 20 variants, RTX PRO 6000 Blackwell MIG 2g.48gb)

Configuration Uninstrumented PPO Iter Rollout Collection (32 steps) Throughput Reset Precollect (4,096) Newton SDF Contacts (mean) MJWarp Contacts (mean) Peak nefc / nacon Overflows
Stock main (include_sk=True, 3000/600) 3,876 ms 3,434 ms 33.8k steps/s ~6.9 s 311,694 114,057 291 / 151 0
include_sk=False only (3000/600) 3,662 ms (+5.9%) 3,234 ms 35.8k steps/s ~5.4 s 114,682 114,682 231 / 165 0
include_sk=False + 1536/300 3,172 ms (+22.2%) 2,749 ms 41.3k steps/s ~5.0 s 115,149 115,149 311 / 148 0
This PR (include_sk=False + 1024/256) 2,963 ms (+30.8%) 2,537 ms (+35.4%) 44.2k steps/s ~5.0 s 115,487 (2.7× fewer) 115,487 292 / 143 (8,192-table 5-iter stress: 283 / 165) 0

Type of change

  • New feature (non-breaking change which adds functionality)
  • Performance improvement (exact physics; default behavior unchanged outside NIST)

Validation

  • Added behavioral GPU test test_collision_cfg_filters_static_and_kinematic_pairs in source/isaaclab_newton/test/physics/test_newton_manager.py verifying that include_static_kinematic_pairs=False removes static–kinematic and kinematic–kinematic pairs while preserving dynamic–kinematic contacts.
  • Passed all 80 tests in source/isaaclab_newton/test/physics/test_newton_manager.py and source/isaaclab_tasks/test/contrib/test_nist_reset_monitor.py.
  • Stress-tested IsaacContrib-NIST-Franka at 4,096 envs with full state_table_size=8192 (140/140 joint cells populated) and 5 PPO iterations: nefc_peak=283, nacon_per_world_peak=165, overflow_max=0.
  • Passed ruff check, ruff format --check, and git diff --check.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the formatting and lint checks (ruff check / ruff format --check)
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package
  • My name is included in CONTRIBUTORS.md (via Add isaaclab_neural integration for Newton neural robot dynamics #9200)

Expose Newton's include_static_kinematic_pairs option on NewtonCollisionPipelineCfg
(default True) and disable static/kinematic-vs-kinematic SDF collision pairs in
NISTEnvCfg along with compact MJWarp solver capacities (njmax=1024, nconmax=256).

On 4,096-env IsaacContrib-NIST-Franka (20 variants), this eliminates ~63% of
redundant SDF contacts (312k -> 115k) and improves end-to-end PPO throughput by
~31% (33.8k -> 44.2k steps/s) with zero solver overflows across full 8,192-state
reset precollection and rollout.

Signed-off-by: Mehdi Ataei <[email protected]>
@mehdiataei
mehdiataei requested a review from a team November 24, 2026 20:55
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Nov 24, 2026

@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

Needs attention: Scope and over-engineering (1), Style consistency (2), Test quality (1). Other reviewed categories look good.

  • PR description: The title matches the diff and measurements support workload-specific gains; qualify equivalence and overflow claims, and add reproducible baseline/candidate revisions, command, backend versions, warmup, and sample count to the supplied hardware/environment metrics.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: Minimal implementation: extend existing NewtonCollisionPipelineCfg and NISTEnvCfg through the current pipeline path, retain the behavioral test and package changelogs, and collapse the test’s discarded contact list into a set; no source modules were added. Scope is cohesive; no split recommended.
  • API: API changes look good.
  • Compatibility and deprecation: No breaking changes identified.
  • Implementation: Implementation looks good.
  • Style consistency: The added assertion comment claims both baseline pair categories exist although the OR requires only one; retain the body-ID mapping and remove that inaccurate claim.
  • Test quality: The baseline OR permits either filtered pair category to be absent, leaving its removal unproven; require both static–kinematic and kinematic–kinematic baseline pairs in the existing distinct GPU fixture.

Minor fixes needed. Posted 4 inline findings.

Automated review; human maintainers own approval decisions.


@pytest.mark.kitless
@pytest.mark.parametrize("device", test_devices(DeviceScope.CUDA))
def test_collision_cfg_filters_static_and_kinematic_pairs(device):

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 · Style Consistency — Annotate the new test signature

The new function omits its parameter and return annotations, contrary to the type-hinting guide. Annotate device and add -> None.

s0 = backend.contacts.rigid_contact_shape0.numpy()[:n]
s1 = backend.contacts.rigid_contact_shape1.numpy()[:n]
shape_body = backend.model.shape_body.numpy()
return [tuple(sorted((int(shape_body[a]), int(shape_body[b])))) for a, b in zip(s0, s1)]

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 · Scope Complexity — Avoid an intermediate contact list

Both callers immediately turn this list into a set, allocating a representation they discard. Return a set comprehension and update the annotation.

with_immovable = set(_run_collision(True))
without_immovable = set(_run_collision(False))

# Static (-1) vs kinematic (0, 1) and kinematic (0) vs kinematic (1) are present by default and filtered when False.

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 · Style Consistency — Keep only the body-ID explanation

The comment narrates the assertions and claims both pairs are present when the next assertion requires only one. Keep the useful body-ID mapping; remove the narrated claim.

without_immovable = set(_run_collision(False))

# Static (-1) vs kinematic (0, 1) and kinematic (0) vs kinematic (1) are present by default and filtered when False.
assert (-1, 0) in with_immovable or (0, 1) in with_immovable

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 · Test Quality — Require both baseline pair categories

The OR allows either immovable pair category to be absent before filtering, so its removal remains unproven. Require both static–kinematic and kinematic–kinematic baseline pairs.

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes reach Newton collision settings and NIST training runs.

The PR appears safe to merge, with a non-blocking gap in the new test.

Findings

  1. P2 One pair type goes unchecked ▶

Summary

Exposes Newton’s immovable-pair filter and enables it for NIST while reducing MJWarp capacities.

  • Newton collision settings can skip contacts between immovable bodies.
  • NIST training skips fixed-body contacts and uses smaller solver limits.

Reviews (1) · Last reviewed commit: "Filter immovable collision pairs and tig..." · Reviewed by Greptile

without_immovable = set(_run_collision(False))

# Static (-1) vs kinematic (0, 1) and kinematic (0) vs kinematic (1) are present by default and filtered when False.
assert (-1, 0) in with_immovable or (0, 1) in with_immovable

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.

P2 One pair type goes unchecked

The or assertion only requires one immovable pair type to exist when filtering is off. The test still passes if Newton stops generating either static–kinematic or kinematic–kinematic contacts in both modes. Assert both baseline pairs separately so the test checks that the flag controls both promised pair types.

Suggested change
assert (-1, 0) in with_immovable or (0, 1) in with_immovable
assert (-1, 0) in with_immovable
assert (0, 1) in with_immovable

@kellyguo11
kellyguo11 enabled auto-merge (squash) November 24, 2026 22:23
@kellyguo11

Copy link
Copy Markdown
Contributor

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 Nov 24, 2026
@kellyguo11
kellyguo11 merged commit 6e2c6d4 into isaac-sim:main Nov 24, 2026
95 of 96 checks passed
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.

3 participants