Skip to content

Fixes CPU pipeline stage initialization in PhysxManager - #4675

Merged
kellyguo11 merged 4 commits into
isaac-sim:developfrom
kellyguo11:fix-cpu-issue
Feb 24, 2026
Merged

kellyguo11 merged 4 commits into
isaac-sim:developfrom
kellyguo11:fix-cpu-issue

Conversation

@kellyguo11

Copy link
Copy Markdown
Contributor

Description

In recent PhysicsManager refactoring, behavior in the PhysxManager changed to call attatch_stage by default for initialization.
This triggered a side effect in CPU pipeline that caused objects to miss contacts and collisions.

It appears that attach stage to PhysX before loading/starting is only needed for GPU pipeline. So in this change, we are guarding this call to run on GPU pipeline only and avoid it on CPU pipeline to avoid issues in collisions.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

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

@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Feb 21, 2026
@greptile-apps

greptile-apps Bot commented Feb 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a CPU collision detection bug introduced during the PhysicsManager refactoring (#4564). The recent refactoring added an unconditional call to attach_stage() in the warmup process, which was intended to fix GPU pipeline initialization. However, this caused a double-initialization issue on the CPU pipeline where attach_stage() combined with force_load_physics_from_usd() corrupts the CPU broadphase (MBP) collision setup, causing objects to fall through surfaces non-deterministically.

Key changes:

  • Added device detection to check if GPU pipeline is in use (is_gpu = "cuda" in PhysicsManager.get_device())
  • Wrapped the attach_stage() call in a conditional that only executes for GPU pipeline
  • Added detailed comments explaining why this separation is necessary and the root cause of the CPU collision bug

The fix aligns with the original behavior where the old SimulationManager never called attach_stage() explicitly on CPU pipeline.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is well-targeted and addresses a specific regression introduced in a recent refactoring. The change is minimal (7 lines modified), follows the same device detection pattern used elsewhere in the codebase (line 448), and includes clear explanatory comments. The fix restores the original CPU pipeline behavior while preserving the GPU pipeline fix.
  • No files require special attention

Important Files Changed

Filename Overview
source/isaaclab_physx/isaaclab_physx/physics/physx_manager.py Conditionally calls attach_stage() only for GPU pipeline to fix CPU collision detection issue caused by double-initialization of broadphase collision setup

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[_warmup_and_create_views called] --> B{Check device type}
    B -->|GPU pipeline<br/>cuda in device| C[attach_stage]
    B -->|CPU pipeline<br/>cpu device| D[Skip attach_stage]
    C --> E[force_load_physics_from_usd]
    D --> E
    E --> F[start_simulation]
    F --> G[update_simulation]
    G --> H[Create SimulationView]
    H --> I[Physics Ready]
    
    C -.->|Prevents| J[GPU buffer allocation issues]
    D -.->|Prevents| K[CPU broadphase MBP<br/>double-initialization]
    K -.->|Would cause| L[Objects fall through surfaces]
Loading

Last reviewed commit: 90894d0

@greptile-apps greptile-apps 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.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@kellyguo11
kellyguo11 merged commit b5ad669 into isaac-sim:develop Feb 24, 2026
6 of 9 checks passed
@kellyguo11 kellyguo11 mentioned this pull request Jul 23, 2026
7 tasks done
kellyguo11 added a commit that referenced this pull request Jul 23, 2026
# Description

Restore the CPU PhysX stage-initialization path from #4675 while
preserving the
Isaac Sim core-extension removal from #6499.

#6499 removed `isaacsim.core.simulation_manager`, which also removed the
registration bridge between the unified physics API and PhysX. The
replacement
CPU path explicitly attached the stage and skipped
`force_load_physics_from_usd()`. This reintroduced non-deterministic CPU
broadphase collision failures, observed by the SkillGen test in #6687.

This change:

- adds `omni.physics.physx` to the GUI and headless app experiences so
PhysX is
  registered without restoring the Isaac Sim core extension or its Warp
  dependency;
- restores the pre-#6499 warmup behavior: only GPU explicitly attaches
the
  stage, while CPU uses `force_load_physics_from_usd()`;
- updates the regression test to verify the bridge is enabled, CPU does
not call
  `attach_stage()`, and CPU force-loads exactly once.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Screenshots

Not applicable.

## Validation

- `uv run python -m pytest
source/isaaclab_physx/test/assets/test_rigid_object.py::test_warmup_attach_stage_not_called_for_cpu
source/isaaclab_physx/test/assets/test_rigid_object.py::test_initialization
-q`
  - 5 passed across CPU and GPU initialization.
- CPU SkillGen environment creation and 20 random-action steps passed
for
  `IsaacContrib-Stack-Cube-Franka-IK-Rel-Skillgen`.
- `uv run python tools/changelog/cli.py check develop`
- `uv run isaaclab -f`

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`uv run isaaclab -f`
- [x] Documentation changes are not required for this internal lifecycle
fix
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective
- [x] I have added a changelog fragment under
`source/isaaclab_physx/changelog.d/`
- [x] My name already exists in `CONTRIBUTORS.md`
matthewtrepte pushed a commit to matthewtrepte/IsaacLab that referenced this pull request Aug 4, 2026
# Description

Restore the CPU PhysX stage-initialization path from isaac-sim#4675 while
preserving the
Isaac Sim core-extension removal from isaac-sim#6499.

isaac-sim#6499 removed `isaacsim.core.simulation_manager`, which also removed the
registration bridge between the unified physics API and PhysX. The
replacement
CPU path explicitly attached the stage and skipped
`force_load_physics_from_usd()`. This reintroduced non-deterministic CPU
broadphase collision failures, observed by the SkillGen test in isaac-sim#6687.

This change:

- adds `omni.physics.physx` to the GUI and headless app experiences so
PhysX is
  registered without restoring the Isaac Sim core extension or its Warp
  dependency;
- restores the pre-isaac-sim#6499 warmup behavior: only GPU explicitly attaches
the
  stage, while CPU uses `force_load_physics_from_usd()`;
- updates the regression test to verify the bridge is enabled, CPU does
not call
  `attach_stage()`, and CPU force-loads exactly once.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Screenshots

Not applicable.

## Validation

- `uv run python -m pytest
source/isaaclab_physx/test/assets/test_rigid_object.py::test_warmup_attach_stage_not_called_for_cpu
source/isaaclab_physx/test/assets/test_rigid_object.py::test_initialization
-q`
  - 5 passed across CPU and GPU initialization.
- CPU SkillGen environment creation and 20 random-action steps passed
for
  `IsaacContrib-Stack-Cube-Franka-IK-Rel-Skillgen`.
- `uv run python tools/changelog/cli.py check develop`
- `uv run isaaclab -f`

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`uv run isaaclab -f`
- [x] Documentation changes are not required for this internal lifecycle
fix
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective
- [x] I have added a changelog fragment under
`source/isaaclab_physx/changelog.d/`
- [x] My name already exists in `CONTRIBUTORS.md`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants