Skip to content

Fix SkillGen quad mesh triangulation segfault with --device cpu - #8418

Merged
kellyguo11 merged 1 commit into
isaac-sim:developfrom
njawale42:neel/skillgen_bin_triangulation_segfault
Oct 9, 2026
Merged

kellyguo11 merged 1 commit into
isaac-sim:developfrom
njawale42:neel/skillgen_bin_triangulation_segfault

Conversation

@njawale42

Copy link
Copy Markdown
Contributor

Description

cuRobo's quad-mesh triangulation (curobo/util/usd_helper.py) creates its Warp arrays on CUDA but calls wp.launch() without a device, so the kernel runs on Warp's default device. Since #7658, SimulationContext sets the Warp default
device to the sim device, so --device cpu runs execute the CPU-compiled kernel against CUDA pointers.

Fix: wrap the planner's get_obstacles_from_stage() call in wp.ScopedDevice(f"cuda:{cuda_device}") so cuRobo's deviceless launch lands on the device its arrays live on.

Type of change

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

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • My changes generate no new warnings
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@njawale42
njawale42 requested a review from a team October 9, 2026 06:37
@github-actions github-actions Bot added the isaac-mimic Related to Isaac Mimic team label Oct 9, 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: Implementation (1). Other reviewed categories look good.

  • PR description: The title and body match the diff and make no performance claim; add the exact --device cpu regression command and before/after result to document validation.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: No over-engineering issues.
  • API: API changes look good.
  • Compatibility and deprecation: No breaking changes identified.
  • Implementation: The new scope rebuilds the CUDA device from configuration instead of using self.tensor_args.device, creating a second resolution owner; pass str(self.tensor_args.device) to wp.ScopedDevice.
  • Style consistency: Style consistency looks good.
  • Test quality: Test quality looks good.

Minor fixes needed. Posted 1 inline finding.

Automated review; human maintainers own approval decisions.

# kernel on Warp's default device, which Isaac Lab sets to the sim device. With
# --device cpu this mismatch segfaults, so pin the default device to cuRobo's GPU
# while parsing the stage.
with wp.ScopedDevice(f"cuda:{self.config.cuda_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 · Implementation — Rebuilds device string instead of reusing tensor_args

self.tensor_args.device already owns the resolved device where cuRobo's arrays live (used at line 322). Re-deriving f"cuda:{self.config.cuda_device}" adds a second owner of device resolution that can diverge and reintroduce the mismatch. Use str(self.tensor_args.device).

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Fixes a crash in collision world initialization on CPU simulations.

Resolve the device before entering the new scope so the supported cuda_device=None option works before merging.

Findings

  1. P1 Current-device option breaks ▶

Summary

Wraps static obstacle extraction in wp.ScopedDevice to avoid running cuRobo's CUDA mesh triangulation on the simulation's CPU device.

  • Adds a changelog fragment describing the fix.
  • The new scope breaks the documented cuda_device=None option.

Reviews (1) · Last reviewed commit: "Fix SkillGen quad mesh triangulation seg..." · Reviewed by Greptile

# kernel on Warp's default device, which Isaac Lab sets to the sim device. With
# --device cpu this mismatch segfaults, so pin the default device to cuRobo's GPU
# while parsing the stage.
with wp.ScopedDevice(f"cuda:{self.config.cuda_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.

P1 Current-device option breaks

Setting cuda_device=None now breaks planner initialization. This is a documented option, and the constructor resolves it to torch.cuda.current_device(). The new scope instead receives cuda:None, which is not a valid Warp device. Use the resolved self.tensor_args.device rather than formatting the raw config value.

Suggested change
with wp.ScopedDevice(f"cuda:{self.config.cuda_device}"):
with wp.ScopedDevice(str(self.tensor_args.device)):

@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 Oct 9, 2026
@kellyguo11
kellyguo11 merged commit 2df15f9 into isaac-sim:develop Oct 9, 2026
60 checks passed
isaaclab-bot Bot pushed a commit that referenced this pull request Oct 9, 2026
# Description

cuRobo's quad-mesh triangulation (`curobo/util/usd_helper.py`) creates
its Warp arrays on CUDA but calls `wp.launch()` without a device, so the
kernel runs on Warp's default device. Since #7658, `SimulationContext`
sets the Warp default
device to the sim device, so `--device cpu` runs execute the
CPU-compiled kernel against CUDA pointers.

Fix: wrap the planner's `get_obstacles_from_stage()` call in
`wp.ScopedDevice(f"cuda:{cuda_device}")` so cuRobo's deviceless launch
lands on the device its arrays live on.

## Type of change

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

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## 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
`./isaaclab.sh --format`
- [x] My changes generate no new warnings
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

(cherry picked from commit 2df15f9)
@isaaclab-bot

isaaclab-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Backported to release/3.0.0 as 574c2ef.

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

Labels

isaac-mimic Related to Isaac Mimic team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants